Project-MONAI / Project-MONAI/MONAILabel
Expose a simple way to add training handlers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 891
- Forks
- 269
- Avg merge
- 15h 41m
- Merged PRs (30d)
- 1
Description
Describe the solution you'd like
Need a simple way to add a handler to the training.
Describe alternatives you've considered
Not sure if this is the best way but I managed to override the finalize method as below where I basically called the super then added on to add my handler
def finalize(self, context):
super().finalize(context)
if context.trainer:
from ignite.engine import Events
context.trainer.add_event_handler(event_name=Events.EPOCH_COMPLETED, handler=self._myadditional_handler)
Additional context
It would be nice to have a method we can override that we can simply add the handler.
Or even better and cleaner to have the method called to add to the list before we call the trainer as shown in
https://github.com/Project-MONAI/MONAI/blob/d23221f06afdf5fa7d8e3fde6552b6cceaf4a0bc/tests/test_integration_workflows.py#L162-L190
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the training flow around the overridable finalize method and compare it with the handler-registration pattern in tests/test_integration_workflows.py at the referenced lines. Determine where a public extension point belongs, then add coverage showing that a custom training handler can be registered before training runs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100