stable-diffusion icon indicating copy to clipboard operation
stable-diffusion copied to clipboard

ModuleNotFoundError: no module named 'samplers'

Open rav-en opened this issue 2 years ago • 6 comments

after having a blast with CompVis stable-diffusion paired with v0.8 of optimisedSD, decided to give the latest version a go. ive grabed the latest version of stable-diffusion from CompVis as well as the latest OptimisedSD version and now im getting this error.

Global seed set to 27 Loading model from models/ldm/stable-diffusion-v1/model.ckpt Global Step: 470000 Traceback (most recent call last): File "optimizedSD/optimized_txt2img.py", line 204, in model = instantiate_from_config(config.modelUNet) File "/home/jason/Documents/stable-diffusion/ldm/util.py", line 85, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) File "/home/jason/Documents/stable-diffusion/ldm/util.py", line 93, in get_obj_from_str return getattr(importlib.import_module(module, package=None), cls) File "/home/jason/anaconda3/envs/ldm/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 783, in exec_module File "", line 219, in _call_with_frames_removed File "/home/jason/Documents/stable-diffusion/optimizedSD/ddpm.py", line 25, in from samplers import CompVisDenoiser, get_ancestral_step, to_d, append_dims,linear_multistep_coeff ModuleNotFoundError: No module named 'samplers'

any help would be great. im sure there is an easy solution to this. but ive had no luck at the moment.

kind regards.

rav-en avatar Sep 15 '22 08:09 rav-en

I just made a duplicate issue a few seconds after yours, I'll go delete mine.

dunaden001 avatar Sep 15 '22 08:09 dunaden001

I just made a duplicate issue a few seconds after yours, I'll go delete mine.

i'll be sure to update this thread if i find the solution. i hope you do the same :)

rav-en avatar Sep 15 '22 08:09 rav-en

I have no idea how any of this works, but this is a quick fix I came up with

  1. pip install git+https://github.com/crowsonkb/k-diffusion.git
  2. inside optimizedSD/ddpm.py I replaced
from samplers import CompVisDenoiser, get_ancestral_step, to_d, append_dims,linear_multistep_coeff

with

from k_diffusion.external import CompVisDenoiser
from k_diffusion.utils import append_dims
from k_diffusion.sampling import get_ancestral_step, to_d, linear_multistep_coeff

ArthurHeitmann avatar Sep 15 '22 09:09 ArthurHeitmann

Getting the same error. Looks like it was recently introduced, so a workaround could be to checkout commit 7ecf962 and run that until the issue is properly patched.

andreasgoodstein avatar Sep 15 '22 09:09 andreasgoodstein

I have no idea how any of this works, but this is a quick fix I came up with

1. `pip install git+https://github.com/crowsonkb/k-diffusion.git`

2. inside optimizedSD/ddpm.py I replaced
from samplers import CompVisDenoiser, get_ancestral_step, to_d, append_dims,linear_multistep_coeff

with

from k_diffusion.external import CompVisDenoiser
from k_diffusion.utils import append_dims
from k_diffusion.sampling import get_ancestral_step, to_d, linear_multistep_coeff

cheers mate, this worked for me.

rav-en avatar Sep 15 '22 10:09 rav-en

Hi, thank you all for reporting the bug and the workaround; I have fixed the issue now. Thanks!

basujindal avatar Sep 15 '22 16:09 basujindal