Spaces:
Runtime error
Runtime error
Commit
·
052bdcf
1
Parent(s):
2f21499
Update main.py
Browse files
main.py
CHANGED
|
@@ -21,6 +21,7 @@ class UserInterface():
|
|
| 21 |
"HuggingFaceH4/zephyr-7b-beta",
|
| 22 |
"Open-Orca/Mistral-7B-OpenOrca",
|
| 23 |
# "Sharathhebbar24/convo_bot_gpt2",
|
|
|
|
| 24 |
"meta-llama/Llama-2-7b-chat-hf",
|
| 25 |
)
|
| 26 |
self.models = st.sidebar.selectbox(
|
|
@@ -50,7 +51,7 @@ class UserInterface():
|
|
| 50 |
|
| 51 |
self.model_kwargs = {
|
| 52 |
"temperature": self.temperature,
|
| 53 |
-
"
|
| 54 |
}
|
| 55 |
|
| 56 |
os.environ['HUGGINGFACEHUB_API_TOKEN'] = os.getenv("HF_KEY")
|
|
@@ -87,14 +88,15 @@ class UserInterface():
|
|
| 87 |
disabled=text_input_visibility
|
| 88 |
)
|
| 89 |
|
|
|
|
| 90 |
|
| 91 |
-
template = """
|
| 92 |
-
Answer the question based on the context, if you don't know then output "Out of Context"
|
| 93 |
-
Context: {context}
|
| 94 |
-
Question: {question}
|
| 95 |
|
| 96 |
-
Answer:
|
| 97 |
-
"""
|
| 98 |
prompt = PromptTemplate(
|
| 99 |
template=template,
|
| 100 |
input_variables=[
|
|
|
|
| 21 |
"HuggingFaceH4/zephyr-7b-beta",
|
| 22 |
"Open-Orca/Mistral-7B-OpenOrca",
|
| 23 |
# "Sharathhebbar24/convo_bot_gpt2",
|
| 24 |
+
"TinyLlama/TinyLlama-1.1B-Chat-v1.0",
|
| 25 |
"meta-llama/Llama-2-7b-chat-hf",
|
| 26 |
)
|
| 27 |
self.models = st.sidebar.selectbox(
|
|
|
|
| 51 |
|
| 52 |
self.model_kwargs = {
|
| 53 |
"temperature": self.temperature,
|
| 54 |
+
"max_new_tokens": self.max_token_length
|
| 55 |
}
|
| 56 |
|
| 57 |
os.environ['HUGGINGFACEHUB_API_TOKEN'] = os.getenv("HF_KEY")
|
|
|
|
| 88 |
disabled=text_input_visibility
|
| 89 |
)
|
| 90 |
|
| 91 |
+
template = "<|system|>\nYou are a intelligent chatbot and expertise in {context}.</s>\n<|user|>\n{question}.\n<|assistant|>"
|
| 92 |
|
| 93 |
+
# template = """
|
| 94 |
+
# Answer the question based on the context, if you don't know then output "Out of Context"
|
| 95 |
+
# Context: {context}
|
| 96 |
+
# Question: {question}
|
| 97 |
|
| 98 |
+
# Answer:
|
| 99 |
+
# """
|
| 100 |
prompt = PromptTemplate(
|
| 101 |
template=template,
|
| 102 |
input_variables=[
|