Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,8 @@ import gradio as gr
|
|
| 11 |
from huggingface_hub import hf_hub_download
|
| 12 |
from ui import css, PLACEHOLDER
|
| 13 |
|
|
|
|
|
|
|
| 14 |
# hf_hub_download(repo_id="bartowski/dolphin-2.9.1-yi-1.5-34b-GGUF", filename="dolphin-2.9.1-yi-1.5-34b-Q6_K.gguf", local_dir = "./models")
|
| 15 |
hf_hub_download(repo_id="crusoeai/dolphin-2.9.1-llama-3-70b-GGUF", filename="dolphin-2.9.1-llama-3-70b.Q3_K_M.gguf", local_dir = "./models")
|
| 16 |
# hf_hub_download(repo_id="kroonen/dolphin-2.9.2-Phi-3-Medium-GGUF", filename="dolphin-2.9.2-Phi-3-Medium-Q6_K.gguf", local_dir = "./models")
|
|
@@ -26,14 +28,19 @@ def respond(
|
|
| 26 |
top_p,
|
| 27 |
top_k,
|
| 28 |
repeat_penalty,
|
| 29 |
-
):
|
| 30 |
-
llm
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
provider = LlamaCppPythonProvider(llm)
|
| 38 |
|
| 39 |
agent = LlamaCppAgent(
|
|
|
|
| 11 |
from huggingface_hub import hf_hub_download
|
| 12 |
from ui import css, PLACEHOLDER
|
| 13 |
|
| 14 |
+
llm = None
|
| 15 |
+
llm_model = None
|
| 16 |
# hf_hub_download(repo_id="bartowski/dolphin-2.9.1-yi-1.5-34b-GGUF", filename="dolphin-2.9.1-yi-1.5-34b-Q6_K.gguf", local_dir = "./models")
|
| 17 |
hf_hub_download(repo_id="crusoeai/dolphin-2.9.1-llama-3-70b-GGUF", filename="dolphin-2.9.1-llama-3-70b.Q3_K_M.gguf", local_dir = "./models")
|
| 18 |
# hf_hub_download(repo_id="kroonen/dolphin-2.9.2-Phi-3-Medium-GGUF", filename="dolphin-2.9.2-Phi-3-Medium-Q6_K.gguf", local_dir = "./models")
|
|
|
|
| 28 |
top_p,
|
| 29 |
top_k,
|
| 30 |
repeat_penalty,
|
| 31 |
+
):
|
| 32 |
+
global llm
|
| 33 |
+
global llm_model
|
| 34 |
+
|
| 35 |
+
if llm is None or llm_model != model:
|
| 36 |
+
llm = Llama(
|
| 37 |
+
model_path=f"models/{model}",
|
| 38 |
+
flash_attn=True,
|
| 39 |
+
n_gpu_layers=81,
|
| 40 |
+
n_batch=1024,
|
| 41 |
+
n_ctx=8192,
|
| 42 |
+
)
|
| 43 |
+
llm_model=model
|
| 44 |
provider = LlamaCppPythonProvider(llm)
|
| 45 |
|
| 46 |
agent = LlamaCppAgent(
|