diff --git a/modules/interrogate/deepseek.py b/modules/interrogate/deepseek.py index 8611efb82..2c967f85f 100644 --- a/modules/interrogate/deepseek.py +++ b/modules/interrogate/deepseek.py @@ -73,6 +73,7 @@ def unload(): def predict(question, image, repo): + global vl_gpt # pylint: disable=global-statement if not load(repo): return '' diff --git a/modules/interrogate/vqa.py b/modules/interrogate/vqa.py index 02c132a33..a5ac64766 100644 --- a/modules/interrogate/vqa.py +++ b/modules/interrogate/vqa.py @@ -286,10 +286,10 @@ def clean(response, question, prefill=None): elif isinstance(response, dict): text_response = "" if 'reasoning' in response and shared.opts.interrogate_vlm_keep_thinking: - r_text = response['reasoning'] - if isinstance(r_text, dict) and 'text' in r_text: - r_text = r_text['text'] - text_response += f"Reasoning:\n{r_text}\n\nAnswer:\n" + r_text = response['reasoning'] + if isinstance(r_text, dict) and 'text' in r_text: + r_text = r_text['text'] + text_response += f"Reasoning:\n{r_text}\n\nAnswer:\n" if 'answer' in response: text_response += response['answer'] @@ -771,7 +771,7 @@ class VQA: self.loaded = repo devices.torch_gc() - def _paligemma(self, question: str, image: Image.Image, repo: str, model_name: str = None): + def _paligemma(self, question: str, image: Image.Image, repo: str, model_name: str = None): # pylint: disable=unused-argument self._load_paligemma(repo) sd_models.move_model(self.model, devices.device) question = question.replace('<', '').replace('>', '').replace('_', ' ') @@ -801,7 +801,7 @@ class VQA: self.loaded = repo devices.torch_gc() - def _ovis(self, question: str, image: Image.Image, repo: str, model_name: str = None): + def _ovis(self, question: str, image: Image.Image, repo: str, model_name: str = None): # pylint: disable=unused-argument try: import flash_attn # pylint: disable=unused-import except Exception: @@ -956,7 +956,7 @@ class VQA: self.loaded = repo devices.torch_gc() - def _git(self, question: str, image: Image.Image, repo: str, model_name: str = None): + def _git(self, question: str, image: Image.Image, repo: str, model_name: str = None): # pylint: disable=unused-argument self._load_git(repo) sd_models.move_model(self.model, devices.device) pixel_values = self.processor(images=image, return_tensors="pt").pixel_values @@ -986,7 +986,7 @@ class VQA: self.loaded = repo devices.torch_gc() - def _blip(self, question: str, image: Image.Image, repo: str, model_name: str = None): + def _blip(self, question: str, image: Image.Image, repo: str, model_name: str = None): # pylint: disable=unused-argument self._load_blip(repo) sd_models.move_model(self.model, devices.device) inputs = self.processor(image, question, return_tensors="pt") @@ -1010,7 +1010,7 @@ class VQA: self.loaded = repo devices.torch_gc() - def _vilt(self, question: str, image: Image.Image, repo: str, model_name: str = None): + def _vilt(self, question: str, image: Image.Image, repo: str, model_name: str = None): # pylint: disable=unused-argument self._load_vilt(repo) sd_models.move_model(self.model, devices.device) inputs = self.processor(image, question, return_tensors="pt") @@ -1036,7 +1036,7 @@ class VQA: self.loaded = repo devices.torch_gc() - def _pix(self, question: str, image: Image.Image, repo: str, model_name: str = None): + def _pix(self, question: str, image: Image.Image, repo: str, model_name: str = None): # pylint: disable=unused-argument self._load_pix(repo) sd_models.move_model(self.model, devices.device) if len(question) > 0: @@ -1164,7 +1164,7 @@ class VQA: self.model.eval() devices.torch_gc() - def _florence(self, question: str, image: Image.Image, repo: str, revision: str = None, model_name: str = None): + def _florence(self, question: str, image: Image.Image, repo: str, revision: str = None, model_name: str = None): # pylint: disable=unused-argument self._load_florence(repo, revision) sd_models.move_model(self.model, devices.device) if question.startswith('<'): @@ -1203,7 +1203,7 @@ class VQA: self.loaded = repo devices.torch_gc() - def _sa2(self, question: str, image: Image.Image, repo: str, model_name: str = None): + def _sa2(self, question: str, image: Image.Image, repo: str, model_name: str = None): # pylint: disable=unused-argument self._load_sa2(repo) sd_models.move_model(self.model, devices.device) if question.startswith('<'): diff --git a/modules/sdnq/quantizer.py b/modules/sdnq/quantizer.py index d12608b24..ae74cd9a4 100644 --- a/modules/sdnq/quantizer.py +++ b/modules/sdnq/quantizer.py @@ -599,8 +599,8 @@ class SDNQQuantize(): input_dict: dict[str, list[torch.Tensor]], model: torch.nn.Module = None, full_layer_name: str = None, - missing_keys: list[str] = None, - **kwargs, + missing_keys: list[str] = None, # pylint: disable=unused-argument + **kwargs, # pylint: disable=unused-argument ) -> dict[str, torch.FloatTensor]: _module_name, value = tuple(input_dict.items())[0] value = value[0]