Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ControlNet AttributeError: 'KModel' object has no attribute 'noise_augmentor' #1420

Closed
Melyns opened this issue Aug 22, 2024 · 2 comments
Closed

Comments

@Melyns
Copy link
Contributor

Melyns commented Aug 22, 2024

I'm trying to use Revision mode in Forge ControlNet extension, but i keep getting this error AttributeError: 'KModel' object has no attribute 'noise_augmentor'.

The model CLIP-ViT-bigG.safetensors is located at D:\AI\Forge\webui\models\ControlNetPreprocessor folder (in case this is important information for diagnosis). I verified the hash of the model downloaded on my PC & the one stored at HuggingFace & they match. My only guess is an error in the forge code somewhere? I'd highly appreciate any assistance.

version: f2.0.1v1.10.1-previous-409-gf7ab23b1
python: 3.10.6
torch: 2.4.0+cu124
xformers: N/A

Here's my console log:

ControlNet - INFO - ControlNet Method CLIP-G (Revision) patched.
To load target model KModel
Begin to load 1 model
[Unload] Trying to free 7676.88 MB for cuda:0 with 0 models keep loaded ...
[Unload] Current free memory is 5682.18 MB ...
[Unload] Unload model CLIPVisionModelWithProjection
[Unload] Current free memory is 9201.43 MB ...
[Memory Management] Current Free GPU Memory: 9201.43 MB
[Memory Management] Required Model Memory: 4897.05 MB
[Memory Management] Required Inference Memory: 1024.00 MB
[Memory Management] Estimated Remaining GPU Memory: 3280.38 MB
Moving model(s) has taken 2.88 seconds
  0%|                                                                                           | 0/20 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "D:\AI\Forge\webui\modules_forge\main_thread.py", line 30, in work
    self.result = self.func(*self.args, **self.kwargs)
  File "D:\AI\Forge\webui\modules\txt2img.py", line 112, in txt2img_function
    processed = processing.process_images(p)
  File "D:\AI\Forge\webui\modules\processing.py", line 815, in process_images
    res = process_images_inner(p)
  File "D:\AI\Forge\webui\modules\processing.py", line 958, in process_images_inner
    samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
  File "D:\AI\Forge\webui\modules\processing.py", line 1329, in sample
    samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
  File "D:\AI\Forge\webui\modules\sd_samplers_kdiffusion.py", line 238, in sample
    samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
  File "D:\AI\Forge\webui\modules\sd_samplers_common.py", line 272, in launch_sampling
    return func()
  File "D:\AI\Forge\webui\modules\sd_samplers_kdiffusion.py", line 238, in <lambda>
    samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
  File "D:\AI\Forge\system\python\lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "D:\AI\Forge\webui\k_diffusion\sampling.py", line 627, in sample_dpmpp_2m_sde
    denoised = model(x, sigmas[i] * s_in, **extra_args)
  File "D:\AI\Forge\system\python\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "D:\AI\Forge\system\python\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\AI\Forge\webui\modules\sd_samplers_cfg_denoiser.py", line 186, in forward
    denoised, cond_pred, uncond_pred = sampling_function(self, denoiser_params=denoiser_params, cond_scale=cond_scale, cond_composition=cond_composition)
  File "D:\AI\Forge\webui\backend\sampling\sampling_function.py", line 357, in sampling_function
    model, x, timestep, uncond, cond, cond_scale, model_options, seed = modifier(model, x, timestep, uncond, cond, cond_scale, model_options, seed)
  File "D:\AI\Forge\webui\extensions-builtin\forge_preprocessor_revision\scripts\preprocessor_revision.py", line 10, in revision_conditioning_modifier
    noise_augmentor = model.noise_augmentor
  File "D:\AI\Forge\system\python\lib\site-packages\torch\nn\modules\module.py", line 1729, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'KModel' object has no attribute 'noise_augmentor'
'KModel' object has no attribute 'noise_augmentor'

edit: added more info

@LittleNightmare
Copy link

LittleNightmare commented Sep 18, 2024

i meet this problem too. in fact, the Revision is working at the first time (just finish downloaded model), but not work after i interrupt my first genertaion. i have try reopen forge but not work.

我也遇到了这个问题。事实上,Revision在刚用的时候正常运行了(刚下载模型),但在我打断我第一次生成后就不工作了。我尝试重开forge但没解决这个问题

@Melyns
Copy link
Contributor Author

Melyns commented Sep 18, 2024

i meet this problem too. in fact, the Revision is working at the first time (just finish downloaded model), but not work after i interrupt my first genertaion. i have try reopen forge but not work.

我也遇到了这个问题。事实上,Revision在刚用的时候正常运行了(刚下载模型),但在我打断我第一次生成后就不工作了。我尝试重开forge但没解决这个问题

Thats strange... so it only works once then you have to restart forge for it to work again? for me the only method that works is if I download Forge zip from release page and not update it. I believe the issue is due to Torch/dependencies breaking forge but i could be wrong

DenOfEquity pushed a commit that referenced this issue Sep 19, 2024
fix for #1420. Skip noise augmentation if model doesn't provide the method; allows Revision controlnet preprocessors to function.
@Melyns Melyns closed this as completed Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants