I converted some of them to images and put it in a folder etc. but now im getting this error:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-b1d4464b941e> in <module>
      1 n_epochs = 10
      2 for epoch in range(n_epochs):
----> 3     train(epoch)

<ipython-input-9-df779ce045bf> in train(epoch)
      5     exp_lr_scheduler.step()
      6 
----> 7     for batch_idx, (data, target) in enumerate(train_loader):
      8 
      9         optimizer.zero_grad()

~/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py in __next__(self)
    613         if self.num_workers == 0:  # same-process loading
    614             indices = next(self.sample_iter)  # may raise StopIteration
--> 615             batch = self.collate_fn([self.dataset[i] for i in indices])
    616             if self.pin_memory:
    617                 batch = pin_memory_batch(batch)

~/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py in <listcomp>(.0)
    613         if self.num_workers == 0:  # same-process loading
    614             indices = next(self.sample_iter)  # may raise StopIteration
--> 615             batch = self.collate_fn([self.dataset[i] for i in indices])
    616             if self.pin_memory:
    617                 batch = pin_memory_batch(batch)

~/.local/lib/python3.6/site-packages/torchvision/datasets/folder.py in __getitem__(self, index)
    101         sample = self.loader(path)
    102         if self.transform is not None:
--> 103             sample = self.transform(sample)
    104         if self.target_transform is not None:
    105             target = self.target_transform(target)

~/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py in __call__(self, img)
     47     def __call__(self, img):
     48         for t in self.transforms:
---> 49             img = t(img)
     50         return img
     51 

~/.local/lib/python3.6/site-packages/torchvision/transforms/transforms.py in __call__(self, pic)
    108 
    109         """
--> 110         return F.to_pil_image(pic, self.mode)
    111 
    112     def __repr__(self):

~/.local/lib/python3.6/site-packages/torchvision/transforms/functional.py in to_pil_image(pic, mode)
    101     """
    102     if not(_is_numpy_image(pic) or _is_tensor_image(pic)):
--> 103         raise TypeError('pic should be Tensor or ndarray. Got {}.'.format(type(pic)))
    104 
    105     npimg = pic

TypeError: pic should be Tensor or ndarray. Got <class 'PIL.Image.Image'>.

The code (network is the same as before):
def train(epoch):
    
    model.train()
    
    exp_lr_scheduler.step()

    for batch_idx, (data, target) in enumerate(train_loader):
        
        optimizer.zero_grad()
        
        output = model(data)
        
        loss = criterion(output, target)
        
        loss.backward()
        
        optimizer.step()
        
        if (batch_idx + 1)% 100 == 0:
            print('File: {} Train Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}'.format(
                i, epoch, (batch_idx + 1) * len(data), len(train_loader.dataset),
                100. * (batch_idx + 1) / len(train_loader), loss.data))

    print('Training data:')
    evaluate(train_loader)
    print('Test data:')
    evaluate(test_loader)

test_dataset = ImageFolder('./data/test', )
test_loader = torch.utils.data.DataLoader(dataset=test_dataset,batch_size=batch_size, shuffle=False)
train_dataset = ImageFolder('./data/train', transform= transforms.Compose(
                    [transforms.ToPILImage(), 
                     transforms.ToTensor(), 
                     transforms.Normalize(mean=(0.5,), std=(0.5,))]))
train_loader = torch.utils.data.DataLoader(dataset=train_dataset,batch_size=batch_size, shuffle=True)
n_epochs = 10
for epoch in range(n_epochs):
    train(epoch)

I should modify train() right? If so can you tell me what please?