Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to train #301

Open
youyinnn opened this issue Apr 3, 2024 · 1 comment
Open

Unable to train #301

youyinnn opened this issue Apr 3, 2024 · 1 comment

Comments

@youyinnn
Copy link

youyinnn commented Apr 3, 2024

I am not able to train a model.

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

@dev-jinwoohong
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants