Fix type error in BLIP model generation by converting configuration values to integers. (#1113)

- Cast `num_beams` and `min_length` to integers in `interrogate.py` when passing them to the BLIP model's `generate` function.
- Resolves issues with type mismatches that caused crashes during the interrogation process.
This commit is contained in:
David Martin Rius
2024-08-15 02:37:12 +02:00
committed by GitHub
parent 4eadf1b5e6
commit dad6e9ad02

View File

@@ -178,7 +178,7 @@ class InterrogateModels:
])(pil_image).unsqueeze(0).type(self.dtype).to(self.load_device)
with torch.no_grad():
caption = self.blip_model.generate(gpu_image, sample=False, num_beams=shared.opts.interrogate_clip_num_beams, min_length=shared.opts.interrogate_clip_min_length, max_length=shared.opts.interrogate_clip_max_length)
caption = self.blip_model.generate(gpu_image, sample=False, num_beams=int(shared.opts.interrogate_clip_num_beams), min_length=int(shared.opts.interrogate_clip_min_length), max_length=shared.opts.interrogate_clip_max_length)
return caption[0]