Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,8 +2,14 @@ import gradio as gr
|
|
| 2 |
from llama_cpp import Llama
|
| 3 |
|
| 4 |
# 1. Path to your GGUF file inside the Space repository
|
| 5 |
-
MODEL_PATH = "simonper/fine-tuned-gguf-modal1/Llama-3.2-1B.Q8_0.gguf" # <- change if your file is named differently
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# 2. Load the GGUF model once at startup
|
| 8 |
llm = Llama(
|
| 9 |
model_path=MODEL_PATH,
|
|
@@ -11,7 +17,7 @@ llm = Llama(
|
|
| 11 |
n_threads=8, # tweak based on CPU in the Space
|
| 12 |
n_gpu_layers=0, # 0 = pure CPU, >0 if GPU layers are available
|
| 13 |
)
|
| 14 |
-
|
| 15 |
|
| 16 |
def build_prompt(system_message: str, history: list[dict], user_message: str) -> str:
|
| 17 |
"""
|
|
|
|
| 2 |
from llama_cpp import Llama
|
| 3 |
|
| 4 |
# 1. Path to your GGUF file inside the Space repository
|
| 5 |
+
#MODEL_PATH = "simonper/fine-tuned-gguf-modal1/Llama-3.2-1B.Q8_0.gguf" # <- change if your file is named differently
|
| 6 |
|
| 7 |
+
llm = Llama.from_pretrained(
|
| 8 |
+
repo_id="simonper/fine-tuned-gguf-modal1",
|
| 9 |
+
filename="Llama-3.2-1B.Q8_0.gguf",
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
"""
|
| 13 |
# 2. Load the GGUF model once at startup
|
| 14 |
llm = Llama(
|
| 15 |
model_path=MODEL_PATH,
|
|
|
|
| 17 |
n_threads=8, # tweak based on CPU in the Space
|
| 18 |
n_gpu_layers=0, # 0 = pure CPU, >0 if GPU layers are available
|
| 19 |
)
|
| 20 |
+
"""
|
| 21 |
|
| 22 |
def build_prompt(system_message: str, history: list[dict], user_message: str) -> str:
|
| 23 |
"""
|