alexkueck commited on
Commit
10eb122
·
verified ·
1 Parent(s): a3ed49b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -26,7 +26,7 @@ from langchain.document_loaders.blob_loaders.youtube_audio import YoutubeAudioLo
26
  from langchain.document_loaders.generic import GenericLoader
27
  from langchain.document_loaders.parsers import OpenAIWhisperParser
28
  from langchain.schema import AIMessage, HumanMessage
29
- from langchain.llms import HuggingFaceHub, HuggingFaceTransformerChain
30
  from langchain.llms import HuggingFaceTextGenInference
31
  from langchain.embeddings import HuggingFaceInstructEmbeddings, HuggingFaceEmbeddings, HuggingFaceBgeEmbeddings, HuggingFaceInferenceAPIEmbeddings
32
  from langchain.retrievers.tavily_search_api import TavilySearchAPIRetriever
@@ -93,7 +93,7 @@ MODEL_NAME_CODE = "code-davinci-002"
93
  #verfügbare Modelle anzeigen lassen
94
  #HuggingFace Reop ID--------------------------------
95
  #repo_id = "meta-llama/Llama-2-13b-chat-hf"
96
- repo_id = "HuggingFaceH4/zephyr-7b-alpha" #das Modell ist echt gut!!! Vom MIT
97
  #repo_id = "TheBloke/Yi-34B-Chat-GGUF"
98
  #repo_id = "meta-llama/Llama-2-70b-chat-hf"
99
  #repo_id = "tiiuae/falcon-40b"
@@ -106,6 +106,8 @@ repo_id = "HuggingFaceH4/zephyr-7b-alpha" #das Modell ist echt gut!!! Vom MIT
106
  #repo_id = "Writer/camel-5b-hf"
107
  #repo_id = "databricks/dolly-v2-3b"
108
  #repo_id = "google/flan-t5-xxl"
 
 
109
 
110
  #HuggingFace Model name--------------------------------
111
  MODEL_NAME_HF = "mistralai/Mixtral-8x7B-Instruct-v0.1"
@@ -534,8 +536,8 @@ def generate_text (prompt, chatbot, history, rag_option, model_option, openai_ap
534
  #oder an Hugging Face --------------------------
535
  print("HF Anfrage.......................")
536
  model_kwargs={"temperature": 0.5, "max_length": 512, "num_return_sequences": 1, "top_k": top_k, "top_p": top_p, "repetition_penalty": repetition_penalty}
537
- #llm = HuggingFaceHub(repo_id=repo_id, model_kwargs=model_kwargs)
538
- llm = HuggingFaceTransformerChain(model=MODEL_NAME_HF, model_kwargs={"temperature": 0.5, "max_length": 128})
539
  #llm = HuggingFaceHub(url_??? = "https://wdgsjd6zf201mufn.us-east-1.aws.endpoints.huggingface.cloud", model_kwargs={"temperature": 0.5, "max_length": 64})
540
  #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,)
541
  #llm via HuggingChat
 
26
  from langchain.document_loaders.generic import GenericLoader
27
  from langchain.document_loaders.parsers import OpenAIWhisperParser
28
  from langchain.schema import AIMessage, HumanMessage
29
+ from langchain.llms import HuggingFaceHub
30
  from langchain.llms import HuggingFaceTextGenInference
31
  from langchain.embeddings import HuggingFaceInstructEmbeddings, HuggingFaceEmbeddings, HuggingFaceBgeEmbeddings, HuggingFaceInferenceAPIEmbeddings
32
  from langchain.retrievers.tavily_search_api import TavilySearchAPIRetriever
 
93
  #verfügbare Modelle anzeigen lassen
94
  #HuggingFace Reop ID--------------------------------
95
  #repo_id = "meta-llama/Llama-2-13b-chat-hf"
96
+ #repo_id = "HuggingFaceH4/zephyr-7b-alpha" #das Modell ist echt gut!!! Vom MIT
97
  #repo_id = "TheBloke/Yi-34B-Chat-GGUF"
98
  #repo_id = "meta-llama/Llama-2-70b-chat-hf"
99
  #repo_id = "tiiuae/falcon-40b"
 
106
  #repo_id = "Writer/camel-5b-hf"
107
  #repo_id = "databricks/dolly-v2-3b"
108
  #repo_id = "google/flan-t5-xxl"
109
+ #repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
110
+ repo_id = "abacusai/Smaug-72B-v0.1"
111
 
112
  #HuggingFace Model name--------------------------------
113
  MODEL_NAME_HF = "mistralai/Mixtral-8x7B-Instruct-v0.1"
 
536
  #oder an Hugging Face --------------------------
537
  print("HF Anfrage.......................")
538
  model_kwargs={"temperature": 0.5, "max_length": 512, "num_return_sequences": 1, "top_k": top_k, "top_p": top_p, "repetition_penalty": repetition_penalty}
539
+ llm = HuggingFaceHub(repo_id=repo_id, model_kwargs=model_kwargs)
540
+ #llm = HuggingFaceChain(model=MODEL_NAME_HF, model_kwargs={"temperature": 0.5, "max_length": 128})
541
  #llm = HuggingFaceHub(url_??? = "https://wdgsjd6zf201mufn.us-east-1.aws.endpoints.huggingface.cloud", model_kwargs={"temperature": 0.5, "max_length": 64})
542
  #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,)
543
  #llm via HuggingChat