denoising-diffusion-pytorch
denoising-diffusion-pytorch copied to clipboard
Unable to train
I am not able to train a model.
When I use my own data loader, it gives:
The error 'list' object has no attribute 'to' indicates that you are trying to call the .to(device) method on a list object, which is not possible because Python lists do not have this method. This error typically arises when using PyTorch and expecting a tensor instead of a list. Here’s how to resolve this issue:
-
Check DataLoader Output: Ensure that your DataLoader is returning a PyTorch tensor rather than a list. You might need to adjust how your dataset is processed or how your DataLoader is configured.
-
Convert List to Tensor: If the DataLoader is supposed to return a list and you need it to be a tensor, you can manually convert the list to a tensor using torch.Tensor(). For example:
data = torch.Tensor(next(self.dl)).to(device)