Add `dict` properties to Engine and State
See original GitHub issueš Feature
Hi @vfdev-5 ,
In the current implementation of MONAI handlers, they are deeply coupled with ignite engine. Some users that use different workflows canāt leverage our handlers, so we are trying to make handlers decouple from ignite. We discussed the problem and got some basic ideas:
- Add
dict
properties to theengine
, then handlers can treatengine
arg as a regular dict with same structure as ignite Engine object. - Pass the event name when trigger handler, so other workflows also can call this handler with the same event name.
For example:
class TestHandler:
def attach(self):
# ignite specific logic
... ...
def __call__(self, data: Dict, event: str):
# data map to the engine dict of ignite
if event == "ITERATION_COMPLETED":
self._iteration(data)
if event == "EPOCH_COMPLETED":
self._epoch(data)
What do you think?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Python Add to Dictionary [Easy Step-By-Step] - DigitalOcean
Python add to Dictionary using ā=ā assignment operator Ā· Append values to a dictionary using the update() method Ā· Add items to Python...
Read more >Set dictionary key to attribute of class instance - Stack Overflow
In general, I'd stay away of methods that magically add attributes to instances in the middle of the execution. Option 3: Use @Daniel's...
Read more >Dictionary attributes - Product Documentation | ServiceNow
Name Value Target Element
allow_null true/false field_name field
allow_public true/false table_name field
allow_references true/false field_name field
Read more >Dictionary ā Godot Engine (stable) documentation in English
Associative container which contains values referenced by unique keys. Dictionaries are composed of pairs of keys (which must be unique) and values.
Read more >Use Python dict Variables in MATLAB - MathWorks
This example shows how to use PythonĀ® dictionary ( dict ) variables in MATLABĀ®. To call a Python function that takes a dict...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
thanks, I feel the utilities such as
EngineAsDict
could help onboard users for both ignite and monai. (also one of monaiās principles is āto be compatible with existing efforts and ease of 3rd party integration for various components.ā)the details need more discussions but theyāll be ignite usage discussions instead of a feature request here⦠Iād suggest converting this ticket into a discussionā¦
Cool, sounds good! Let me try to refactor handlers for the
inference
workflows first based on this proposal. For the first step, we are trying to co-work with some GPU optimized inference projects of NVIDIA, which are currently based on other workflows, like DALI, etc.Thanks so much for your help!