songweige / sd-webui-rich-text

117 stars 2 forks source link

ImportError: cannot import name 'maybe_allow_in_graph' from 'diffusers.utils' #10

Closed Acephalia closed 9 months ago

Acephalia commented 9 months ago

Firstly thank you for this fantastic extension. I seem to be getting an error and a few people on reddit seems to have got the same. Any ideas what could be up? Many thanks.

*** Error loading script: rich_text_on_tab.py
    Traceback (most recent call last):
      File "S:\stable-diffusion-webui\modules\scripts.py", line 382, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "S:\stable-diffusion-webui\modules\script_loading.py", line 10, 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 "S:\stable-diffusion-webui\extensions\sd-webui-rich-text\scripts\rich_text_on_tab.py", line 17, in <module>
        from scripts.models.region_diffusion import RegionDiffusion
      File "S:\stable-diffusion-webui\extensions\sd-webui-rich-text\scripts\models\region_diffusion.py", line 8, in <module>
        from scripts.models.unet_2d_condition import UNet2DConditionModel
      File "S:\stable-diffusion-webui\extensions\sd-webui-rich-text\scripts\models\unet_2d_condition.py", line 39, in <module>
        from scripts.models.attention_processor import AttentionProcessor, AttnProcessor
      File "S:\stable-diffusion-webui\extensions\sd-webui-rich-text\scripts\models\attention_processor.py", line 20, in <module>
        from diffusers.utils import deprecate, logging, maybe_allow_in_graph
    ImportError: cannot import name 'maybe_allow_in_graph' from 'diffusers.utils' (S:\stable-diffusion-webui\venv\lib\site-packages\diffusers\utils\__init__.py)

Ps I've had a look through my venv diffusers module files. Can't seem to find 'maybe_allow_in_graph' referenced anywhere. I'm assuming that is the issue?

rustylez commented 9 months ago

I get the same error :/

songweige commented 9 months ago

I think the issues occur as there are many files missing in the diffusers when installed in the Windows OS. It's a bit mysterious to me why it happens. It seems that adding individual missing functions is not a good idea, as there are too many of them.

songweige commented 9 months ago

I made a fix by incorporating the diffusers lib as part of the extension. Let me know if that resolves the issue!

rustylez commented 9 months ago

I made a fix by incorporating the diffusers lib as part of the extension. Let me know if that resolves the issue!

it's solved for me! thank you.

songweige commented 9 months ago

Awesome!

Acephalia commented 9 months ago

Yep that worked. Thank you!

songweige commented 9 months ago

Great, closing this issue for now.