stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: requires transformers >= 4.25.1 to function correctly, but 4.21.0 was found in your environment

Open zahdab opened this issue 3 years ago • 10 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

I can no longer get scripts/dreambooth to run i get the below error un launch



Launching Web UI with arguments:
Error loading script: api.py
Traceback (most recent call last):
  File "C:\stable-diffusion-webui\modules\scripts.py", line 184, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "C:\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
    exec(compiled, module.__dict__)
  File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\api.py", line 9, in <module>
    from extensions.sd_dreambooth_extension.dreambooth import dreambooth
  File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 9, in <module>
    from diffusers.utils import logging as dl
  File "C:\stable-diffusion-webui\venv\lib\site-packages\diffusers\__init__.py", line 26, in <module>
    raise ImportError(
ImportError: `diffusers` requires transformers >= 4.25.1 to function correctly, but 4.21.0 was found in your environment. You can upgrade it with pip: `pip install transformers --upgrade`

Error loading script: main.py Traceback (most recent call last): File "C:\stable-diffusion-webui\modules\scripts.py", line 184, in load_scripts module = script_loading.load_module(scriptfile.path) File "C:\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module exec(compiled, module.dict) File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\main.py", line 3, in from extensions.sd_dreambooth_extension.dreambooth import dreambooth File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 13, in from extensions.sd_dreambooth_extension.dreambooth.utils import reload_system_models, unload_system_models, printm,
File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\utils.py", line 12, in from diffusers import StableDiffusionPipeline, EulerAncestralDiscreteScheduler File "C:\stable-diffusion-webui\venv\lib\site-packages\diffusers_init_.py", line 26, in raise ImportError( ImportError: diffusers requires transformers >= 4.25.1 to function correctly, but 4.21.0 was found in your environment. You can upgrade it with pip: pip install transformers --upgrade


when i run the pip install transformers --upgrade command i get 

Requirement already satisfied: transformers in c:\users\zahda\appdata\local\programs\python\python310\lib\site-packages (4.26.0.dev0)

### Steps to reproduce the problem

1. Go to .... happened after i added the 2.1 models 
2. Press ....
3. ...


### What should have happened?

scripts should load correctly 

### Commit where the problem happens

Commit hash: 44c46f0ed395967cd3830dd481a2db759fda5b3b

### What platforms do you use to access UI ?

_No response_

### What browsers do you use to access the UI ?

_No response_

### Command Line Arguments

_No response_

### Additional information, context and logs

_No response_

zahdab avatar Dec 08 '22 20:12 zahdab

Did you activate the venv before upgrading transformer?

Anyway this is a Dreambooth extension problem and should be reported there https://github.com/d8ahazard/sd_dreambooth_extension

wywywywy avatar Dec 08 '22 20:12 wywywywy

I have the same issue

vis223 avatar Dec 08 '22 20:12 vis223

which env needs activating?

vis223 avatar Dec 08 '22 20:12 vis223

I have the same issue, i activated the venv, upgraded the transformer, confirmed it was 4.25.1, then when I run the webui-user.bat it reinstalls the transformer as 4.21.0 and pops this error.

If there is a script that sets the transformer version editing that might be the fix?

matt-fichtner avatar Dec 08 '22 20:12 matt-fichtner

I am facing the same or similar issue after trying to switch back to the 1.4 model from the v2-1_512-ema-pruned model. Then restarting the application I first get the following message from Dreambooth with an exclamation mark for the diffusers(torch)

################################################################################################ Initializing Dreambooth If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Dreambooth revision: 88cc50ace470580842b519115545b9a08ebe115e SD-WebUI revision: 44c46f0ed395967cd3830dd481a2db759fda5b3b

[+] bitsandbytes version 0.35.0 installed. [!] diffusers[torch] version 0.10.0 installed. [+] transformers version 4.21.0 installed. [ ] xformers version 0.0.14.dev0 installed. [ ] torch version 1.12.1+cu116 installed. [ ] torchvision version 0.13.1+cu116 installed. ################################################################################################

Then the above errors: ImportError: diffusers requires transformers >= 4.25.1 to function correctly, but 4.21.0 was found in your environment. You can upgrade it with pip: pip install transformers --upgrade

Error loading script: main.py Traceback (most recent call last): File "C:\stable-diffusion-webui\modules\scripts.py", line 184, in load_scripts module = script_loading.load_module(scriptfile.path) File "C:\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module exec(compiled, module.dict) File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\main.py", line 3, in from extensions.sd_dreambooth_extension.dreambooth import dreambooth File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 13, in from extensions.sd_dreambooth_extension.dreambooth.utils import reload_system_models, unload_system_models, printm,
File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\utils.py", line 12, in from diffusers import StableDiffusionPipeline, EulerAncestralDiscreteScheduler File "C:\stable-diffusion-webui\venv\lib\site-packages\diffusers_init_.py", line 26, in raise ImportError( ImportError: diffusers requires transformers >= 4.25.1 to function correctly, but 4.21.0 was found in your environment. You can upgrade it with pip: pip install transformers --upgrade

and after that the following:

╭─────────────────────────────── Traceback (most recent call last) ──────────────────────────╮ │ C:\stable-diffusion-webui\launch.py:295 in

│ 292
│ 293 if name == "main":
│ 294 │ prepare_enviroment()

│ 296

│ C:\stable-diffusion-webui\launch.py:290 in start

│ 287 │ if '--nowebui' in sys.argv:
│ 288 │ │ webui.api_only()
│ 289 │ else:
│ ❱ 290 │ │ webui.webui()
│ 291
│ 292
│ 293 if name == "main":

│ C:\stable-diffusion-webui\webui.py:132 in webui

│ 129
│ 130 def webui():
│ 131 │ launch_api = cmd_opts.api
│ ❱ 132 │ initialize()
│ 133 │
│ 134 │ while 1:
│ 135 │ │ if shared.opts.clean_temp_dir_at_start:

│ C:\stable-diffusion-webui\webui.py:62 in initialize

│ 59 │ modelloader.load_upscalers()
│ 60 │
│ 61 │ modules.sd_vae.refresh_vae_list()
│ ❱ 62 │ modules.sd_models.load_model()
│ 63 │ shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: modules.sd_mode
│ 64 │ shared.opts.onchange("sd_vae", wrap_queued_call(lambda: modules.sd_vae.reload_vae_we
│ 65 │ shared.opts.onchange("sd_vae_as_default", wrap_queued_call(lambda: modules.sd_vae.re

│ C:\stable-diffusion-webui\modules\sd_models.py:232 in load_model

│ 229
│ 230 def load_model(checkpoint_info=None):
│ 231 │ from modules import lowvram, sd_hijack
│ ❱ 232 │ checkpoint_info = checkpoint_info or select_checkpoint()
│ 233 │
│ 234 │ if checkpoint_info.config != shared.cmd_opts.config:
│ 235 │ │ print(f"Loading config from: {checkpoint_info.config}")

│ C:\stable-diffusion-webui\modules\sd_models.py:110 in select_checkpoint

│ 107
│ 108 def select_checkpoint():
│ 109 │ model_checkpoint = shared.opts.sd_model_checkpoint
│ ❱ 110 │ checkpoint_info = checkpoints_list.get(model_checkpoint, None)
│ 111 │ if checkpoint_info is not None:
│ 112 │ │ return checkpoint_info
│ 113
╰─────────────────────────────────────────────────────────────────────────╯ TypeError: unhashable type: 'list'

and the console shuts down.

I tried to install transformers 4.25.1 but I didn't activate the venv, anyway after restarting the same errors were displayed as the version 4.21.0 seemed to have been reinstated, a above described by @matt-fichtner . Probably this should be reported to Dreambooth developers. In the meantime, I will recover a previous backup of the entire Web UI folder from yesterday, when it was working.

Harvester62 avatar Dec 08 '22 20:12 Harvester62

Can you try and edit the extensions\sd_dreambooth_extension\requirements.txt file and see if it works.

Alternatively... if you are in a rush or desperate, simply delete the Dreambooth extension for now until the problem is resolved upstream.

wywywywy avatar Dec 08 '22 21:12 wywywywy

changing requirements.txt didn't do it unfortunately will report it on the dreambooth repo

zahdab avatar Dec 08 '22 21:12 zahdab

i see it's already reported there thanks again https://github.com/d8ahazard/sd_dreambooth_extension/issues/454

zahdab avatar Dec 08 '22 21:12 zahdab

You should close this and report in dreambooth repo. This repo is too flooded with irrelevant issues already

aliencaocao avatar Dec 09 '22 06:12 aliencaocao

Made this PR https://github.com/d8ahazard/sd_dreambooth_extension/pull/464 which resolves the issue, please test and upvote it if it works for you ✨

ansonkao avatar Dec 09 '22 10:12 ansonkao