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

Int num_sanity_val_steps is always replaced by float limit_val_batches #2882

Closed
manipopopo opened this issue Aug 8, 2020 · 8 comments · Fixed by #2917
Closed

Int num_sanity_val_steps is always replaced by float limit_val_batches #2882

manipopopo opened this issue Aug 8, 2020 · 8 comments · Fixed by #2917
Assignees
Labels
discussion In a discussion stage good first issue Good for newcomers

Comments

@manipopopo
Copy link
Contributor

The type annotations of num_sanity_val_steps: and limit_val_batches are int and Union[int, float] for percent or num_batches. The minimum of percent and num_batches will be percent. (except when num_batches==0)
https://github.com/PyTorchLightning/pytorch-lightning/blob/a59e140ee814d8818d121405582133cf6b767e1a/pytorch_lightning/trainer/trainer.py#L461

Maybe we can remove the dependency of limit_val_batches from num_sanity_val_steps and revert to
https://github.com/PyTorchLightning/pytorch-lightning/blob/1e68968ed7fb9b8f73df148dd48194d469655ea3/pytorch_lightning/trainer/trainer.py#L491

@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2020

Hi! thanks for your contribution!, great first issue!

@ananyahjha93 ananyahjha93 self-assigned this Aug 8, 2020
@ananyahjha93 ananyahjha93 added information needed discussion In a discussion stage good first issue Good for newcomers and removed information needed labels Aug 8, 2020
@ananyahjha93
Copy link
Contributor

@williamFalcon @Borda should num_sanity_val_steps be limited by limit_val_batches? My understanding is they can be independent of one another.

@awaelchli
Copy link
Member

@ananyahjha93 I asked william some time ago: #2246 (comment)

@rohitgr7
Copy link
Contributor

rohitgr7 commented Aug 9, 2020

@awaelchli Here: #2246 (comment)
Shouldn't Trainer(num_sanity_val_steps=5, limit_val_batches=3) run 3 sanity val steps?

@rohitgr7
Copy link
Contributor

@awaelchli any comments on above? We can fix it then :)

@awaelchli
Copy link
Member

It depends. What does it currently do in your example?

@rohitgr7
Copy link
Contributor

rohitgr7 commented Aug 11, 2020

@awaelchli In the #2246 (comment) you said it should run for 5 val_steps but here https://github.com/PyTorchLightning/pytorch-lightning/blob/0097630a95bddc48d6fb5d3b9a58aef2e8e89b22/pytorch_lightning/trainer/trainer.py#L463-L466 it seems that it's running for 3 val_steps.

I suggest num_sanity_val_steps should be updated according to limit_val_batches(both float and int) and then we can merge #2892 accordingly.

@williamFalcon
Copy link
Contributor

williamFalcon commented Aug 12, 2020

num_sanity_val_steps should be int or -1.

this is really meant to be a sanity check... floats will break this.

You need this min because if your dataset is smaller than the limit_val_batches it will crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion In a discussion stage good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants