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

Can't train at all in Colab, said there are tensors on two devices, happens in "Train with reconstruction" #40

Open
xITmasterx opened this issue Dec 19, 2022 · 1 comment

Comments

@xITmasterx
Copy link

I can't seem to run DreamArtist in a fresh install because of this error, and I can't seem to find out where did it went wrong. Got any ideas on how to fix this? Thanks in advance.

Traceback (most recent call last):
  File "/content/stable-diffusion-webui/modules/call_queue.py", line 45, in f
    res = list(func(*args, **kwargs))
  File "/content/stable-diffusion-webui/modules/call_queue.py", line 28, in f
    res = func(*args, **kwargs)
  File "/content/stable-diffusion-webui/extensions/DreamArtist-sd-webui-extension/scripts/dream_artist/ui.py", line 30, in train_embedding
    embedding, filename = dream_artist.cptuning.train_embedding(*args)
  File "/content/stable-diffusion-webui/extensions/DreamArtist-sd-webui-extension/scripts/dream_artist/cptuning.py", line 542, in train_embedding
    loss.backward()
  File "/usr/local/envs/automatic/lib/python3.10/site-packages/torch/_tensor.py", line 396, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
  File "/usr/local/envs/automatic/lib/python3.10/site-packages/torch/autograd/__init__.py", line 173, in backward
    Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument weight in method wrapper__convolution_backward)
@xITmasterx xITmasterx changed the title RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument weight in method wrapper__convolution_backward) Can't train at all in Colab, said there are tensors on two devices. Dec 19, 2022
@xITmasterx
Copy link
Author

More details with the problem: Somehow this error is thrown out whenever I enabled the "Train with reconstruction" option.

@xITmasterx xITmasterx changed the title Can't train at all in Colab, said there are tensors on two devices. Can't train at all in Colab, said there are tensors on two devices, happes in "Train in Reconstruction" Dec 19, 2022
@xITmasterx xITmasterx changed the title Can't train at all in Colab, said there are tensors on two devices, happes in "Train in Reconstruction" Can't train at all in Colab, said there are tensors on two devices, happens in "Train with reconstruction" Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant