Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Inpaint anything" tab vanished #157

Open
rtaskf opened this issue Aug 4, 2024 · 4 comments
Open

"Inpaint anything" tab vanished #157

rtaskf opened this issue Aug 4, 2024 · 4 comments

Comments

@rtaskf
Copy link

rtaskf commented Aug 4, 2024

A few days ago, the extension suddenly stopped working and the extension's tab isn't there anymore. I upgraded my A1111 installation today. I was still running 1.06. It didn't help, though.

This is from the console on startup:

Launching Web UI with arguments: --api --xformers --update-all-extensions --update-check
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
*** Error loading script: inpaint_anything.py
    Traceback (most recent call last):
      File "[...]\Git\stable-diffusion-webui\modules\scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "[...]\Git\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "[...]\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\scripts\inpaint_anything.py", line 32, in <module>
        import inpalib
      File "[...]\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\inpalib\__init__.py", line 2, in <module>
        from .samlib import (create_seg_color_image, generate_sam_masks, get_all_sam_ids,
      File "[...]\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\inpalib\samlib.py", line 19, in <module>
        from ia_sam_manager import check_bfloat16_support, get_sam_mask_generator  # noqa: E402
      File "[...]\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\ia_sam_manager.py", line 16, in <module>
        from sam2.automatic_mask_generator import SAM2AutomaticMaskGenerator
      File "[...]\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\sam2\__init__.py", line 17, in <module>
        initialize_config_dir(configs_path, version_base="1.2")
    TypeError: initialize_config_dir.__init__() got an unexpected keyword argument 'version_base'

---

Do I need to install the latest python version perhaps? I never had any python-related issues with this or any other extension, so that wouldn't be my first guess. I also haven't changed my extension setup in many months. It just started a few days ago for no apparent reason.

@rtaskf
Copy link
Author

rtaskf commented Aug 4, 2024

It looks like the module "termcolor" is missing. When I try to "pip install" it, I get the next batch of missing requirements. When I try to install those, I get more missing requirements.

I'm really not that good with git, but something seems amiss...

And I also uninstalled and upgraded python to the latest version only to find that it's not compatible. I've been spending the day trying to fix the mess. At first, A1111 wouldn't even start anymore. Now I am back where I started, I guess.

The console output looks different now, though:

Launching Web UI with arguments: --api --xformers --update-all-extensions --update-check
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
*** Error loading script: inpaint_anything.py
    Traceback (most recent call last):
      File "D:\Programme\Python310\lib\site-packages\transformers\utils\import_utils.py", line 1086, in _get_module
        return importlib.import_module("." + module_name, self.__name__)
      File "D:\Programme\Python310\lib\importlib\__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "D:\Programme\Python310\lib\site-packages\transformers\models\clip\image_processing_clip.py", line 22, in <module>
        from ...image_transforms import (
      File "D:\Programme\Python310\lib\site-packages\transformers\image_transforms.py", line 48, in <module>
        import tensorflow as tf
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\__init__.py", line 38, in <module>
        from tensorflow.python.tools import module_util as _module_util
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\__init__.py", line 42, in <module>
        from tensorflow.python.saved_model import saved_model
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\saved_model\saved_model.py", line 23, in <module>
        from tensorflow.python.saved_model import main_op
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\saved_model\main_op.py", line 22, in <module>
        from tensorflow.python.saved_model.main_op_impl import main_op
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\saved_model\main_op_impl.py", line 19, in <module>
        from tensorflow.python.ops import lookup_ops
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\ops\lookup_ops.py", line 43, in <module>
        from tensorflow.python.trackable import resource
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\trackable\resource.py", line 22, in <module>
        from tensorflow.python.eager import def_function
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\eager\def_function.py", line 24, in <module>
        from tensorflow.python.eager.polymorphic_function.polymorphic_function import Function
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\eager\polymorphic_function\polymorphic_function.py", line 81, in <module>
        from tensorflow.python.eager.polymorphic_function import autograph_util
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\eager\polymorphic_function\autograph_util.py", line 18, in <module>
        from tensorflow.python.autograph.core import converter
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\autograph\core\converter.py", line 68, in <module>
        from tensorflow.python.autograph.pyct import transformer
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\autograph\pyct\transformer.py", line 24, in <module>
        from tensorflow.python.autograph.pyct import pretty_printer
      File "C:\Users\DT\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\autograph\pyct\pretty_printer.py", line 18, in <module>
        import termcolor
    ModuleNotFoundError: No module named 'termcolor'

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "D:\Programme\Python310\lib\site-packages\diffusers\utils\import_utils.py", line 808, in _get_module
        return importlib.import_module("." + module_name, self.__name__)
      File "D:\Programme\Python310\lib\importlib\__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "D:\Programme\Python310\lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffusion_inpaint.py", line 22, in <module>
        from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, CLIPVisionModelWithProjection
      File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
      File "D:\Programme\Python310\lib\site-packages\transformers\utils\import_utils.py", line 1077, in __getattr__
        value = getattr(module, name)
      File "D:\Programme\Python310\lib\site-packages\transformers\utils\import_utils.py", line 1076, in __getattr__
        module = self._get_module(self._class_to_module[name])
      File "D:\Programme\Python310\lib\site-packages\transformers\utils\import_utils.py", line 1088, in _get_module
        raise RuntimeError(
    RuntimeError: Failed to import transformers.models.clip.image_processing_clip because of the following error (look up to see its traceback):
    No module named 'termcolor'

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "D:\Programme\Git\stable-diffusion-webui\modules\scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "D:\Programme\Git\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "D:\Programme\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\scripts\inpaint_anything.py", line 20, in <module>
        from diffusers import (DDIMScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler,
      File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
      File "D:\Programme\Python310\lib\site-packages\diffusers\utils\import_utils.py", line 799, in __getattr__
        value = getattr(module, name)
      File "D:\Programme\Python310\lib\site-packages\diffusers\utils\import_utils.py", line 799, in __getattr__
        value = getattr(module, name)
      File "D:\Programme\Python310\lib\site-packages\diffusers\utils\import_utils.py", line 798, in __getattr__
        module = self._get_module(self._class_to_module[name])
      File "D:\Programme\Python310\lib\site-packages\diffusers\utils\import_utils.py", line 810, in _get_module
        raise RuntimeError(
    RuntimeError: Failed to import diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_inpaint because of the following error (look up to see its traceback):
    Failed to import transformers.models.clip.image_processing_clip because of the following error (look up to see its traceback):
    No module named 'termcolor'

---

@rtaskf
Copy link
Author

rtaskf commented Aug 4, 2024

After fixing the python version mess, I deleted and re-installed both Inpaint Anything and Segment Anything. The error I am getting now is the initial one again, not the missing "termcolor" module anymore. Everything else, A1111 and all other other extensions, are working. I'm officially out of ideas now and would appreciate some help.

Launching Web UI with arguments: --api --xformers --update-all-extensions --update-check
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
ControlNet preprocessor location: D:\Programme\Git\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads
2024-08-04 14:22:13,727 - ControlNet - INFO - ControlNet v1.1.455
*** Error loading script: inpaint_anything.py
    Traceback (most recent call last):
      File "D:\Programme\Git\stable-diffusion-webui\modules\scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "D:\Programme\Git\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "D:\Programme\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\scripts\inpaint_anything.py", line 32, in <module>
        import inpalib
      File "D:\Programme\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\inpalib\__init__.py", line 2, in <module>
        from .samlib import (create_seg_color_image, generate_sam_masks, get_all_sam_ids,
      File "D:\Programme\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\inpalib\samlib.py", line 19, in <module>
        from ia_sam_manager import check_bfloat16_support, get_sam_mask_generator  # noqa: E402
      File "D:\Programme\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\ia_sam_manager.py", line 16, in <module>
        from sam2.automatic_mask_generator import SAM2AutomaticMaskGenerator
      File "D:\Programme\Git\stable-diffusion-webui\extensions\sd-webui-inpaint-anything\sam2\__init__.py", line 17, in <module>
        initialize_config_dir(configs_path, version_base="1.2")
    TypeError: initialize_config_dir.__init__() got an unexpected keyword argument 'version_base'

---

@Uminosachi
Copy link
Owner

I have added code to catch the TypeError during SAM 2 initialization. Please update the extension and try again.

@rtaskf
Copy link
Author

rtaskf commented Aug 7, 2024

It's finally working again. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants