Fix Autoconfig
Browse files64 unmodified lines656667686970717273747576777879808182838485868788899091929364 unmodified lines# Wrap the same tiny HF model for LlamaIndexconfig = AutoConfig.from_pretrained(model_id)if config.model_type in ["t5", "mt5", "bart", "mbart", "pegasus", "marian", "prophetnet"]:task = "text2text-generation" # encoder-decoder / seq2seqelse:task = "text-generation"try:llm = HuggingFaceLLM(model_name=model_id,tokenizer_name=model_id,task=task,context_window=2048,generate_kwargs={"max_new_tokens": max_new_tokens, "temperature": temperature},device_map="cpu",)except TypeError:llm = HuggingFaceLLM(model_name=model_id,tokenizer_name=model_id,context_window=2048,generate_kwargs={"max_new_tokens": max_new_tokens, "temperature": float(temperature)},device_map="cpu",)Settings.embed_model = embedSettings.llm = llm64 unmodified lines656667686970717273747576777879808182838485868788899091929394959664 unmodified lines# Wrap the same tiny HF model for LlamaIndextry:config = AutoConfig.from_pretrained(model_id)if config.model_type in ["t5", "mt5", "bart", "mbart", "pegasus", "marian", "prophetnet"]:task = "text2text-generation" # encoder-decoder / seq2seqelse:task = "text-generation"try:llm = HuggingFaceLLM(model_name=model_id,tokenizer_name=model_id,task=task,context_window=2048,generate_kwargs={"max_new_tokens": max_new_tokens, "temperature": temperature},device_map="cpu",)except TypeError:llm = HuggingFaceLLM(model_name=model_id,tokenizer_name=model_id,context_window=2048,generate_kwargs={"max_new_tokens": max_new_tokens, "temperature": float(temperature)},device_map="cpu",)except Exception as e:config = NoneSettings.embed_model = embedSettings.llm = llm
app.py+22-19