Trying to train a model using automatic1111. Error - Exception training model: 'module 'transformers.integrations' has no attribute 'deepspeed''.
Author: ptsamb
Pull request: no
Labels: name: bug

### System Info

Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.

- `transformers` version: 4.46.0
- Platform: Windows-10-10.0.22631-SP0
- Python version: 3.10.0
- Huggingface_hub version: 0.25.2
- Safetensors version: 0.4.5
- Accelerate version: 1.0.1
- Accelerate config:    not found
- PyTorch version (GPU?): 2.0.1+cu117 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: <fill in>
- Using GPU in script?: <fill in>
- GPU type: NVIDIA GeForce RTX 4090

### Who can help?

Im trying to fine tune a model. Keep getting this error - Exception training model: 'module 'transformers.integrations' has no attribute 'deepspeed''.


### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

downloaded model. installed dependencies. ran automatic1111 web userinterface. Installed dreambooth. trying to run model

### Expected behavior

a fine tuned model

Comments:
I would like to help you with this issue if possible

> I would like to help you with this issue if possible

Hello. What do you recommend?

Same error here...
Tried a million things to install deepspeed but it doesn't change anything...

I have also been encountering the same error when attempting to train using DreamBooth for the past few days. It was working well before, but suddenly this error started occurring, and I haven't been able to find a solution.

I'm having the same issue on an M1 pro....

Same issue. Tried it on  RTX A4000 and  RTX A5000.

I haven't seen this issue reported outside of `automatic1111` - maybe open an issue with them? It's possible that changes in `transformers` moved something or broke compatibility, in which case the fix will need to be at their end.

Encountered the same problem, but I am using an M3 MAC. I have tested the installation but still cannot solve it.

OK, here is what I have been able to figure out. Deepspeed and FastAPI seem to have a conflict for versions of pydantic. I think this is the source of the problem, but when  I upgrade FastAPI and pydantic - the whole Automatic 1111 interface then just keeps restarting... I think I'm onto the source of the issue.. just haven't solved it yet.



I have it working. I did a whole bunch of things, not sure if all steps needed.

In the Python virtual environment, I upgraded fastapi to latest version. Which is 0.94.0. Not sure I needed to do this. But it changed pydantic to 1.10.17. Automatic1111 likes pydantic 1.10.17
`pip install fastapi --upgrade`

Then I installed deepspeed 0.14.5. This version uses same version 1 of pydantic. 
`pip install deepspeed==0.14.5`

Then I edited the file training_utils.py which was in my Python virtual enviroment at  /lib/python3.10/site-packages/diffusers/ and renamed all instances of transformers.integrations.deepspeed and changed it to transformers.deepspeed  
There was three instances, line 27, line 451 and line 473.

After that I have dreambooth extension working in automatic1111.




That worked for me, thanks


Thank you @dvc50 It did work for me.

> I have it working. I did a whole bunch of things, not sure if all steps needed.
> 
> In the Python virtual environment, I upgraded fastapi to latest version. Which is 0.94.0. Not sure I needed to do this. But it changed pydantic to 1.10.17. Automatic1111 likes pydantic 1.10.17 `pip install fastapi --upgrade`
> 
> Then I installed deepspeed 0.14.5. This version uses same version 1 of pydantic. `pip install deepspeed==0.14.5`
> 
> Then I edited the file training_utils.py which was in my Python virtual enviroment at /lib/python3.10/site-packages/diffusers/ and renamed all instances of transformers.integrations.deepspeed and changed it to transformers.deepspeed There was three instances, line 27, line 451 and line 473.
> 
> After that I have dreambooth extension working in automatic1111.



no luck here still the same problem

Hey I tried @dvc50 help but to no avail. Is there any chance anyone knows another fix, I've been looking at my screen and command prompt for about 11.5 hours today just trying to set this up so I can utilize DreamBooth. I am confident that deepspeed is also installed and bytorch and all other jargon features that it needs. I even tried installing this with Git Bash aside from command prompt and it made no difference. Still really need help here, if anyone can offer some it would mean a lot.

same error here i did fix the transformers.deepspeed and update everything stil not able to train a model. i even did reinstall stable diffusion, python and cuda. but still the same error. please someone what can i do?

SOLVED! This was an issue with various dependencies that didn't work together. Try this:

apt-get install libaio-dev
pip install discord_webhook deepspeed==0.13.5 diffusers==0.30.1 transformers==4.26.1 pydantic==1.10.12


> SOLVED! This was an issue with various dependencies that didn't work together. Try this:
> 
> apt-get install libaio-dev pip install discord_webhook deepspeed==0.13.5 diffusers==0.30.1 transformers==4.26.1 pydantic==1.10.12

Hey, I don't have the command apt-get, am I missing something for that too, (I am on Windows if it matters).

> Hey, I don't have the command apt-get, am I missing something for that too, (I am on Windows if it matters).

apt is a Linux command. 

My instructions above were for Ubuntu 24 or Linux Mint 22. I expect getting it to run in Windows is a miserable experience.


@Edanaichel try it withou the apt-get command. Just go for the pip install command:

pip install discord_webhook deepspeed==0.13.5 diffusers==0.30.1 transformers==4.26.1 pydantic==1.10.12



No luck here....I tried installing the pip, but I get this:  

ET@The-E-Machine MINGW64 ~
$ pip install discord_webhook deepspeed==0.13.5 diffusers==0.30.1 transformers==4.26.1 pydantic==1.10.12
Collecting discord_webhook
  Using cached discord_webhook-1.3.1-py3-none-any.whl.metadata (13 kB)
Collecting deepspeed==0.13.5
  Using cached deepspeed-0.13.5.tar.gz (1.3 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\ET\AppData\Local\Temp\pip-install-0whebpwn\deepspeed_69e7
5a467d59462b831836609f94f695\setup.py", line 100, in <module>
          cuda_major_ver, cuda_minor_ver = installed_cuda_version()
        File "C:\Users\ET\AppData\Local\Temp\pip-install-0whebpwn\deepspeed_69e7
5a467d59462b831836609f94f695\op_builder\builder.py", line 50, in installed_cuda_
version
          raise MissingCUDAException("CUDA_HOME does not exist, unable to compil
e CUDA op(s)")
      op_builder.builder.MissingCUDAException: CUDA_HOME does not exist, unable
to compile CUDA op(s)
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem wit
h pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.


@MisterPapagiorgio same. So tired of devs pushing unusable staff

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.