TheLastBen / fast-stable-diffusion

fast-stable-diffusion + DreamBooth
MIT License
7.54k stars 1.31k forks source link

RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu) #946

Open banMo88 opened 1 year ago

banMo88 commented 1 year ago

Hi It happens when I try to train an embedding.

Training at rate of 0.005 until step 3000 Preparing dataset... 100% 98/98 [00:09<00:00, 10.75it/s] 0% 0/3000 [00:00<?, ?it/s]Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 328, in train_embedding loss = shared.sd_model(x, c)[0] / gradient_step File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, *kwargs) File "/content/gdrive/MyDrive/sd/stablediffusion/ldm/models/diffusion/ddpm.py", line 846, in forward return self.p_losses(x, c, t, args, **kwargs) File "/content/gdrive/MyDrive/sd/stablediffusion/ldm/models/diffusion/ddpm.py", line 903, in p_losses logvar_t = self.logvar[t].to(self.device) RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

banMo88 commented 1 year ago

Never mind,I found a solution in automatic1111.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5523#issuecomment-1343041303