Upload app.py
Browse files
app.py
CHANGED
@@ -224,11 +224,11 @@ def load_models():
|
|
224 |
assert isinstance(tokenizer, (PreTrainedTokenizer, PreTrainedTokenizerFast)), f"Tokenizer is of type {type(tokenizer)}"
|
225 |
|
226 |
print(f"Loading LLM: {MODEL_PATH} 🤖")
|
227 |
-
text_model = AutoModelForCausalLM.from_pretrained(MODEL_PATH, quantization_config=nf4_config
|
228 |
|
229 |
if False and IS_LORA and LORA_PATH.exists(): # omitted
|
230 |
print("Loading VLM's custom text model 🤖")
|
231 |
-
text_model = PeftModel.from_pretrained(model=text_model, model_id=LORA_PATH,
|
232 |
text_model = text_model.merge_and_unload(safe_merge=True) # to avoid PEFT bug https://github.com/huggingface/transformers/issues/28515
|
233 |
else: print("VLM's custom text model isn't loaded 🤖")
|
234 |
|
|
|
224 |
assert isinstance(tokenizer, (PreTrainedTokenizer, PreTrainedTokenizerFast)), f"Tokenizer is of type {type(tokenizer)}"
|
225 |
|
226 |
print(f"Loading LLM: {MODEL_PATH} 🤖")
|
227 |
+
text_model = AutoModelForCausalLM.from_pretrained(MODEL_PATH, quantization_config=nf4_config).eval()
|
228 |
|
229 |
if False and IS_LORA and LORA_PATH.exists(): # omitted
|
230 |
print("Loading VLM's custom text model 🤖")
|
231 |
+
text_model = PeftModel.from_pretrained(model=text_model, model_id=LORA_PATH, quantization_config=nf4_config)
|
232 |
text_model = text_model.merge_and_unload(safe_merge=True) # to avoid PEFT bug https://github.com/huggingface/transformers/issues/28515
|
233 |
else: print("VLM's custom text model isn't loaded 🤖")
|
234 |
|