alexkueck commited on
Commit
3c30e45
·
verified ·
1 Parent(s): 54bd604

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -184,9 +184,14 @@ def generate_text (prompt, chatbot, history, vektordatenbank, retriever, top_p=0
184
  try:
185
  #oder an Hugging Face --------------------------
186
  print("HF Anfrage.......................")
187
- #model_kwargs={"temperature": 0.5, "max_length": 512, "num_return_sequences": 1, "top_k": top_k, "top_p": top_p, "repetition_penalty": repetition_penalty}
188
  #llm = HuggingFaceHub(repo_id=repo_id, model_kwargs=model_kwargs)
189
- llm = HuggingFaceChain(model=MODEL_NAME_HF, model_kwargs={"temperature": 0.5, "max_length": 128})
 
 
 
 
 
190
 
191
  #Prompt an history anhängen und einen Text daraus machen
192
  history_text_und_prompt = generate_prompt_with_history(prompt, history)
 
184
  try:
185
  #oder an Hugging Face --------------------------
186
  print("HF Anfrage.......................")
187
+ model_kwargs={"temperature": 0.5, "max_length": 512, "num_return_sequences": 1, "top_k": top_k, "top_p": top_p, "repetition_penalty": repetition_penalty}
188
  #llm = HuggingFaceHub(repo_id=repo_id, model_kwargs=model_kwargs)
189
+ #llm = HuggingFaceChain(model=MODEL_NAME_HF, model_kwargs={"temperature": 0.5, "max_length": 128})
190
+ # Erstelle eine Pipeline mit den gewünschten Parametern
191
+ pipe = pipeline("text-generation", model=model_name, model_kwargs=model_kwargs)
192
+
193
+ # Erstelle eine HuggingFacePipeline-Kette
194
+ llm = HuggingFacePipeline(pipeline=pipe)
195
 
196
  #Prompt an history anhängen und einen Text daraus machen
197
  history_text_und_prompt = generate_prompt_with_history(prompt, history)