Idea is to cover the following usage:
trainer.run(data, max_iters=1234)
# here we still have epoch length as len(data) if defined
which can be roughly done as
max_iters = 1234
trainer.run(data, epoch_length=max_iters)
# here we run 1 epoch of size max_iters
or as something like
max_iters = 1234
epoch_length = ...
max_epochs = max_iters // epoch_length + 1
@trainer.on(Events.ITERATION_COMPLETED(once=max_iters))
def stop():
trainer.terminate()
trainer.run(data, max_epochs=max_epochs)
Argument max_iters is mutually exclusive with max_epochs.
@vfdev-5 I really enjoy this ! It could help a lot to design training !
@sdesrozis according to your time schedule, let's make this issue as Hacktorberfest and if it is not yet solved, you can try to give a shot.
Ok !
I'd like to spend a few days & try to resolve this issue. Perhaps it's a quick fix but the extra time will help me get familiarized with more of the codebase as well
@thescripted sure, I can assign it to you if you wish.
Perhaps it's a quick fix but the extra time will help me get familiarized with more of the codebase as well
I'm not sure if it can be a quick fix, there are several things to add, hope you will have time and motivation to discuss and code :)
Approximative plan is :
1) add max_iters to State (but I'm not quite sure about that)
2) compute max_epochs somehow:
a) if we have epoch_length not None => max_epochs = ceil max_iters / epoch_length
b) otherwise, we have to invent something ...
3) add additional checks to exit the run once we achieved max_iters:
https://github.com/pytorch/ignite/blob/391c13a20807188e5d788d356379ef1689b39b21/ignite/engine/engine.py#L838
and
https://github.com/pytorch/ignite/blob/391c13a20807188e5d788d356379ef1689b39b21/ignite/engine/engine.py#L760
Got it, yeah I'd be happy to put in the time and motivation to work through this, and I'll be quick to notify and un-assign myself if I feel incapable.
Side remark : help to solve #1357 and maybe #1371 ?
Side remark : help to solve #1357 and maybe #1371 ?
@sdesrozis I think those issues should be fixed in other PRs