File size: 506 Bytes
43a49a4
1e45192
 
5b048d0
d01f0ef
 
43a49a4
5b048d0
d01f0ef
b930f74
c81cd55
d01f0ef
 
43a49a4
5b048d0
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
from huggingface_hub import hf_hub_download

# Set environment to use writable location
os.environ["HF_HOME"] = "/tmp/huggingface"
os.environ["HF_HUB_CACHE"] = "/tmp/huggingface"

# Download model into temp-writable location
model_path = hf_hub_download(
    repo_id="TheBloke/CodeLlama-7B-Instruct-GGUF",
    filename="codellama-7b-instruct.Q4_K_M.gguf",
    cache_dir="/tmp/huggingface"
)

# Save the path so app.py can use it
with open("/tmp/model_path.txt", "w") as f:
    f.write(model_path)