Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/diffusers/configuration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,20 @@ def extract_init_dict(cls, config_dict, **kwargs):
# use value from config dict
init_dict[key] = config_dict.pop(key)

unused_kwargs = config_dict.update(kwargs)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is always None -> fix here

config_dict = {k: v for k, v in config_dict.items() if not k.startswith("_")}

if len(config_dict) > 0:
logger.warning(
f"The config attributes {config_dict} were passed to {cls.__name__}, "
"but are not expected and will be ignored. Please verify your "
f"{cls.config_name} configuration file."
)

unused_kwargs = {**config_dict, **kwargs}

passed_keys = set(init_dict.keys())
if len(expected_keys - passed_keys) > 0:
logger.warning(
logger.info(
f"{expected_keys - passed_keys} was not found in config. Values will be initialized to default values."
)

Expand Down