Stanislav commited on
Commit
3164b96
·
1 Parent(s): 24ec3e7

feat: HF cache

Browse files
Files changed (1) hide show
  1. run_fastapi.py +5 -0
run_fastapi.py CHANGED
@@ -15,6 +15,11 @@ from models.dino import DinoWrapper
15
 
16
  from huggingface_hub import hf_hub_download
17
 
 
 
 
 
 
18
  # Check write permissions
19
  print("WRITE to ./weights:", os.access("weights", os.W_OK))
20
  print("WRITE to /tmp:", os.access("/tmp", os.W_OK))
 
15
 
16
  from huggingface_hub import hf_hub_download
17
 
18
+ # HF Cache
19
+ HF_CACHE_DIR = os.path.join("/tmp", "hf_cache")
20
+ os.environ["TRANSFORMERS_CACHE"] = HF_CACHE_DIR
21
+ os.makedirs(HF_CACHE_DIR, exist_ok=True)
22
+
23
  # Check write permissions
24
  print("WRITE to ./weights:", os.access("weights", os.W_OK))
25
  print("WRITE to /tmp:", os.access("/tmp", os.W_OK))