From dad6e9ad02d82223767c989dc2db6a758153f2f9 Mon Sep 17 00:00:00 2001 From: David Martin Rius <0991592@gmail.com> Date: Thu, 15 Aug 2024 02:37:12 +0200 Subject: [PATCH] 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. --- modules/interrogate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/interrogate.py b/modules/interrogate.py index ae413b17..87ca6aef 100644 --- a/modules/interrogate.py +++ b/modules/interrogate.py @@ -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]