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

Raise friendly errors in case of num_epochs is less than num_warmup_epochs in CIFAR10 and Transformers examples #2207

Closed
KickItLikeShika opened this issue Sep 20, 2021 · 8 comments · Fixed by #2236

Comments

@KickItLikeShika
Copy link
Contributor

I was trying to benchmark torch.inference_mode vs torch.no_grad on CIFAR10 example, so I just wanted to run for 3 epochs and average the benchmarks, the default warmup epochs is 4, so the scheduler will raise this error, which is not very clear to new users

f"Milestones should be increasing integers, but given {pair[0]} is smaller "
ValueError: Milestones should be increasing integers, but given 291 is smaller than the previous milestone 388

So I suggest to check num_epochs vs num_warmup_epochs inside run method and raise more clear error message for the users.

@himanshu007-creator
Copy link

Hey , i would like to work on this issue. Can you guide me further?! on what needs to be done🙂

@KickItLikeShika
Copy link
Contributor Author

KickItLikeShika commented Sep 20, 2021

Hey @himanshu007-creator, thanks a lot for showing interest, we have these 2 examples:

in both, if the num_epochs is less the num_warmup_epochs, the error in the description will be raised,
we want to check inside the run method in both examples, if num_epochs is less than num_warmupds_epochs we should raise a friendly error message explaining what's the error and why, and what the user should do (either increase the num_epochs or decrease num_warmup_epochs)

@FarehaNousheen
Copy link
Contributor

Please brief me about the issue a little more. I'll work on this issue.

@KickItLikeShika
Copy link
Contributor Author

KickItLikeShika commented Sep 22, 2021

Hi @FarehaNousheen, please check the comment above #2207 (comment), it explains what we need to do in depth. If you still can't get what we need to do, please ping me on discord.

@DebarshiChanda
Copy link

Hey @KickItLikeShika, I think adding an assertion can solve this issue. Can you assign this to me?

@theory-in-progress
Copy link
Contributor

Hey @KickItLikeShika, I think I've made the necessary changes in three of the files to raise an user friendly message when num_epochs is greater than num_warmup_epochs. Am I free to create a Pull Request, since this hasn't been assigned to me...

theory-in-progress added a commit to theory-in-progress/ignite that referenced this issue Oct 2, 2021
 - Edited to raise friendly errors if num_epochs is less than num_warmup_epochs
 - Edited main.py in directories cifar10, cifar10_qat and transformers.
DebarshiChanda added a commit to DebarshiChanda/ignite that referenced this issue Oct 2, 2021
@vfdev-5
Copy link
Collaborator

vfdev-5 commented Oct 2, 2021

@DebarshiChanda @theory-in-progress to be fair if someone is assigned to the issue his/her PR has higher prio (conditioned also by the time it takes to work on the issue). Thanks a lot to you both on working on this tiny issue ! In this particular case, @theory-in-progress 's PR looks better and we'll proceed with it.
@DebarshiChanda please pick another issue to work on, thanks a lot !

@theory-in-progress
Copy link
Contributor

Of course! sorry for barging in... Thanks for the opportunity @vfdev-5! I'm happy to work on this issue

theory-in-progress added a commit to theory-in-progress/ignite that referenced this issue Oct 3, 2021
 - Formatted according to guidelines.
vfdev-5 added a commit that referenced this issue Oct 6, 2021
* Related to #2207: Friendly Errors (#2207)
 - Edited to raise friendly errors if num_epochs is less than num_warmup_epochs
 - Edited main.py in directories cifar10, cifar10_qat and transformers.

* Friendly Messages #2207

 - Formatted according to guidelines.

* Edited according to a few suggestions.

* Edited according to a few suggestions.

* Edited according to a few suggestions.

* Code Formatting

* Edited to raise error if num_epochs >= num_warmup_epochs

* Code Formatting

Co-authored-by: vfdev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants