-
Notifications
You must be signed in to change notification settings - Fork 5.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
[Transformer2DModel] Handle norm_type
safely while remapping
#8370
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
else: | ||
input_norm_type = config["norm_type"] | ||
mappings = _CLASS_REMAPPING_DICT.get(previous_class_name) | ||
all_norm_types = list({k for k in mappings if "norm" in k}) | ||
logger.info( | ||
f"`{previous_class_name}` couldn't be mapped because `{input_norm_type}` isn't available" | ||
f" in the remappings. Available `norm_type`s: {all_norm_types}" | ||
) |
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.
Not sure we need to do this check if a remapping doesn't exist. Any specific reason why we can't just return the class?
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 don't understand. What class is to be returned in this case?
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.
The original class. Why can this just not be
if remapped_class:
...
else:
return old_class
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.
We are doing that only. Additionally, we're providing the user with some information via the warning. Do you think no need?
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.
they don't need a warning here - they get the class they intended to use
Co-authored-by: Dhruv Nair <[email protected]>
* handle norm_type of transformer2d_model safely. * log an info when old model class is being returned. * Apply suggestions from code review Co-authored-by: Dhruv Nair <[email protected]> * remove extra stuff --------- Co-authored-by: Dhruv Nair <[email protected]>
What does this PR do?
See: #7647 (comment)