Fix dtype
Browse files
app.py
CHANGED
|
@@ -42,7 +42,7 @@ def generate_caption(processor, model, image, tokenizer=None, use_float_16=False
|
|
| 42 |
def generate_caption_blip2(processor, model, image, replace_token=False):
|
| 43 |
prompt = "Generate a caption for the image:"
|
| 44 |
|
| 45 |
-
inputs = processor(images=image, text=prompt, return_tensors="pt").to(device=device,
|
| 46 |
|
| 47 |
generated_ids = model.generate(pixel_values=inputs.pixel_values,
|
| 48 |
num_beams=5, max_length=50, min_length=1, top_p=0.9, repetition_penalty=1.5, length_penalty=1.0, temperature=1)
|
|
|
|
| 42 |
def generate_caption_blip2(processor, model, image, replace_token=False):
|
| 43 |
prompt = "Generate a caption for the image:"
|
| 44 |
|
| 45 |
+
inputs = processor(images=image, text=prompt, return_tensors="pt").to(device=device, dtype=torch.float16)
|
| 46 |
|
| 47 |
generated_ids = model.generate(pixel_values=inputs.pixel_values,
|
| 48 |
num_beams=5, max_length=50, min_length=1, top_p=0.9, repetition_penalty=1.5, length_penalty=1.0, temperature=1)
|