Not able to pass batch of

I’m not able to pass batch of images through my ResNet9 Model

Can you please elaborate on what problems you are facing and do share the link to your notebook.

Hi,
I Could not pass batch of images through the model. This is my link to course project.

You have not loaded the training and validation dataloaders in the cuda memory, Load the training data loader and valid data loader in the cuda memory as shown in the image below.

I’ve changed thedataloaders in cuda memory. But I face this issue:

FileNotFoundError Traceback (most recent call last)
in ()
1 torch.cuda.empty_cache()
----> 2 for batch in train_dl:
3 images, labels = batch
4 print(‘images.shape:’, images.shape)
5 print(‘images.device:’, images.device)

3 frames
/usr/local/lib/python3.6/dist-packages/torchvision/datasets/folder.py in pil_loader(path)
166 def pil_loader(path: str) -> Image.Image:
167 # open path as file to avoid ResourceWarning (https://github.com/python-pillow/Pillow/issues/835)
–> 168 with open(path, ‘rb’) as f:
169 img = Image.open(f)
170 return img.convert(‘RGB’)

FileNotFoundError: [Errno 2] No such file or directory: ‘./data/cifar100/train/aquatic_mammals/beaver/beaver_s_000001.png’

When you are doing shutil.rmtree() it is removing the train directory from the data present, so You are getting a file not found error as the file is not present in your directory anymore, remove that part from your code where it says

Though I removed shutil rmtree it’s showing error like this:

AttributeError Traceback (most recent call last)
in ()
1 torch.cuda.empty_cache()
----> 2 for batch in train_dl:
3 images, labels = batch
4 print(‘images.shape:’, images.shape)
5 print(‘images.device:’, images.device)

3 frames
in to_device(data, device)
8 if isinstance(data, (list, tuple)):
9 return [to_device(x, device) for x in data]
—> 10 return data.to(device, non_blocking=True)
11
12 class DeviceDataLoader():

AttributeError: ‘int’ object has no attribute 'to

I’m facing the same error. Was it solved? How?