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

Validation is only executed once in 02_mnist_train_loop.py example #6

Closed
mstoelzle opened this issue Mar 16, 2023 · 2 comments · Fixed by #7
Closed

Validation is only executed once in 02_mnist_train_loop.py example #6

mstoelzle opened this issue Mar 16, 2023 · 2 comments · Fixed by #7
Assignees

Comments

@mstoelzle
Copy link

If I read the script examples/flax/02_mnist_train_loop.py correctly, the test loop should be executed in total 10 times. However, after inserting a debug statement into the test_step method, I identified that the test loop is in reality only executed once (at the very beginning of the training loop).

I suspect that this buggy behavior is connected to some kind of faulty loading/cut-off of the validation dataset iterator:

The calling iterator did not fully read the dataset being cached. In order to avoid unexpected truncation of the dataset, the partially cached contents of the dataset  will be discarded. This can happen if you have an input pipeline similar to `dataset.cache().take(k).repeat()`. You should use `dataset.take(k).cache().repeat()` instead.

I would appreciate your help in fixing this wrong behaviour.

@cgarciae cgarciae self-assigned this Mar 16, 2023
@cgarciae
Copy link
Owner

Hey @mstoelzle, thanks for reporting this! I have confirmed this. The problem is that the second time the test_loop runs all of its tasks are empty. Fixing...

@cgarciae
Copy link
Owner

Fixed in 0.1.8

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

Successfully merging a pull request may close this issue.

2 participants