Spaces:
Sleeping
Sleeping
Update download_model.py
Browse files- 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 |
-
#
|
5 |
-
os.environ["HF_HOME"] = "/tmp/
|
6 |
-
os.environ["HF_HUB_CACHE"] = "/tmp/
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
-
|
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")
|
|
|
|
|
|
|
|
|
|