vithacocf commited on
Commit
2364e8e
·
verified ·
1 Parent(s): 682dbc2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -102,10 +102,12 @@ def run_inference(image, prompt, max_new_tokens):
102
  )
103
 
104
  inputs = processor(
105
- text=[text_prompt],
106
- images=[image],
107
- return_tensors="pt"
108
- ).to(model.device)
 
 
109
 
110
  with torch.inference_mode(), torch.cuda.amp.autocast(dtype=torch.float16):
111
  outputs = model.generate(
 
102
  )
103
 
104
  inputs = processor(
105
+ text=[text_prompt],
106
+ images=[image],
107
+ return_tensors="pt",
108
+ truncation=False, # 🔴 BẮT BUỘC
109
+ padding="longest" # 🔴 BẮT BUỘC
110
+ ).to(model.device)
111
 
112
  with torch.inference_mode(), torch.cuda.amp.autocast(dtype=torch.float16):
113
  outputs = model.generate(