denoising-diffusion-pytorch icon indicating copy to clipboard operation
denoising-diffusion-pytorch copied to clipboard

Unable to train

Open youyinnn opened this issue 1 year ago • 1 comments

I am not able to train a model.

When I use my own data loader, it gives: image

youyinnn avatar Apr 03 '24 03:04 youyinnn

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:

  1. 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.

  2. 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)

dev-jinwoohong avatar Jun 04 '24 06:06 dev-jinwoohong