stablediffusion
stablediffusion copied to clipboard
__init__() got an unexpected keyword argument 'use_linear_in_transformer'
I have installed stable-diffusion v2 and run following commands in the provided ldm environment: python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt .\v2-1_768-ema-pruned.ckpt --config .\configs\stable-diffusion\v2-inference.yaml
But I keep getting an error:
(ldm) PS C:\Programming\Python\stablediffusion> python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt .\v2-1_768-ema-pruned.ckpt --config .\configs\stable-diffusion\v2-inference.yaml
Global seed set to 42
Loading model from .\v2-1_768-ema-pruned.ckpt
Global Step: 110000
LatentDiffusion: Running in eps-prediction mode
Traceback (most recent call last):
File "scripts/txt2img.py", line 289, in <module>
main(opt)
File "scripts/txt2img.py", line 190, in main
model = load_model_from_config(config, f"{opt.ckpt}")
File "scripts/txt2img.py", line 34, in load_model_from_config
model = instantiate_from_config(config.model)
File "c:\programming\python\stable-diffusion\ldm\util.py", line 85, in instantiate_from_config
return get_obj_from_str(config["target"])(**config.get("params", dict()))
File "c:\programming\python\stable-diffusion\ldm\models\diffusion\ddpm.py", line 448, in __init__
super().__init__(conditioning_key=conditioning_key, *args, **kwargs)
File "c:\programming\python\stable-diffusion\ldm\models\diffusion\ddpm.py", line 86, in __init__
self.model = DiffusionWrapper(unet_config, conditioning_key)
File "c:\programming\python\stable-diffusion\ldm\models\diffusion\ddpm.py", line 1398, in __init__
self.diffusion_model = instantiate_from_config(diff_model_config)
File "c:\programming\python\stable-diffusion\ldm\util.py", line 85, in instantiate_from_config
return get_obj_from_str(config["target"])(**config.get("params", dict()))
TypeError: __init__() got an unexpected keyword argument 'use_linear_in_transformer'
Also tried not providing a config. Didn't help.
How to solve it?
+1 - I have the same issue
This issue should because you have an old version of stable diffusion in your path.
No, I checked, I have the latest pull, or do you mean the model?
I have installed stable-diffusion v2 and run following commands in the provided ldm environment: python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt .\v2-1_768-ema-pruned.ckpt --config .\configs\stable-diffusion\v2-inference.yaml
But I keep getting an error:
(ldm) PS C:\Programming\Python\stablediffusion> python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt .\v2-1_768-ema-pruned.ckpt --config .\configs\stable-diffusion\v2-inference.yaml Global seed set to 42 Loading model from .\v2-1_768-ema-pruned.ckpt Global Step: 110000 LatentDiffusion: Running in eps-prediction mode Traceback (most recent call last): File "scripts/txt2img.py", line 289, in <module> main(opt) File "scripts/txt2img.py", line 190, in main model = load_model_from_config(config, f"{opt.ckpt}") File "scripts/txt2img.py", line 34, in load_model_from_config model = instantiate_from_config(config.model) File "c:\programming\python\stable-diffusion\ldm\util.py", line 85, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) File "c:\programming\python\stable-diffusion\ldm\models\diffusion\ddpm.py", line 448, in __init__ super().__init__(conditioning_key=conditioning_key, *args, **kwargs) File "c:\programming\python\stable-diffusion\ldm\models\diffusion\ddpm.py", line 86, in __init__ self.model = DiffusionWrapper(unet_config, conditioning_key) File "c:\programming\python\stable-diffusion\ldm\models\diffusion\ddpm.py", line 1398, in __init__ self.diffusion_model = instantiate_from_config(diff_model_config) File "c:\programming\python\stable-diffusion\ldm\util.py", line 85, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) TypeError: __init__() got an unexpected keyword argument 'use_linear_in_transformer'
Also tried not providing a config. Didn't help.
How to solve it?
Have you solved it?
No, I haven't
Same issue
But I just remove that line in v2-inference.yaml and it works
use_linear_in_transformer: True
I fixed it by reinstalling miniconda.
I have installed stable-diffusion v2 and run following commands in the provided ldm environment: python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt .\v2-1_768-ema-pruned.ckpt --config .\configs\stable-diffusion\v2-inference.yaml
But I keep getting an error:
(ldm) PS C:\Programming\Python\stablediffusion> python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt .\v2-1_768-ema-pruned.ckpt --config .\configs\stable-diffusion\v2-inference.yaml Global seed set to 42 Loading model from .\v2-1_768-ema-pruned.ckpt Global Step: 110000 LatentDiffusion: Running in eps-prediction mode Traceback (most recent call last): File "scripts/txt2img.py", line 289, in <module> main(opt) File "scripts/txt2img.py", line 190, in main model = load_model_from_config(config, f"{opt.ckpt}") File "scripts/txt2img.py", line 34, in load_model_from_config model = instantiate_from_config(config.model) File "c:\programming\python\stable-diffusion\ldm\util.py", line 85, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) File "c:\programming\python\stable-diffusion\ldm\models\diffusion\ddpm.py", line 448, in __init__ super().__init__(conditioning_key=conditioning_key, *args, **kwargs) File "c:\programming\python\stable-diffusion\ldm\models\diffusion\ddpm.py", line 86, in __init__ self.model = DiffusionWrapper(unet_config, conditioning_key) File "c:\programming\python\stable-diffusion\ldm\models\diffusion\ddpm.py", line 1398, in __init__ self.diffusion_model = instantiate_from_config(diff_model_config) File "c:\programming\python\stable-diffusion\ldm\util.py", line 85, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) TypeError: __init__() got an unexpected keyword argument 'use_linear_in_transformer'
Also tried not providing a config. Didn't help.
How to solve it?
Hi, I think reinstall miniconda is not the key to solve this problem. Please note that your path includes "stable-diffusion", indicating that you have not only downloaded this repo, but also downloaded v1. Additionally, you should have also installed v1 (possibly by running pip install -e .
, though I'm not entirely sure). Therefore, the code is executing stable-diffusion instead of stablediffusion. There is no corresponding implementation in stable-diffusion, leading to this error.