cantrell / stable-diffusion-api-server

A local API server on top of Stable Diffusion.
Apache License 2.0
356 stars 61 forks source link

unexpected keyword argument when running the server.py #2

Closed aniketgore closed 1 year ago

aniketgore commented 1 year ago

File "server.py", line 108, in manager.add_engine( 'txt2img', EngineStableDiffusion( diffusers.StableDiffusionPipeline, sibling=None ) ) File "server.py", line 62, in init self.engine = pipe.from_pretrained( 'CompVis/stable-diffusion-v1-4', use_auth_token=token.strip() ) File "C:\Users\anike.conda\envs\sd-api-server\lib\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 "C:\Users\anike.conda\envs\sd-api-server\lib\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'

adenek commented 1 year ago

Same here

mrtzpngrtz commented 1 year ago

I solved this by using the ldm environment from https://github.com/CompVis/stable-diffusion + installing Flask.

aniketgore commented 1 year ago

Do you mean you installed above repo and built the environment? Can you provide the steps you followed? Thanks in advance.

mrtzpngrtz commented 1 year ago

I already had the ldm environment installed and used it with this repo, so maybe just use the environment.yaml from CompVis. maybe the diffusers were missing.

aniketgore commented 1 year ago

Correct me if I'm wrong. You moved the server.py to the compvis SD folder and run it there?

mrtzpngrtz commented 1 year ago

no, make a new environment with the compvis yaml, activate the environment (conda activate ldm) and stay in the directory of this repo. at least this worked for me.

aniketgore commented 1 year ago

Didn't work for me even after cloning and using the compvis repo

cantrell commented 1 year ago

I left a step out of the instructions. You also need to agree to share your email address with Hugging Face in order to download the model. Please see the new Hugging Face instructions in the README.

Also, don't forget your token.txt file.

I apologize for leaving out a critical step. I agreed to it ages ago, and I didn't realize that my agreement was associated with my HF token so everything was working for me.

If that doesn't fix it, please reopen.

aniketgore commented 1 year ago

I've already downloaded the model multiple times from the site so I'd selected that option. Do I need to select it somewhere else as well?

robertsehlke commented 1 year ago

Ran into the same issue - getting the latest transformers version fixed it for me:

pip install transformers==4.23.1

(or directly change the pinned version in environment.yaml)