Spaces:
Build error
Build error
Update app.py
Browse files23 unmodified lines24252627282930313233343536373839 unmodified lines7879808182838485868788899091929394959697989910010110223 unmodified lines# default_persist_directory = './chroma_HF/'llm_name0 = "mistralai/Mixtral-8x7B-Instruct-v0.1"llm_name1 = "mistralai/Mistral-7B-Instruct-v0.2"llm_name2 = "mistralai/Mistral-7B-Instruct-v0.1"llm_name3 = "meta-llama/Llama-2-7b-chat-hf"llm_name4 = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"llm_name5 = "microsoft/phi-2"llm_name6 = "mosaicml/mpt-7b-instruct"llm_name7 = "tiiuae/falcon-7b-instruct"llm_name8 = "google/flan-t5-xxl"list_llm = [llm_name0, llm_name1, llm_name2, llm_name3, llm_name4, llm_name5, llm_name6, llm_name7, llm_name8]list_llm_simple = [os.path.basename(llm) for llm in list_llm]# Load PDF document and create doc splits39 unmodified lines# Initialize langchain LLM chaindef 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# Note: it will download model locally...# tokenizer=AutoTokenizer.from_pretrained(llm_model)# progress(0.5, desc="Initializing HF pipeline...")# pipeline=transformers.pipeline(# "text-generation",# model=llm_model,# tokenizer=tokenizer,# torch_dtype=torch.bfloat16,# trust_remote_code=True,# device_map="auto",# # max_length=1024,# max_new_tokens=max_tokens,# do_sample=True,# top_k=top_k,# num_return_sequences=1,# eos_token_id=tokenizer.eos_token_id# )# llm = HuggingFacePipeline(pipeline=pipeline, model_kwargs={'temperature': temperature})# HuggingFaceHub uses HF inference endpointsprogress(0.5, desc="Initializing HF Hub...")23 unmodified lines242526272829303139 unmodified lines71727374757623 unmodified lines# default_persist_directory = './chroma_HF/'llm_name0 = "mistralai/Mixtral-8x7B-Instruct-v0.1"list_llm = [llm_name0]list_llm_simple = [os.path.basename(llm) for llm in list_llm]# Load PDF document and create doc splits39 unmodified lines# Initialize langchain LLM chaindef initialize_llmchain(llm_model, temperature, max_tokens, top_k, vector_db, progress=gr.Progress()):progress(0.1, desc="Initializing HF tokenizer...")# HuggingFaceHub uses HF inference endpointsprogress(0.5, desc="Initializing HF Hub...")
app.py+2-28