question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:

  1. Add dict properties to the engine, then handlers can treat engine arg as a regular dict with same structure as ignite Engine object.
  2. 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:open
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
wylicommented, May 20, 2021

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…

2reactions
Nic-Macommented, May 20, 2021

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found