[Transformer2DModel] Handle norm_type safely while remapping#8370
[Transformer2DModel] Handle norm_type safely while remapping#8370
norm_type safely while remapping#8370Conversation
|
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.
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.
I don't understand. What class is to be returned in this case?
There was a problem hiding this comment.
The original class. Why can this just not be
if remapped_class:
...
else:
return old_classThere was a problem hiding this comment.
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.
they don't need a warning here - they get the class they intended to use
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
* 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 <dhruv.nair@gmail.com> * remove extra stuff --------- Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
* 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 <dhruv.nair@gmail.com> * remove extra stuff --------- Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
What does this PR do?
See: #7647 (comment)