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

[Bug]: Error training embedding #16619

Open
6 tasks
bluelovers opened this issue Nov 1, 2024 · 2 comments
Open
6 tasks

[Bug]: Error training embedding #16619

bluelovers opened this issue Nov 1, 2024 · 2 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@bluelovers
Copy link
Contributor

Checklist

  • The issue exists after disabling all extensions
  • The issue exists on a clean installation of webui
  • The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • The issue exists in the current version of the webui
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

What happened?

Calculating sha256 for D:\stable-diffusion-webui\embeddings\n0n1pp1e5.pt: 5ab059d44f700da25700191f6762d483468c57739982625e860a7546d2c83663
Training at rate of 0.005 until step 100000
Preparing dataset...
100%|████████████████████████████████████████████████████████████████████████████████| 209/209 [00:08<00:00, 23.73it/s]
  0%|                                                                                       | 0/100000 [00:00<?, ?it/s]*** Error training embedding
    Traceback (most recent call last):
      File "D:\stable-diffusion-webui\modules\textual_inversion\textual_inversion.py", line 551, in train_embedding
        loss = shared.sd_model.forward(x, cond)[0] / gradient_step
      File "D:\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 846, in forward
        return self.p_losses(x, c, t, *args, **kwargs)
      File "D:\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 886, in p_losses
        model_output = self.apply_model(x_noisy, t, cond)
      File "D:\stable-diffusion-webui\modules\sd_hijack_utils.py", line 22, in <lambda>
        setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
      File "D:\stable-diffusion-webui\modules\sd_hijack_utils.py", line 34, in __call__
        return self.__sub_func(self.__orig_func, *args, **kwargs)
      File "D:\stable-diffusion-webui\modules\sd_hijack_unet.py", line 50, in apply_model
        result = orig_func(self, x_noisy.to(devices.dtype_unet), t.to(devices.dtype_unet), cond, **kwargs)
      File "D:\stable-diffusion-webui\modules\sd_hijack_utils.py", line 22, in <lambda>
        setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
      File "D:\stable-diffusion-webui\modules\sd_hijack_utils.py", line 36, in __call__
        return self.__orig_func(*args, **kwargs)
      File "D:\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 858, in apply_model
        x_recon = self.model(x_noisy, t, **cond)
      File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "D:\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 1335, in forward
        out = self.diffusion_model(x, t, context=cc)
      File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "D:\stable-diffusion-webui\modules\sd_unet.py", line 91, in UNetModel_forward
        return original_forward(self, x, timesteps, context, *args, **kwargs)
      File "D:\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\openaimodel.py", line 789, in forward
        emb = self.time_embed(t_emb)
      File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\container.py", line 215, in forward
        input = module(input)
      File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
        return self._call_impl(*args, **kwargs)
      File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
        return forward_call(*args, **kwargs)
      File "D:\stable-diffusion-webui\extensions-builtin\Lora\networks.py", line 582, in network_Linear_forward
        network_apply_weights(self)
      File "D:\stable-diffusion-webui\extensions-builtin\Lora\networks.py", line 454, in network_apply_weights
        network_restore_weights_from_backup(self)
      File "D:\stable-diffusion-webui\extensions-builtin\Lora\networks.py", line 403, in network_restore_weights_from_backup
        restore_weights_backup(self, 'weight', weights_backup)
      File "D:\stable-diffusion-webui\extensions-builtin\Lora\networks.py", line 388, in restore_weights_backup
        getattr(obj, field).copy_(weight)
    RuntimeError: a leaf Variable that requires grad is being used in an in-place operation.

---
Applying attention optimization: xformers... done.

Steps to reproduce the problem

image

image

What should have happened?

.

What browsers do you use to access the UI ?

Mozilla Firefox

Sysinfo

sysinfo-2024-11-01-08-05.json

Console logs

.

Additional information

n0n1pp1e5.zip
n0n1pp1e5.z01.zip <== rename as n0n1pp1e5.z01

@bluelovers bluelovers added the bug-report Report of a bug, yet to be confirmed label Nov 1, 2024
@linuarM
Copy link

linuarM commented Nov 3, 2024

hey, can you check this one discussion : #4868 it can be possibly a handy information to your issue.

@Haoming02
Copy link
Contributor

Use something like kohya_ss to train Embeddings.

The built-in Train tab has long been broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

3 participants