Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import os
|
| 2 |
import gradio as gr
|
| 3 |
import copy
|
| 4 |
from llama_cpp import Llama
|
|
@@ -12,8 +11,6 @@ llm = Llama(
|
|
| 12 |
repo_id="microsoft/Phi-3-mini-4k-instruct-gguf",
|
| 13 |
filename="Phi-3-mini-4k-instruct-q4.gguf",
|
| 14 |
),
|
| 15 |
-
# model_path = "./models/Phi-3-mini-4k-instruct-gguf",
|
| 16 |
-
# model_path = "NicholasJohn/OpenBioLLM-Llama3-8B-Q5_K_M.gguf",
|
| 17 |
n_ctx=2048,
|
| 18 |
n_gpu_layers=50, # Adjust based on your VRAM
|
| 19 |
)
|
|
@@ -38,9 +35,6 @@ class VectorStore:
|
|
| 38 |
# Example initialization (assuming you've already populated the vector store)
|
| 39 |
vector_store = VectorStore("embedding_vector")
|
| 40 |
|
| 41 |
-
# Populate with your data if not already done
|
| 42 |
-
# vector_store.populate_vectors(your_texts, your_ids)
|
| 43 |
-
|
| 44 |
def generate_text(
|
| 45 |
message,
|
| 46 |
history: list[tuple[str, str]],
|
|
@@ -58,6 +52,8 @@ def generate_text(
|
|
| 58 |
input_prompt += f"{interaction[0]} [/INST] {interaction[1]} </s><s> [INST] "
|
| 59 |
input_prompt += f"{message} [/INST] "
|
| 60 |
|
|
|
|
|
|
|
| 61 |
temp = ""
|
| 62 |
output = llm(
|
| 63 |
input_prompt,
|
|
@@ -97,3 +93,4 @@ demo = gr.ChatInterface(
|
|
| 97 |
if __name__ == "__main__":
|
| 98 |
demo.launch()
|
| 99 |
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import copy
|
| 3 |
from llama_cpp import Llama
|
|
|
|
| 11 |
repo_id="microsoft/Phi-3-mini-4k-instruct-gguf",
|
| 12 |
filename="Phi-3-mini-4k-instruct-q4.gguf",
|
| 13 |
),
|
|
|
|
|
|
|
| 14 |
n_ctx=2048,
|
| 15 |
n_gpu_layers=50, # Adjust based on your VRAM
|
| 16 |
)
|
|
|
|
| 35 |
# Example initialization (assuming you've already populated the vector store)
|
| 36 |
vector_store = VectorStore("embedding_vector")
|
| 37 |
|
|
|
|
|
|
|
|
|
|
| 38 |
def generate_text(
|
| 39 |
message,
|
| 40 |
history: list[tuple[str, str]],
|
|
|
|
| 52 |
input_prompt += f"{interaction[0]} [/INST] {interaction[1]} </s><s> [INST] "
|
| 53 |
input_prompt += f"{message} [/INST] "
|
| 54 |
|
| 55 |
+
print("Input prompt:", input_prompt) # Debugging output
|
| 56 |
+
|
| 57 |
temp = ""
|
| 58 |
output = llm(
|
| 59 |
input_prompt,
|
|
|
|
| 93 |
if __name__ == "__main__":
|
| 94 |
demo.launch()
|
| 95 |
|
| 96 |
+
|