huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
135.38k stars 27.09k forks source link

Trying to train a model using automatic1111. Error - Exception training model: 'module 'transformers.integrations' has no attribute 'deepspeed''. #34427

Open ptsamb opened 4 weeks ago

ptsamb commented 4 weeks ago

System Info

Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.

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

Tasks

Reproduction

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

Expected behavior

a fine tuned model

thakurboy004 commented 4 weeks ago

I would like to help you with this issue if possible

ptsamb commented 4 weeks ago

I would like to help you with this issue if possible

Hello. What do you recommend?

thistledub commented 4 weeks ago

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

mozily commented 3 weeks ago

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.

cinealfa commented 3 weeks ago

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

NafeesToast commented 3 weeks ago

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

Rocketknight1 commented 3 weeks ago

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.

Wilson-Chin commented 3 weeks ago

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

NafeesToast commented 3 weeks ago

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.

dvc50 commented 2 weeks ago

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.

mumarfata commented 2 weeks ago

That worked for me, thanks

anand-kamble commented 2 weeks ago

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.

cinealfa commented 2 weeks ago

no luck here still the same problem

Edanaichel commented 1 week ago

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.

bigangrybobby commented 1 week ago

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?

NafeesToast commented 1 week ago

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

Edanaichel commented 6 days ago

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).

dvc50 commented 6 days ago

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.

NafeesToast commented 5 days ago

@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