Repository navigation
Description
Describe the bug
Hi, friends, I meet a problem I hope to get your help.
When I run the code as follow:
`from diffusers import StableDiffusionPipeline
import torch
pipe = StableDiffusionPipeline.from_pretrained("PATH_OF_MODEL/stable-diffusion",device_map="auto",torch_type=torch.float16, revision="fp16")
`
I save the model in the path "PATH_OF_MODEL/stable-diffusion" from the https://huggingface.co/CompVis/stable-diffusion-v1-4/tree/main
Then, I get the error as follow:
Traceback (most recent call last):
File "", line 1, in
File "/home/klyuhang9/miniconda3/envs/ldm/lib/python3.8/site-packages/diffusers/pipeline_utils.py", line 517, in from_pretrained
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "/home/klyuhang9/miniconda3/envs/ldm/lib/python3.8/site-packages/transformers/modeling_utils.py", line 2024, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
TypeError: init() got an unexpected keyword argument 'device_map'
My environment: python=3.8.5, diffusers=0.5.1 torch=1.11.0, transformers = 4.19.2, ftfy=6.1.1,accelerate=0.13.1 which run on ubuntu=22.04.
I don't know why, I sincerely to get your team help.Thanks,bro!
Reproduction
`from diffusers import StableDiffusionPipeline
import torch
pipe = StableDiffusionPipeline.from_pretrained("PATH_OF_MODEL/stable-diffusion",device_map="auto",torch_type=torch.float16, revision="fp16")
`
Logs
'Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/klyuhang9/miniconda3/envs/ldm/lib/python3.8/site-packages/diffusers/pipeline_utils.py", line 517, in from_pretrained
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "/home/klyuhang9/miniconda3/envs/ldm/lib/python3.8/site-packages/transformers/modeling_utils.py", line 2024, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
TypeError: __init__() got an unexpected keyword argument 'device_map''System Info
My environment: python=3.8.5, diffusers=0.5.1 torch=1.11.0, transformers = 4.19.2, ftfy=6.1.1,accelerate=0.13.1 which run on ubuntu=22.04.
Package Version
accelerate 0.13.1
brotlipy 0.7.0
certifi 2022.9.24
cffi 1.15.1
charset-normalizer 2.0.4
cryptography 37.0.1
diffusers 0.5.1
filelock 3.8.0
ftfy 6.1.1
huggingface-hub 0.10.1
idna 3.3
importlib-metadata 5.0.0
mkl-fft 1.3.1
mkl-random 1.2.2
mkl-service 2.4.0
numpy 1.19.2
opencv-python 4.6.0.66
packaging 21.3
Pillow 9.2.0
pip 20.3.3
psutil 5.9.2
pycparser 2.21
pyOpenSSL 22.0.0
pyparsing 3.0.9
PySocks 1.7.1
PyYAML 6.0
regex 2022.9.13
requests 2.28.1
setuptools 63.4.1
six 1.16.0
tokenizers 0.12.1
torch 1.11.0
torchvision 0.12.0
tqdm 4.64.1
transformers 4.19.2
typing-extensions 4.3.0
urllib3 1.26.11
wcwidth 0.2.5
wheel 0.37.1
zipp 3.9.0
Activity
dkackman commentedon Oct 16, 2022
started happening spontaneously for me this morning. (diffusers 0.5.1)
anfeirr commentedon Oct 16, 2022
yes, I've got the same bug
patrickvonplaten commentedon Oct 16, 2022
Hey,
Could you try updating your
transformersversion to at least4.20?Big model inference was introduced in version
4.20.0in Transformers see here: https://github.com/huggingface/transformers/releases/tag/v4.20.0If you run:
I think it should work