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

Error while running classifier.py on custom set #2699

Closed
pngmafia opened this issue Apr 4, 2021 · 1 comment
Closed

Error while running classifier.py on custom set #2699

pngmafia opened this issue Apr 4, 2021 · 1 comment
Labels
question Further information is requested

Comments

@pngmafia
Copy link

pngmafia commented Apr 4, 2021

Getting this error while running the classifier.py script on custom dataset.

Image sizes 64 train, 64 test
Using 4 dataloader workers
Logging results to runs/train/exp7
Starting training for 1 epochs...

epoch     gpu_mem   train_loss  val_loss    accuracy    
  0%|                                                                                         | 0/165 [00:02<?, ?it/s]
Traceback (most recent call last):
  File "classifier.py", line 241, in <module>
    train()
  File "classifier.py", line 125, in train
    for i, (images, labels) in pbar:
  File "/opt/conda/lib/python3.8/site-packages/tqdm/std.py", line 1193, in __iter__
    for obj in iterable:
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 518, in __next__
    data = self._next_data()
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1200, in _next_data
    return self._process_data(data)
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1226, in _process_data
    data.reraise()
  File "/opt/conda/lib/python3.8/site-packages/torch/_utils.py", line 428, in reraise
    raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
    data = fetcher.fetch(index)
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 84, in default_collate
    return [default_collate(samples) for samples in transposed]
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 84, in <listcomp>
    return [default_collate(samples) for samples in transposed]
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 56, in default_collate
    return torch.stack(batch, 0, out=out)
RuntimeError: stack expects each tensor to be equal size, but got [3, 37, 32] at entry 0 and [3, 111, 154] at entry 1```
@pngmafia pngmafia added the question Further information is requested label Apr 4, 2021
@pngmafia
Copy link
Author

pngmafia commented Apr 4, 2021

Solution #2438 (comment)

@pngmafia pngmafia closed this as completed Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant