Update app.py
Browse files
app.py
CHANGED
|
@@ -3,19 +3,24 @@ from llama_cpp import Llama
|
|
| 3 |
import os
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
MODEL_REPO = "
|
| 8 |
-
MODEL_FILE = "
|
| 9 |
-
MAX_TOKENS = 150
|
| 10 |
-
CPU_THREADS = os.cpu_count() or 4 # Use all available cores
|
| 11 |
|
| 12 |
-
# Download model
|
| 13 |
model_path = hf_hub_download(
|
| 14 |
repo_id=MODEL_REPO,
|
| 15 |
filename=MODEL_FILE,
|
| 16 |
-
|
| 17 |
)
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
# Initialize Llama
|
| 20 |
llm = Llama(
|
| 21 |
model_path=model_path,
|
|
|
|
| 3 |
import os
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
|
| 6 |
+
# Verified working repositories (as of July 2024)
|
| 7 |
+
MODEL_REPO = "bartowski/Mistral-7B-Instruct-v0.3-GGUF"
|
| 8 |
+
MODEL_FILE = "Mistral-7B-Instruct-v0.3-Q4_K_M.gguf"
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# Download model
|
| 11 |
model_path = hf_hub_download(
|
| 12 |
repo_id=MODEL_REPO,
|
| 13 |
filename=MODEL_FILE,
|
| 14 |
+
token=os.environ.get("HF_TOKEN") # Required for gated models
|
| 15 |
)
|
| 16 |
|
| 17 |
+
|
| 18 |
+
# Configuration
|
| 19 |
+
MODEL_REPO = "TheBloke/Mistral-7B-Instruct-v0.3-GGUF"
|
| 20 |
+
MODEL_FILE = "mistral-7b-instruct-v0.3.Q4_K_M.gguf"
|
| 21 |
+
MAX_TOKENS = 150
|
| 22 |
+
CPU_THREADS = os.cpu_count()
|
| 23 |
+
|
| 24 |
# Initialize Llama
|
| 25 |
llm = Llama(
|
| 26 |
model_path=model_path,
|