TensorCruncher commited on
Commit
0ea07d3
·
verified ·
1 Parent(s): 1f8d0a1

Add cache redirect

Browse files

Cache was blowing up past 50GB causing eviction. This takes care of that.

Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  import torch
3
  import open_clip
 
1
+ import os
2
+
3
+ # Redirect all Hugging Face / Torch caches to ephemeral storage
4
+ os.environ["HF_HOME"] = "/tmp/hf"
5
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf"
6
+ os.environ["TORCH_HOME"] = "/tmp/torch"
7
+ os.environ["XDG_CACHE_HOME"] = "/tmp"
8
+
9
  import gradio as gr
10
  import torch
11
  import open_clip