Spaces:
Build error
Build error
clementsan commited on
Commit ·
067316d
1
Parent(s): 146ca67
Add trust_remote_code condition for phi2 model
Browse files70 unmodified lines717273747475767714 unmodified lines9293949596979899100101102103959697989910410510610710810911011170 unmodified linesdef initialize_llmchain(llm_model, temperature, max_tokens, top_k, vector_db, progress=gr.Progress()): progress(0.1, desc="Initializing HF tokenizer...") # HuggingFacePipeline uses local model # Warning: it will download model locally... # Note: it will download model locally... # tokenizer=AutoTokenizer.from_pretrained(llm_model) # progress(0.5, desc="Initializing HF pipeline...") # pipeline=transformers.pipeline(14 unmodified lines # HuggingFaceHub uses HF inference endpoints progress(0.5, desc="Initializing HF Hub...") # Use of trust_remote_code as model_kwargs # Warning: langchain issue # URL: https://github.com/langchain-ai/langchain/issues/6080 if llm_model == "microsoft/phi-2": llm = HuggingFaceHub( repo_id=llm_model, model_kwargs={"temperature": temperature, "max_new_tokens": max_tokens, "top_k": top_k, "trust_remote_code": True, "torch_dtype": "auto"} ) else: llm = HuggingFaceHub( repo_id=llm_model, model_kwargs={"temperature": temperature, "max_new_tokens": max_tokens, "top_k": top_k,\ "trust_remote_code": True, "torch_dtype": "auto"} ) llm = HuggingFaceHub( repo_id=llm_model, # model_kwargs={"temperature": temperature, "max_new_tokens": max_tokens, "top_k": top_k, "trust_remote_code": True, "torch_dtype": "auto"} model_kwargs={"temperature": temperature, "max_new_tokens": max_tokens, "top_k": top_k} ) progress(0.75, desc="Defining buffer memory...") memory = ConversationBufferMemory(app.py+15-6