Spaces:
Sleeping
Sleeping
Update download_model.py
Browse files- download_model.py +5 -4
download_model.py
CHANGED
|
@@ -1,16 +1,17 @@
|
|
| 1 |
import os
|
| 2 |
from huggingface_hub import hf_hub_download
|
| 3 |
|
| 4 |
-
#
|
| 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 |
-
#
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 1 |
import os
|
| 2 |
from huggingface_hub import hf_hub_download
|
| 3 |
|
| 4 |
+
# Set environment to use writable location
|
| 5 |
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 6 |
os.environ["HF_HUB_CACHE"] = "/tmp/huggingface"
|
| 7 |
|
| 8 |
+
# Download model into temp-writable location
|
| 9 |
model_path = hf_hub_download(
|
| 10 |
repo_id="TheBloke/phi-2-GGUF",
|
| 11 |
filename="phi-2.Q4_K_M.gguf",
|
| 12 |
cache_dir="/tmp/huggingface"
|
| 13 |
)
|
| 14 |
|
| 15 |
+
# Save the path so app.py can use it
|
| 16 |
+
with open("/tmp/model_path.txt", "w") as f:
|
| 17 |
+
f.write(model_path)
|