# I need help with a transformers error

**URL:** <https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485>\
**Category:** 🤗Transformers\
**Created:** [December 8, 2022, 8:04pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485 "2022-12-08T20:04:25Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheLorax3](https://avatars.discourse-cdn.com/v4/letter/t/2acd7d/32.png) [@TheLorax3](https://discuss.huggingface.co/u/TheLorax3)\
**Post date:** [December 8, 2022, 8:04pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/1 "2022-12-08T20:04:25Z")

</div>

Im trying to use the stable-diffusion webui with the dreambooth extension on my windows pc, but I keep getting this error

`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'`

but when I use the `pip install transformers --upgrade` command, it says I already have version 4.25.1

---

<div class="post-metadata">

**Author:** ![Abdelhak](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/abdelhak/32/12957_2.png) [@Abdelhak](https://discuss.huggingface.co/u/Abdelhak)\
**Post date:** [December 8, 2022, 9:16pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/2 "2022-12-08T21:16:49Z")

</div>

Same issue here. It seems it’s a bug or something.

---

<div class="post-metadata">

**Author:** ![iiiIIIiiiIIIIIIIiIi](https://avatars.discourse-cdn.com/v4/letter/i/c77e96/32.png) [@iiiIIIiiiIIIIIIIiIi](https://discuss.huggingface.co/u/iiiIIIiiiIIIIIIIiIi)\
**Post date:** [December 8, 2022, 9:17pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/3 "2022-12-08T21:17:20Z")

</div>

I have the same issue

---

<div class="post-metadata">

**Author:** ![heyarny](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/heyarny/32/20012_2.png) [@heyarny](https://discuss.huggingface.co/u/heyarny)\
**Post date:** [December 8, 2022, 10:09pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/4 "2022-12-08T22:09:10Z")

</div>

same here! Anyone found a solution? I’m on OSX M1

---

<div class="post-metadata">

**Author:** ![turkeymanterry](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@turkeymanterry](https://discuss.huggingface.co/u/turkeymanterry)\
**Post date:** [December 8, 2022, 10:37pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/5 "2022-12-08T22:37:49Z")

</div>

I started having the same issue out of nowhere today as well. I have no clue what I’m doing though so I’m glad I’m not the only one experiencing this. Also my dreambooth extension no longer shows up as a result…is that everyone else’s issue also?

---

<div class="post-metadata">

**Author:** ![NikoNoah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nikonoah/32/12961_2.png) [@NikoNoah](https://discuss.huggingface.co/u/NikoNoah)\
**Post date:** [December 8, 2022, 11:05pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/6 "2022-12-08T23:05:57Z")

</div>

Yeah, having the same. I tried to update the requirements.txt to reflect the higher version but it did not trigger an update when executing the bat…

---

<div class="post-metadata">

**Author:** ![Novatron](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@Novatron](https://discuss.huggingface.co/u/Novatron)\
**Post date:** [December 8, 2022, 11:38pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/7 "2022-12-08T23:38:31Z")

</div>

what version of diffusers is installed? I had to downgrade to 0.9.0 to get my system working today.

---

<div class="post-metadata">

**Author:** ![spider853](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@spider853](https://discuss.huggingface.co/u/spider853)\
**Post date:** [December 9, 2022, 12:12am UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/8 "2022-12-09T00:12:30Z")

</div>

Here is the solution, until they’ll come up with some official one, **it is very important to keep tabs consistent and the same!!!** :

1. Open launch.py with text editor  
find this line and the next line:

```auto
xformers = '--xformers' in sys.argv
ngrok = '--ngrok' in sys.argv

```

add this after

```auto
    skipUpdate = '--skip' in sys.argv

```

1. find this line **(skip to point 4 for full code)**

```auto
git_clone(stable_diffusion_repo, repo_dir('stable-diffusion-stability-ai'), "Stable Diffusion", stable_diffusion_commit_hash)

```

add this before it:

```auto
if not skipUpdate:

```

1. find this:

```auto
 if update_check:
            version_check(commit)

```

add after:

```auto
    else:
        print("Skipping updates...")

```

you need to tab everything inside

1. the whole section will look like this (copy and replace this part):

> **Full code after replacement, copy with spaces and tabs!**
>
> ```auto
> if not skipUpdate:
> git_clone(stable_diffusion_repo, repo_dir('stable-diffusion-stability-ai'), "Stable Diffusion", stable_diffusion_commit_hash)
> git_clone(taming_transformers_repo, repo_dir('taming-transformers'), "Taming Transformers", taming_transformers_commit_hash)
> git_clone(k_diffusion_repo, repo_dir('k-diffusion'), "K-diffusion", k_diffusion_commit_hash)
> git_clone(codeformer_repo, repo_dir('CodeFormer'), "CodeFormer", codeformer_commit_hash)
> git_clone(blip_repo, repo_dir('BLIP'), "BLIP", blip_commit_hash)
> 
> if not is_installed("lpips"):
> run_pip(f"install -r {os.path.join(repo_dir('CodeFormer'), 'requirements.txt')}", "requirements for CodeFormer")
>         
> run_pip(f"install -r {requirements_file}", "requirements for Web UI")
>         
> run_extensions_installers(settings_file=args.ui_settings_file)
>         
> if update_check:
> version_check(commit)
> else:
> print("Skipping updates...")
> 
> ```

1. Open this file: modules/shared.py and find this line:

```auto
parser.add_argument("--xformers", action='store_true', help="enable xformers for cross attention layers")

```

add this line bellow

```auto
parser.add_argument("--skip", action='store_true', help="skip updates")

```

1. save everything

2. now open up a cmd window in the stable-diffusion folder and type  
venv\Scripts\activate.bat

3. type this command next:  
pip install transformers --upgrade

4. now lunch webui.bat with argument --skip to skip updates (downgrades) to transformers

It will download some new weights (~2GB), not sure what module is updating, probably dreambooth  
Also --skip will make it start faster, skips downloading/checking for updates

* * *

Edit: Found the updated file  
C:\Users\XXXX.cache\huggingface\hub\models–openai–clip-vit-large-patch14\snapshots\8d052a0f05efbaefbc9e8786ba291cfdf93e5bff\pytorch\_model.bin

Looks like it’s the CLIP model probably updated, not sure

---

<div class="post-metadata">

**Author:** ![NikoNoah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nikonoah/32/12961_2.png) [@NikoNoah](https://discuss.huggingface.co/u/NikoNoah)\
**Post date:** [December 9, 2022, 8:10am UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/9 "2022-12-09T08:10:04Z")

</div>

Thanks for this but I am having an issue and my python skills really suck…

```auto
Traceback (most recent call last):
  File "C:\Users\nbock\Documents\AI\stable-diffusion-webui\launch.py", line 238, in <module>
    if not skipUpdate:
NameError: name 'skipUpdate' is not defined

```

But I have added “skipUpdate = ‘–skip’ in sys.argv” in line 197 under ngrok…  
I’d say that variable is defined 😃 but python disagrees :))

Any idea?

---

<div class="post-metadata">

**Author:** ![artbazil](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@artbazil](https://discuss.huggingface.co/u/artbazil)\
**Post date:** [December 9, 2022, 10:29am UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/10 "2022-12-09T10:29:15Z")

</div>

Spider853, that didn’t help ☹

```auto
venv "C:\Projects\Stable Diffusion\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: 44c46f0ed395967cd3830dd481a2db759fda5b3b
Skipping updates...
Launching Web UI with arguments: --xformers --force-enable-xformers --skip
Error loading script: api.py
Traceback (most recent call last):
  File "C:\Projects\Stable Diffusion\stable-diffusion-webui\modules\scripts.py", line 184, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "C:\Projects\Stable Diffusion\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
    exec(compiled, module. __dict__ )
  File "C:\Projects\Stable Diffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\api.py", line 9, in <module>
    from extensions.sd_dreambooth_extension.dreambooth import dreambooth
  File "C:\Projects\Stable Diffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 9, in <module>
    from diffusers.utils import logging as dl
  File "C:\Projects\Stable Diffusion\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:\Projects\Stable Diffusion\stable-diffusion-webui\modules\scripts.py", line 184, in load_scripts
    module = script_loading.load_module(scriptfile.path)
  File "C:\Projects\Stable Diffusion\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
    exec(compiled, module. __dict__ )
  File "C:\Projects\Stable Diffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\main.py", line 3, in <module>
    from extensions.sd_dreambooth_extension.dreambooth import dreambooth
  File "C:\Projects\Stable Diffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 13, in <module>
    from extensions.sd_dreambooth_extension.dreambooth.utils import reload_system_models, unload_system_models, printm, \
  File "C:\Projects\Stable Diffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\utils.py", line 12, in <module>
    from diffusers import StableDiffusionPipeline, EulerAncestralDiscreteScheduler
  File "C:\Projects\Stable Diffusion\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`

LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading weights [06c50424] from C:\Projects\Stable Diffusion\stable-diffusion-webui\model.ckpt
Applying xformers cross attention optimization.
Model loaded.
Loaded a total of 0 textual inversion embeddings.
Embeddings:
Running on local URL: http://127.0.0.1:7861

To create a public link, set `share=True` in `launch()`.

```

Looks like even `venv\Scripts\activate.bat` and `pip install transformers --upgrade` didn’t update transformers. I even tried `pip install transformers==4.25.1` No luck…

It automatically reinstalls it back to previous version during start-up: `Installing requirements for Web UI`

---

<div class="post-metadata">

**Author:** ![patrickvonplaten](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/patrickvonplaten/32/2171_2.png) [@patrickvonplaten](https://discuss.huggingface.co/u/patrickvonplaten)\
**Post date:** [December 9, 2022, 4:32pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/11 "2022-12-09T16:32:43Z")

</div>

Could you please update the "Installing requirements " scripts of Web UI to not force install a version of `transformers`? Does someone have a link to the “automatic” installation file?

---

<div class="post-metadata">

**Author:** ![patrickvonplaten](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/patrickvonplaten/32/2171_2.png) [@patrickvonplaten](https://discuss.huggingface.co/u/patrickvonplaten)\
**Post date:** [December 9, 2022, 4:39pm UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/12 "2022-12-09T16:39:02Z")

</div>

@anton-l is doing a patch release now so that the scripts will work as expected. Should be ready in 1 hour.

In general, though - I don’t think it’s a good idea to force install versions upon launch. The user should IMO have control over the installation of the different versions.

---

<div class="post-metadata">

**Author:** ![spider853](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@spider853](https://discuss.huggingface.co/u/spider853)\
**Post date:** [December 10, 2022, 4:24am UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/13 "2022-12-10T04:24:23Z")

</div>

Here are the files I’ve edited locally [fix.zip - Google Drive](https://drive.google.com/file/d/1EWWWWFwU89b_WQ-tDNc4opIZ5DxsG18Y/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![spider853](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@spider853](https://discuss.huggingface.co/u/spider853)\
**Post date:** [December 10, 2022, 4:25am UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/14 "2022-12-10T04:25:09Z")

</div>

did you actually patched the py files? I’m actually using that locally without any issues, and it starts faster.  
Make sure to launch with skip parameter: webui.bat --skip

---

<div class="post-metadata">

**Author:** ![SpoffNinja](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@SpoffNinja](https://discuss.huggingface.co/u/SpoffNinja)\
**Post date:** [December 12, 2022, 12:34am UTC](https://discuss.huggingface.co/t/i-need-help-with-a-transformers-error/27485/15 "2022-12-12T00:34:55Z")

</div>

If you getting this error on the Stable Diffusion WebUI then it’s because your Dreambooth extension is outdated. You need to run a update on your extensions.

First do a git pull on Stable Diffusion web-gui for good measure.

Then start SD and go to extensions tab and click on Check for Updates button. It will run a check on each extension you have installed. If it’s outdated it will list as “behind” with a ticked tick box.

Now Apply and Restart should restart the web-gui and start the updates but mine didn’t closing the console windows and re-running the bat file to start Stable Diffusion started the update process.
