Home > Software design >  "AttributeError: Caught AttributeError in DataLoader worker process 0" , "AttributeEr
"AttributeError: Caught AttributeError in DataLoader worker process 0" , "AttributeEr

Time:05-01

I'm getting those 2 errors , "AttributeError: Caught AttributeError in DataLoader worker process 0", "AttributeError: module 'torchvision.transforms' has no attribute 'Scale'"

any body can help? TIA

Traceback (most recent call last):
  File "test.py", line 126, in <module>
    main()
  File "test.py", line 85, in main
    for i, data in enumerate(dataset):
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 530, in __next__
    data = self._next_data()
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1224, in _next_data
    return self._process_data(data)
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1250, in _process_data
    data.reraise()
  File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 457, in reraise
    raise exception
AttributeError: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/content/ACGPN/data/aligned_dataset.py", line 133, in __getitem__
    self.opt, params, method=Image.NEAREST, normalize=False)
  File "/content/ACGPN/data/base_dataset.py", line 46, in get_transform
    transform_list.append(transforms.Scale(osize, method))
AttributeError: module 'torchvision.transforms' has no attribute 'Scale'

CodePudding user response:

It's basically impossible to help without seeing any code but, the error says torchvision.transforms.Scale is not found because it was deprecated so instead use torchvision.transforms.Resize.

  • Related