Spaces:
Runtime error
Runtime error
Kaan
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from fastapi import FastAPI, HTTPException
|
| 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 3 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
app = FastAPI()
|
|
@@ -15,8 +16,9 @@ async def generate_text():
|
|
| 15 |
model_dir = os.path.join(cache_dir, "TheBloke/Mistral-7B-v0.1-GGUF")
|
| 16 |
os.makedirs(model_dir, exist_ok=True)
|
| 17 |
|
| 18 |
-
hf_hub_download(repo_id="TheBloke/Mistral-7B-v0.1-GGUF", filename="mistral-7b-v0.1.Q4_K_M.gguf", local_dir=model_dir)
|
| 19 |
-
hf_hub_download(repo_id="TheBloke/Mistral-7B-v0.1-GGUF", filename="config.json", local_dir=model_dir)
|
|
|
|
| 20 |
|
| 21 |
# Check if config.json file exists in the model directory
|
| 22 |
config_file = os.path.join(model_dir, "config.json")
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException
|
| 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 3 |
from huggingface_hub import hf_hub_download
|
| 4 |
+
from huggingface_hub import snapshot_download
|
| 5 |
import os
|
| 6 |
|
| 7 |
app = FastAPI()
|
|
|
|
| 16 |
model_dir = os.path.join(cache_dir, "TheBloke/Mistral-7B-v0.1-GGUF")
|
| 17 |
os.makedirs(model_dir, exist_ok=True)
|
| 18 |
|
| 19 |
+
#hf_hub_download(repo_id="TheBloke/Mistral-7B-v0.1-GGUF", filename="mistral-7b-v0.1.Q4_K_M.gguf", local_dir=model_dir)
|
| 20 |
+
#hf_hub_download(repo_id="TheBloke/Mistral-7B-v0.1-GGUF", filename="config.json", local_dir=model_dir)
|
| 21 |
+
snapshot_download(repo_id="TheBloke/Mistral-7B-v0.1-GGUF", local_dir=model_dir)
|
| 22 |
|
| 23 |
# Check if config.json file exists in the model directory
|
| 24 |
config_file = os.path.join(model_dir, "config.json")
|