Introduce ResettableHandler interface and attach() method#3564
Introduce ResettableHandler interface and attach() method#3564vfdev-5 merged 1 commit intopytorch:masterfrom
ResettableHandler interface and attach() method#3564Conversation
37f6196 to
e4a9274
Compare
b04a152 to
cf2ddad
Compare
|
@vfdev-5 I have refactored the PR to use the Key changes:
Let me know what you think! Future Direction: |
|
@TahaZahid05 can you please also update the PR description. Thanks a lot for working on this topic! |
ResetableHandler interface and automated reset logicResettableHandler interface and attach() method
bf0ccca to
2184a22
Compare
vfdev-5
left a comment
There was a problem hiding this comment.
LGTM, thanks @TahaZahid05 !
|
@vfdev-5 can you guide me regarding the errors? I built it locally and ran fine, and here it seems to be some error regarding |
|
"Build docs" errors are failing unrelated. Pyrefly are related to the change but we should avoid circular import of Engine |
|
Thanks. Should I just use a |
Try that and see if it helps |
2365c80 to
9a3a353
Compare
Done. Ran locally as well and it passed. I have also retained type hints for Thanks. |
Partially Addresses #3535
Description:
Introduces a
ResettableHandlerabstract base class to establish a formalized interface for stateful handlers.EarlyStoppingis the first adopter of this pattern, implementing bothreset()andattach()methods.This mirrors the existing
Metric.attach()lifecycle pattern, avoiding any Engine-level modifications while providing a clean, self-contained way to manage handler state across runs.API
Check list: