Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,6 @@ from langchain.document_loaders.generic import GenericLoader
|
|
| 12 |
from langchain.document_loaders.parsers import OpenAIWhisperParser
|
| 13 |
from langchain.schema import AIMessage, HumanMessage
|
| 14 |
from langchain.llms import HuggingFaceHub
|
| 15 |
-
from langchain.chains import HuggingFaceChain
|
| 16 |
from langchain.llms import HuggingFaceTextGenInference
|
| 17 |
from langchain.embeddings import HuggingFaceInstructEmbeddings, HuggingFaceEmbeddings, HuggingFaceBgeEmbeddings, HuggingFaceInferenceAPIEmbeddings
|
| 18 |
|
|
@@ -321,8 +320,8 @@ def invoke (prompt, history, rag_option, model_option, openai_api_key, temperat
|
|
| 321 |
print("openAI")
|
| 322 |
else:
|
| 323 |
#oder an Hugging Face --------------------------
|
| 324 |
-
|
| 325 |
-
llm = HuggingFaceChain(model=MODEL_NAME_HF, model_kwargs={"temperature": 0.5, "max_length": 128})
|
| 326 |
#llm = HuggingFaceHub(url_??? = "https://wdgsjd6zf201mufn.us-east-1.aws.endpoints.huggingface.cloud", model_kwargs={"temperature": 0.5, "max_length": 64})
|
| 327 |
#llm = HuggingFaceTextGenInference( inference_server_url="http://localhost:8010/", max_new_tokens=max_new_tokens,top_k=10,top_p=top_p,typical_p=0.95,temperature=temperature,repetition_penalty=repetition_penalty,)
|
| 328 |
print("HF")
|
|
|
|
| 12 |
from langchain.document_loaders.parsers import OpenAIWhisperParser
|
| 13 |
from langchain.schema import AIMessage, HumanMessage
|
| 14 |
from langchain.llms import HuggingFaceHub
|
|
|
|
| 15 |
from langchain.llms import HuggingFaceTextGenInference
|
| 16 |
from langchain.embeddings import HuggingFaceInstructEmbeddings, HuggingFaceEmbeddings, HuggingFaceBgeEmbeddings, HuggingFaceInferenceAPIEmbeddings
|
| 17 |
|
|
|
|
| 320 |
print("openAI")
|
| 321 |
else:
|
| 322 |
#oder an Hugging Face --------------------------
|
| 323 |
+
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature": 0.5, "max_length": 128})
|
| 324 |
+
#llm = HuggingFaceChain(model=MODEL_NAME_HF, model_kwargs={"temperature": 0.5, "max_length": 128})
|
| 325 |
#llm = HuggingFaceHub(url_??? = "https://wdgsjd6zf201mufn.us-east-1.aws.endpoints.huggingface.cloud", model_kwargs={"temperature": 0.5, "max_length": 64})
|
| 326 |
#llm = HuggingFaceTextGenInference( inference_server_url="http://localhost:8010/", max_new_tokens=max_new_tokens,top_k=10,top_p=top_p,typical_p=0.95,temperature=temperature,repetition_penalty=repetition_penalty,)
|
| 327 |
print("HF")
|