John6666 commited on
Commit
590f310
·
verified ·
1 Parent(s): 79e2c3e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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, device_map=device, torch_dtype=torch.bfloat16).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, device_map=device, 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
 
 
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