Spaces:
Runtime error
Runtime error
ishaan-mital
commited on
Commit
·
1716bb2
1
Parent(s):
2b2d082
lets see
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
|
6 |
import torch
|
7 |
import sentence_transformers
|
8 |
from langchain.vectorstores import Pinecone
|
9 |
-
from langchain import
|
10 |
from langchain.prompts import PromptTemplate
|
11 |
from langchain.chains import RetrievalQA
|
12 |
|
@@ -55,15 +55,19 @@ vectorstore = Pinecone(
|
|
55 |
)
|
56 |
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
63 |
)
|
64 |
|
65 |
rag_pipeline = RetrievalQA.from_chain_type(
|
66 |
-
llm=
|
67 |
retriever=vectorstore.as_retriever()
|
68 |
)
|
69 |
|
|
|
6 |
import torch
|
7 |
import sentence_transformers
|
8 |
from langchain.vectorstores import Pinecone
|
9 |
+
from langchain.llms.huggingface_text_gen_inference import HuggingFaceTextGenInference
|
10 |
from langchain.prompts import PromptTemplate
|
11 |
from langchain.chains import RetrievalQA
|
12 |
|
|
|
55 |
)
|
56 |
|
57 |
|
58 |
+
API_URL = "https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta"
|
59 |
+
llm = HuggingFaceTextGenInference(
|
60 |
+
inference_server_url=API_URL,
|
61 |
+
max_new_tokens=512,
|
62 |
+
top_k=10,
|
63 |
+
top_p=0.95,
|
64 |
+
typical_p=0.95,
|
65 |
+
temperature=0.01,
|
66 |
+
repetition_penalty=1.03,
|
67 |
)
|
68 |
|
69 |
rag_pipeline = RetrievalQA.from_chain_type(
|
70 |
+
llm=llm, chain_type='stuff',
|
71 |
retriever=vectorstore.as_retriever()
|
72 |
)
|
73 |
|