Chintan-Shah commited on
Commit
caa75e9
·
verified ·
1 Parent(s): ee0f602

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -249,12 +249,12 @@ model_location = "./MM_FT_C1"
249
 
250
  model = MultimodalPhiModel.from_pretrained(model_location).to(device)
251
 
252
- # model_name = "microsoft/Phi-3.5-mini-instruct"
253
- # base_phi_model = AutoModelForCausalLM.from_pretrained(
254
- # model_name,
255
- # torch_dtype=torch.bfloat16,
256
- # trust_remote_code=True,
257
- # ).to(device)
258
 
259
  def getStringAfter(output, start_str):
260
  if start_str in output:
@@ -308,7 +308,7 @@ def generateOutput(image_path, audio_path, context_text, question, max_length=3)
308
  # base_phi_model.generate(start_tokens, max_length=2, do_sample=False, pad_token_id=tokenizer.pad_token_id)
309
 
310
  output_text = tokenizer.decode(
311
- model.base_phi_model.generate(start_tokens, attention_mask=attention_mask, max_length=1024, do_sample=False, pad_token_id=tokenizer.pad_token_id)[0],
312
  skip_special_tokens=True
313
  )
314
 
 
249
 
250
  model = MultimodalPhiModel.from_pretrained(model_location).to(device)
251
 
252
+ model_name = "microsoft/Phi-3.5-mini-instruct"
253
+ base_phi_model = AutoModelForCausalLM.from_pretrained(
254
+ model_name,
255
+ torch_dtype=torch.bfloat16,
256
+ trust_remote_code=True,
257
+ ).to(device)
258
 
259
  def getStringAfter(output, start_str):
260
  if start_str in output:
 
308
  # base_phi_model.generate(start_tokens, max_length=2, do_sample=False, pad_token_id=tokenizer.pad_token_id)
309
 
310
  output_text = tokenizer.decode(
311
+ base_phi_model.generate(start_tokens, attention_mask=attention_mask, max_length=1024, do_sample=False, pad_token_id=tokenizer.pad_token_id)[0],
312
  skip_special_tokens=True
313
  )
314