Skip to content

Conversation

zucchini-nlp
Copy link
Member

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

@HuggingFaceDocBuilderDev

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.

Copy link
Member

@Cyrilvallez Cyrilvallez left a 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.")
Copy link
Member

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!

Copy link
Member Author

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

Comment on lines +295 to +304
@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
Copy link
Member

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!

Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants