pytorch / ignite

High-level library to help with training and evaluating neural networks in PyTorch flexibly and transparently.
https://pytorch-ignite.ai
BSD 3-Clause "New" or "Revised" License
4.55k stars 619 forks source link

Parameter "max_iters" present in master but missing in release #2170

Closed HasnainRaz closed 3 years ago

HasnainRaz commented 3 years ago

❓ Questions/Help/Support

Hey guys,

So in master, I observed this new argument has been present since Nov 2020: https://github.com/pytorch/ignite/blob/master/ignite/engine/engine.py#L608

But in the commit linked in the latest release (0.4.6), it not there: https://github.com/pytorch/ignite/blob/84e51c3b4987c16f6dd27a6abd2f9ff95da3dc6c/ignite/engine/engine.py#L596

Also, looking at the commit history on engine.py in the release commit: https://github.com/pytorch/ignite/commits/f217d78797ecec17e0a508b75a6994e0947c2d22/ignite/engine/engine.py It appears that "max_iters" change is included. But it's not there in the release codebase.

Can anybody clarify what is happening here/When this will be released?

vfdev-5 commented 3 years ago

@HasnainRaz thanks for the question. The reason why max_iters arg is excluded from stable releases is related to this known issue: https://github.com/pytorch/ignite/issues/1521 We will possibly fix it together with engine refactoring in v0.5.X

By the way, if needed, today you can still "emulate" this argument as following :

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)
HasnainRaz commented 3 years ago

Thank you, that works