报错如下:
将设备改为CPU,就定位到错误了:
Traceback (most recent call last):
File "./training.py", line 713, in <module>
train_body_pixel()
File "./training.py", line 685, in train_body_pixel
trainer.fit(pixel_model, train_loader, val_loader)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 532, in fit
call._call_and_handle_interrupt(
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/call.py", line 43, in _call_and_handle_interrupt
return trainer_fn(*args, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 571, in _fit_impl
self._run(model, ckpt_path=ckpt_path)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 980, in _run
results = self._run_stage()
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1021, in _run_stage
self._run_sanity_check()
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1050, in _run_sanity_check
val_loop.run()
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/loops/utilities.py", line 181, in _decorator
return loop_run(self, *args, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/loops/evaluation_loop.py", line 115, in run
self._evaluation_step(batch, batch_idx, dataloader_idx)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/loops/evaluation_loop.py", line 376, in _evaluation_step
output = call._call_strategy_hook(trainer, hook_name, *step_kwargs.values())
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/call.py", line 293, in _call_strategy_hook
output = fn(*args, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/strategies/strategy.py", line 393, in validation_step
return self.model.validation_step(*args, **kwargs)
File "./training.py", line 412, in validation_step
loss = self._calc_loss(latents, batch["mfcc"].transpose(1, 2), batch["speaker"])
File "./training.py", line 370, in _calc_loss
logits = self.generator(latents[:, :], id, audio)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/autodl-tmp/wav2motion/wav2motion/models/spg/gated_pixelcnn_v2.py", line 181, in forward
x = self.embedding(x.view(-1)).view(shp) # (B, H, W, C) # TODO: (√) 是不是应该两个emb?最后给展平了,手和身体的合起来了
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/sparse.py", line 162, in forward
return F.embedding(
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/functional.py", line 2210, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
IndexError: index out of range in self