Spaces:
Sleeping
Sleeping
Commit ·
5948801
1
Parent(s): 8d7932c
updated app.py
Browse files
app.py
CHANGED
|
@@ -81,9 +81,16 @@ def process_files(files):
|
|
| 81 |
result = collection.get(include=['embeddings', 'documents', 'metadatas'])
|
| 82 |
|
| 83 |
# HF Pipeline
|
| 84 |
-
hf_pipeline = pipeline(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
-
|
|
|
|
| 87 |
memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True)
|
| 88 |
retriever = vectorstore.as_retriever(search_kwargs={"k": 10})
|
| 89 |
global conversation_chain
|
|
|
|
| 81 |
result = collection.get(include=['embeddings', 'documents', 'metadatas'])
|
| 82 |
|
| 83 |
# HF Pipeline
|
| 84 |
+
hf_pipeline = pipeline(
|
| 85 |
+
"text-generation",
|
| 86 |
+
model="mistralai/Mistral-7B-Instruct-v0.1",
|
| 87 |
+
torch_dtype="auto",
|
| 88 |
+
device_map="auto", # Uses GPU if available
|
| 89 |
+
max_new_tokens=256, # Adjust output length
|
| 90 |
+
)
|
| 91 |
|
| 92 |
+
# Wrap it in LangChain
|
| 93 |
+
llm = HuggingFacePipeline(pipeline=hf_pipeline)
|
| 94 |
memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True)
|
| 95 |
retriever = vectorstore.as_retriever(search_kwargs={"k": 10})
|
| 96 |
global conversation_chain
|