Hi, I’m re-training an inception_v3 using a remote GPU with CUDA device.
I used these transforms for my dataset
train_set = datasets.ImageFolder(
root = “liG”,
transform = transforms.Compose([transforms.ToTensor(),
transforms.RandomRotation(20),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
transforms.Resize(299)]
))
data_loader= torch.utils.data.DataLoader(train_set,
batch_size=5,
shuffle=True,
num_workers=2)
Below is the cell that raises the error:
for X, y in data_loader:
print("Shape of X [N, C, H, W]: ", X.shape)
print("Shape of y: ", y.shape, y.dtype)
break
The error I’m getting is:
TypeError: Caught TypeError 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 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File “/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py”, line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File “/opt/conda/lib/python3.8/site-packages/torchvision/datasets/folder.py”, line 171, in getitem
sample = self.transform(sample)
File “/opt/conda/lib/python3.8/site-packages/torchvision/transforms/transforms.py”, line 60, in call
img = t(img)
File “/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py”, line 881, in _call_impl
result = self.forward(*input, **kwargs)
File “/opt/conda/lib/python3.8/site-packages/torchvision/transforms/transforms.py”, line 1236, in forward
fill = [float(f) for f in fill]
TypeError: ‘NoneType’ object is not iterable
@ptrblckCaught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 58, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.8/dist-packages/torchvision/datasets/folder.py", line 229, in __getitem__ sample = self.loader(path) File "/usr/local/lib/python3.8/dist-packages/torchvision/transforms/transforms.py", line 95, in __call__ img = t(img) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torchvision/transforms/transforms.py", line 661, in forward img = F.pad(img, self.padding, self.fill, self.padding_mode) File "/usr/local/lib/python3.8/dist-packages/torchvision/transforms/functional.py", line 523, in pad return F_pil.pad(img, padding=padding, fill=fill, padding_mode=padding_mode) File "/usr/local/lib/python3.8/dist-packages/torchvision/transforms/functional_pil.py", line 154, in pad raise TypeError(f"img should be PIL Image. Got {type(img)}") TypeError: img should be PIL Image. Got <class 'str'>
this was the error I was facing ,Sam training my model on .npy files, can u pls help me out?
TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File “/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/worker.py”, line 308, in _worker_loop data = fetcher.fetch(index) File “/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py”, line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File “/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py”, line 51, in data = [self.dataset[idx] for idx in possibly_batched_index] File “”, line 21, in getitem img1 = img[:,128i:128(i+1),:] TypeError: ‘NoneType’ object is not subscriptable