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

Chapter 15: TypeError #108

Open
vmirly opened this issue Feb 4, 2023 · 0 comments
Open

Chapter 15: TypeError #108

vmirly opened this issue Feb 4, 2023 · 0 comments

Comments

@vmirly
Copy link

vmirly commented Feb 4, 2023

The test dataset is a DataPipe, and therefore does not have a length, which results in the following error in the evaluate function:

    return total_acc/len(dataloader.dataset), total_loss/len(dataloader.dataset)
TypeError: MapperIterDataPipe instance doesn't have valid length

One way to fix this is to convert that to a list, before applying the len() function:

    return total_acc/len(list(dataloader.dataset)), total_loss/len(list(dataloader.dataset))
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

1 participant