-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ORTModule support for kwargs input that is a dict #13910
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition
@shubhambhokare1 might be interested in seeing a real use case for nested dicts
orttraining/orttraining/python/training/ortmodule/_inference_manager.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -113,21 +135,15 @@ def __repr__(self) -> str: | |||
\tRequire gradient: {self.require_grad_names} | |||
\tDynamic axes: {self.dynamic_axes} | |||
\tSchema: {self.schema} | |||
\t#Positionals (total): {self.num_positionals} | |||
\t#Expanded Positionals (non-None): {self.num_expanded_positionals_non_none} | |||
\tKeyword names: {self.keyword_names}""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By not printing the captured names, we make debugging of scenarios with kwargs harder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Let me merge this change to unblock a model, and I will create a follow up PR to add the flattened keyword names as part of the InputInfo
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ORTModule
has support*args, **kwargs
since it was added earlier.ORTModule
also has support for nested lists and dictionaries.However, it does not support model inputs that are a part of
**kwargs
as well as aredict
s. This was probably not thought of as support needed earlier. A model that @frank-dong-ms has been working on needs this support.With this pull-request, ORTModule can successfully run such models.
contributors: @frank-dong-ms, @baijumeswani