-
Notifications
You must be signed in to change notification settings - Fork 30.7k
🚨 [v5] Rendundant code in nested configs #41314
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
base: main
Are you sure you want to change the base?
🚨 [v5] Rendundant code in nested configs #41314
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. |
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, happy to clean them up, they are not really useful indeed!
Let's just remove the logger.info
entries everywhere (I only flagged it once in the comments) at the same time!
semantic_config = {} | ||
logger.info("semantic_config is None. initializing the semantic model with default values.") | ||
semantic_config = BarkSemanticConfig() | ||
logger.info("`semantic_config` is `None`. Initializing the `BarkSemanticConfig` with default values.") |
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.
Let's remove those logs instead wdyt? One of the v5 goals is to have fewer and more informatives warnings and logs!
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.
oke, they are not super informative anyway
@property | ||
def sub_configs(self): | ||
sub_configs = {} | ||
backbone_config = getattr(self, "backbone_config", None) | ||
text_config = getattr(self, "text_config", None) | ||
if isinstance(backbone_config, PretrainedConfig): | ||
sub_configs["backbone_config"] = type(backbone_config) | ||
if isinstance(text_config, PretrainedConfig): | ||
sub_configs["text_config"] = type(self.text_config) | ||
return sub_configs |
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.
Was just removed by your other PR no? We should not add it again!
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.
yeah, the two PRs will conflict, I will merge the other first
What does this PR do?
This PR deletes
from_xxx_config
and similar methods from everywhere and instead ensures that the config init can accept subconfigs of all formats (dict or object)Along the way, I found that not all configs call super init in the end and thus they can't set recursively attn implementation on subconfigs. I added a test for it and fixed all cases