Diamanta commited on
Commit
d01f0ef
·
verified ·
1 Parent(s): 1e45192

Update download_model.py

Browse files
Files changed (1) hide show
  1. download_model.py +11 -13
download_model.py CHANGED
@@ -1,18 +1,16 @@
1
  import os
2
  from huggingface_hub import hf_hub_download
3
 
4
- # Force writable cache path
5
- os.environ["HF_HOME"] = "/tmp/hf_cache"
6
- os.environ["HF_HUB_CACHE"] = "/tmp/hf_cache"
7
 
8
- repo_id = "TheBloke/phi-2-GGUF"
9
- filename = "phi-2.Q4_K_M.gguf"
 
 
 
10
 
11
- # Download to current working dir
12
- hf_hub_download(
13
- repo_id=repo_id,
14
- filename=filename,
15
- cache_dir="/tmp/hf_cache", # override .cache
16
- local_dir=".",
17
- local_dir_use_symlinks=False
18
- )
 
1
  import os
2
  from huggingface_hub import hf_hub_download
3
 
4
+ # Redirect all internal caching to writable location
5
+ os.environ["HF_HOME"] = "/tmp/huggingface"
6
+ os.environ["HF_HUB_CACHE"] = "/tmp/huggingface"
7
 
8
+ model_path = hf_hub_download(
9
+ repo_id="TheBloke/phi-2-GGUF",
10
+ filename="phi-2.Q4_K_M.gguf",
11
+ cache_dir="/tmp/huggingface"
12
+ )
13
 
14
+ # Copy model to working directory
15
+ import shutil
16
+ shutil.copy(model_path, "./phi-2.Q4_K_M.gguf")