NVlabs / few-shot-vid2vid

Pytorch implementation for few-shot photorealistic video-to-video translation.
Other
1.8k stars 274 forks source link

Sizes of Tensors must match except in dimension 0 #36

Closed macriluke closed 4 years ago

macriluke commented 4 years ago

Been getting the following error around epoch 70, 71. Just updated with the latest commit. Can anybody tell me what it means?

Traceback (most recent call last):
  File "/home/videx/Desktop/vid2vid/few-shot-vid2vid/train.py", line 73, in <module>
    train()
  File "/home/videx/Desktop/vid2vid/few-shot-vid2vid/train.py", line 40, in train
    for idx, data in enumerate(dataset, start=trainer.epoch_iter):
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 637, in __next__
    return self._process_next_batch(batch)
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 229, in default_collate
    return {key: default_collate([d[key] for d in batch]) for key in batch[0]}
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 229, in <dictcomp>
    return {key: default_collate([d[key] for d in batch]) for key in batch[0]}
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 209, in default_collate
    return torch.stack(batch, 0, out=out)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 16 and 15 in dimension 1 at /pytorch/aten/src/TH/generic/THTensorMoreMath.cpp:1333

Thanks!

macriluke commented 4 years ago

Resolved this issue. This is for Face Training, we are using voxceleb and cleaning the data ourselves. It seems the minimum number of frames for any given video in the dataset is 16, I had previously guessed it was 15, which resulted in the mismatching tensors. If this limit is universal to this model, I suggest adding a validation function to make it clear.