This was working great for me.
When I tried to use it just now, it gave me an error on the Actual Training cell.
Any idea what I did to break it?
This is the error:
Traceback (most recent call last): File "main.py", line 819, in <module> trainer.fit(model, data) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 770, in fit self._call_and_handle_interrupt( File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 721, in _call_and_handle_interrupt return self.strategy.launcher.launch(trainer_fn, *args, trainer=self, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/strategies/launchers/subprocess_script.py", line 93, in launch return function(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 811, in _fit_impl results = self._run(model, ckpt_path=self.ckpt_path) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1236, in _run results = self._run_stage() File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1323, in _run_stage return self._run_train() File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1345, in _run_train self._run_sanity_check() File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1413, in _run_sanity_check val_loop.run() File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/base.py", line 204, in run self.advance(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 155, in advance dl_outputs = self.epoch_loop.run(self._data_fetcher, dl_max_batches, kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/base.py", line 204, in run self.advance(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 128, in advance output = self._evaluation_step(**kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 226, in _evaluation_step output = self.trainer._call_strategy_hook("validation_step", *kwargs.values()) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1765, in _call_strategy_hook output = fn(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/strategies/ddp.py", line 355, in validation_step return self.model(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/parallel/distributed.py", line 1040, in forward output = self._run_ddp_forward(*inputs, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/parallel/distributed.py", line 1000, in _run_ddp_forward return module_to_run(*inputs[0], **kwargs[0]) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/overrides/base.py", line 93, in forward return self.module.validation_step(*inputs, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/content/drive/MyDrive/sd_text_inversion/Stable-textual-inversion_win/ldm/models/diffusion/ddpm.py", line 367, in validation_step _, loss_dict_no_ema = self.shared_step(batch) File "/content/drive/MyDrive/sd_text_inversion/Stable-textual-inversion_win/ldm/models/diffusion/ddpm.py", line 918, in shared_step loss = self(x, c) 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/drive/MyDrive/sd_text_inversion/Stable-textual-inversion_win/ldm/models/diffusion/ddpm.py", line 931, in forward return self.p_losses(x, c, t, *args, **kwargs) File "/content/drive/MyDrive/sd_text_inversion/Stable-textual-inversion_win/ldm/models/diffusion/ddpm.py", line 1082, 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)
A quick fix to this would be to make sure t is on the correct device (e.g. by replacing the problem line with logvar_t = self.logvar[t.cpu()].to(self.device))
This was working great for me. When I tried to use it just now, it gave me an error on the Actual Training cell. Any idea what I did to break it? This is the error:
Traceback (most recent call last): File "main.py", line 819, in <module> trainer.fit(model, data) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 770, in fit self._call_and_handle_interrupt( File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 721, in _call_and_handle_interrupt return self.strategy.launcher.launch(trainer_fn, *args, trainer=self, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/strategies/launchers/subprocess_script.py", line 93, in launch return function(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 811, in _fit_impl results = self._run(model, ckpt_path=self.ckpt_path) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1236, in _run results = self._run_stage() File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1323, in _run_stage return self._run_train() File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1345, in _run_train self._run_sanity_check() File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1413, in _run_sanity_check val_loop.run() File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/base.py", line 204, in run self.advance(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 155, in advance dl_outputs = self.epoch_loop.run(self._data_fetcher, dl_max_batches, kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/base.py", line 204, in run self.advance(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 128, in advance output = self._evaluation_step(**kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 226, in _evaluation_step output = self.trainer._call_strategy_hook("validation_step", *kwargs.values()) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/trainer/trainer.py", line 1765, in _call_strategy_hook output = fn(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/strategies/ddp.py", line 355, in validation_step return self.model(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/parallel/distributed.py", line 1040, in forward output = self._run_ddp_forward(*inputs, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/parallel/distributed.py", line 1000, in _run_ddp_forward return module_to_run(*inputs[0], **kwargs[0]) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch_lightning/overrides/base.py", line 93, in forward return self.module.validation_step(*inputs, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/content/drive/MyDrive/sd_text_inversion/Stable-textual-inversion_win/ldm/models/diffusion/ddpm.py", line 367, in validation_step _, loss_dict_no_ema = self.shared_step(batch) File "/content/drive/MyDrive/sd_text_inversion/Stable-textual-inversion_win/ldm/models/diffusion/ddpm.py", line 918, in shared_step loss = self(x, c) 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/drive/MyDrive/sd_text_inversion/Stable-textual-inversion_win/ldm/models/diffusion/ddpm.py", line 931, in forward return self.p_losses(x, c, t, *args, **kwargs) File "/content/drive/MyDrive/sd_text_inversion/Stable-textual-inversion_win/ldm/models/diffusion/ddpm.py", line 1082, 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)