datacipen commited on
Commit
98b7a10
1 Parent(s): 2b20bc1

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -3
main.py CHANGED
@@ -437,9 +437,12 @@ async def start():
437
  # temperature=1.0,
438
  # streaming=True
439
  #)
440
- from transformers import LlamaTokenizerFast, MistralForCausalLM
441
- import torch
442
- model = MistralForCausalLM.from_pretrained('mistralai/Mistral-Small-Instruct-2409', torch_dtype=torch.bfloat16)
 
 
 
443
  if not cl.user_session.get("saveMemory"):
444
  cl.user_session.set("saveMemory", "")
445
  cl.user_session.set("memory", ConversationBufferMemory(return_messages=True))
 
437
  # temperature=1.0,
438
  # streaming=True
439
  #)
440
+ from langchain_huggingface.llms import HuggingFacePipeline
441
+ model = HuggingFacePipeline.from_model_id(
442
+ model_id="mistralai/Mistral-Small-Instruct-2409",
443
+ task="text-generation",
444
+ pipeline_kwargs={"max_new_tokens": 10},
445
+ )
446
  if not cl.user_session.get("saveMemory"):
447
  cl.user_session.set("saveMemory", "")
448
  cl.user_session.set("memory", ConversationBufferMemory(return_messages=True))