Update app.py
Browse files
app.py
CHANGED
|
@@ -146,13 +146,9 @@ def create_vector_db(final_items):
|
|
| 146 |
documents = []
|
| 147 |
import torch
|
| 148 |
from llama_cpp import Llama
|
|
|
|
|
|
|
| 149 |
|
| 150 |
-
llm = Llama.from_pretrained(
|
| 151 |
-
repo_id="xzlinuxmodels/ollama3.1",
|
| 152 |
-
filename="unsloth.BF16.gguf",
|
| 153 |
-
)
|
| 154 |
-
|
| 155 |
-
|
| 156 |
for item in final_items:
|
| 157 |
prompt = f"""
|
| 158 |
Summarize the following segment of Antimony in a clear and concise manner:
|
|
@@ -162,16 +158,16 @@ def create_vector_db(final_items):
|
|
| 162 |
4. Write the summary in paragraph format, putting an emphasis on clarity and completeness.
|
| 163 |
|
| 164 |
Here is the antimony segment to summarize: {item}
|
| 165 |
-
|
| 166 |
-
Once the summarizing is done, write 'END'.
|
| 167 |
"""
|
| 168 |
|
| 169 |
-
|
| 170 |
prompt,
|
| 171 |
-
max_tokens = None
|
|
|
|
|
|
|
| 172 |
)
|
| 173 |
|
| 174 |
-
|
| 175 |
|
| 176 |
if final_items:
|
| 177 |
db.add(
|
|
|
|
| 146 |
documents = []
|
| 147 |
import torch
|
| 148 |
from llama_cpp import Llama
|
| 149 |
+
CONTEXT_SIZE = 1024
|
| 150 |
+
llm = Llama(model_path="HuggingFaceH4/zephyr-7b-beta", n_ctx = CONTEXT_SIZE)
|
| 151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
for item in final_items:
|
| 153 |
prompt = f"""
|
| 154 |
Summarize the following segment of Antimony in a clear and concise manner:
|
|
|
|
| 158 |
4. Write the summary in paragraph format, putting an emphasis on clarity and completeness.
|
| 159 |
|
| 160 |
Here is the antimony segment to summarize: {item}
|
|
|
|
|
|
|
| 161 |
"""
|
| 162 |
|
| 163 |
+
model_output = llm(
|
| 164 |
prompt,
|
| 165 |
+
max_tokens = None
|
| 166 |
+
temperature = 0.3,
|
| 167 |
+
top_p = 0.1
|
| 168 |
)
|
| 169 |
|
| 170 |
+
final_result = model_output["choices"][0]["text"].strip()
|
| 171 |
|
| 172 |
if final_items:
|
| 173 |
db.add(
|