basujindal / stable-diffusion

Optimized Stable Diffusion modified to run on lower GPU VRAM
Other
3.14k stars 469 forks source link

ModuleNotFoundError: no module named 'samplers' #175

Open rav-en opened 1 year ago

rav-en commented 1 year ago

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.

dunaden001 commented 1 year ago

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

rav-en commented 1 year ago

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

ArthurHeitmann commented 1 year ago

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
andreasgoodstein commented 1 year ago

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.

rav-en commented 1 year ago

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.

basujindal commented 1 year ago

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