prompt engineering
Browse files- .gitignore +2 -1
- src/streamlit_app.py +3 -2
.gitignore
CHANGED
|
@@ -2,4 +2,5 @@ todo.txt
|
|
| 2 |
/data
|
| 3 |
/airflow
|
| 4 |
.env
|
| 5 |
-
/src/.streamlit/secrets.toml
|
|
|
|
|
|
| 2 |
/data
|
| 3 |
/airflow
|
| 4 |
.env
|
| 5 |
+
/src/.streamlit/secrets.toml
|
| 6 |
+
/vectorstore/
|
src/streamlit_app.py
CHANGED
|
@@ -37,7 +37,7 @@ prompt = PromptTemplate(
|
|
| 37 |
template=(
|
| 38 |
"You are a knowledgeable agricultural research assistant.\n"
|
| 39 |
"Use the context to answer the question.\n"
|
| 40 |
-
"If you don't know, say \"I don't know\".\n\n"
|
| 41 |
"Return ONLY the answer between <answer> and </answer>.\n\n"
|
| 42 |
"Context:\n{context}\n\n"
|
| 43 |
"Question: {question}\n\n"
|
|
@@ -60,7 +60,8 @@ def load_llm():
|
|
| 60 |
# pipe = pipeline("text-generation", model="google/flan-t5-small", max_new_tokens=256)
|
| 61 |
# load the tokenizer and model on cpu/gpu
|
| 62 |
|
| 63 |
-
model_name = "meta-llama/Llama-
|
|
|
|
| 64 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 65 |
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
|
| 66 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=256)
|
|
|
|
| 37 |
template=(
|
| 38 |
"You are a knowledgeable agricultural research assistant.\n"
|
| 39 |
"Use the context to answer the question.\n"
|
| 40 |
+
# "If you don't know, say \"I don't know\".\n\n"
|
| 41 |
"Return ONLY the answer between <answer> and </answer>.\n\n"
|
| 42 |
"Context:\n{context}\n\n"
|
| 43 |
"Question: {question}\n\n"
|
|
|
|
| 60 |
# pipe = pipeline("text-generation", model="google/flan-t5-small", max_new_tokens=256)
|
| 61 |
# load the tokenizer and model on cpu/gpu
|
| 62 |
|
| 63 |
+
model_name = "meta-llama/Meta-Llama-3-8B-Instruct"
|
| 64 |
+
# model_name = "meta-llama/Llama-2-7b-chat-hf"
|
| 65 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 66 |
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
|
| 67 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=256)
|