Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,9 +8,8 @@ from langchain.chat_models import ChatOpenAI
|
|
8 |
from langchain.memory import ConversationBufferMemory
|
9 |
from langchain.chains import ConversationalRetrievalChain
|
10 |
from htmlTemplates import css, bot_template, user_template
|
11 |
-
from langchain.llms import HuggingFaceHub
|
12 |
-
from huggingface_hub import snapshot_download
|
13 |
-
from llama_cpp import Llama
|
14 |
|
15 |
def get_pdf_text(pdf_docs):
|
16 |
text = ""
|
@@ -40,17 +39,14 @@ def get_vectorstore(text_chunks):
|
|
40 |
|
41 |
|
42 |
def get_conversation_chain(vectorstore):
|
43 |
-
|
44 |
-
#llm = HuggingFaceHub(repo_id="tinkoff-ai/ruDialoGPT-medium", model_kwargs={"temperature": 0.1,
|
45 |
-
#"top_k": 10,
|
46 |
-
# "top_p": 0.95,})
|
47 |
-
#"max_length": 512})
|
48 |
-
|
49 |
repo_name = "IlyaGusev/saiga2_7b_gguf"
|
50 |
model_name = "model-q2_K.gguf"
|
|
|
51 |
snapshot_download(repo_id=repo_name, local_dir=".", allow_patterns=model_name)
|
52 |
|
53 |
-
llm =
|
|
|
54 |
|
55 |
memory = ConversationBufferMemory(
|
56 |
memory_key='chat_history', return_messages=True)
|
|
|
8 |
from langchain.memory import ConversationBufferMemory
|
9 |
from langchain.chains import ConversationalRetrievalChain
|
10 |
from htmlTemplates import css, bot_template, user_template
|
11 |
+
from langchain.llms import HuggingFaceHub, LlamaCpp
|
12 |
+
from huggingface_hub import snapshot_download, hf_hub_download
|
|
|
13 |
|
14 |
def get_pdf_text(pdf_docs):
|
15 |
text = ""
|
|
|
39 |
|
40 |
|
41 |
def get_conversation_chain(vectorstore):
|
42 |
+
|
|
|
|
|
|
|
|
|
|
|
43 |
repo_name = "IlyaGusev/saiga2_7b_gguf"
|
44 |
model_name = "model-q2_K.gguf"
|
45 |
+
|
46 |
snapshot_download(repo_id=repo_name, local_dir=".", allow_patterns=model_name)
|
47 |
|
48 |
+
llm = LlamaCpp(model_path=model_name)
|
49 |
+
#llm = ChatOpenAI()
|
50 |
|
51 |
memory = ConversationBufferMemory(
|
52 |
memory_key='chat_history', return_messages=True)
|