RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.FloatTensor) should be the same
See original GitHub issueIssue Description
Tried running a training session following the example on the site but I keep getting this error.
Tried launching webui with --no-half option but does not change anything.
Any idea?
Training at rate of 0.003 until step 100000
Preparing dataset...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:02<00:00, 3.80it/s]
0%| | 0/100000 [00:00<?, ?it/s]
Applying xformers cross attention optimization.
Error completing request
Arguments: ('test-jungho_lee', '0.003', 1, 'D:\\dreambooth\\train_jungho_lee\\portrait-pp', 'textual_inversion', 512, 640, 100000, 500, 500, 'D:\\stable-diffusion-webui\\textual_inversion_templates\\style.txt', True, False, '', '', 20, 1, 7, -1.0, 448, 640, 5.0, '', True, True, 1, 1) {}
Traceback (most recent call last):
File "D:\stable-diffusion-webui\modules\ui.py", line 185, in f
res = list(func(*args, **kwargs))
File "D:\stable-diffusion-webui\webui.py", line 54, in f
res = func(*args, **kwargs)
File "D:\stable-diffusion-webui\extensions\DreamArtist\scripts\dream_artist\ui.py", line 30, in train_embedding
embedding, filename = dream_artist.cptuning.train_embedding(*args)
File "D:\stable-diffusion-webui\extensions\DreamArtist\scripts\dream_artist\cptuning.py", line 413, in train_embedding
x_samples_ddim = shared.sd_model.decode_first_stage.__wrapped__(shared.sd_model, output[2]) # forward with grad
File "D:\stable-diffusion-webui\repositories\stable-diffusion\ldm\models\diffusion\ddpm.py", line 763, in decode_first_stage
return self.first_stage_model.decode(z)
File "D:\stable-diffusion-webui\repositories\stable-diffusion\ldm\models\autoencoder.py", line 331, in decode
z = self.post_quant_conv(z)
File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\conv.py", line 457, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\conv.py", line 453, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.FloatTensor) should be the same
Issue Analytics
- State:
- Created 5 months ago
- Comments:17 (5 by maintainers)
Top Results From Across the Web
RuntimeError: Input type (torch.cuda.FloatTensor) and weight ...
FloatTensor ) and weight type (torch.cuda.HalfTensor) should be the same. I tried several ways by changing transforms, changing device type, ...
Read more >RuntimeError: Input type (torch.FloatTensor) and weight type ...
You get this error because your model is on the GPU, but your data is on the CPU. So, you need to send...
Read more >RuntimeError: Input type (torch.cuda.HalfTensor) and ... - GitHub
RuntimeError : Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same #44.
Read more >HugginFace dataset error: RuntimeError: Input type (torch ...
FloatTensor ) and weight type (torch.cuda.HalfTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor....
Read more >RuntimeError: Input type (torch.cuda ... - Fast.ai forums
I get the following error: RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This happens for me if I select ‘Train with reconstruction’, it also seems to break regular textual inversion permanently though I only noticed that once and haven’t tried again.
To fix it, I had to:
Replace /modules/ui.py with the original, since this extension makes minor changes to the file and then it can’t work anymore without the extension present, which is a big problem.
Remove the DreamArtist folder from /extensions/ (not just disable it).
Start the web-ui.
Then with the ui running, redownload or move the DreamArtist folder back into extensions.
Then with the ui still open, use the refresh button in the extensions tab.
Ensure the extension is checked to be enabled
Close and restart the web-ui completely
It should work again, and make sure to not click ‘Train with reconstruction’
If you just want to remove the extension permanently, you just need to do 1 & 2.
It’s either that or remove --no-half --precision full from the commands, it works at 512x512 with those removed again.