Skip to content

Commit 429dace

Browse files
[Configuration] Better logging (#545)
* [Config] improve logging * finish
1 parent d7dcba4 commit 429dace

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/diffusers/configuration_utils.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,20 @@ def extract_init_dict(cls, config_dict, **kwargs):
289289
# use value from config dict
290290
init_dict[key] = config_dict.pop(key)
291291

292-
unused_kwargs = config_dict.update(kwargs)
292+
config_dict = {k: v for k, v in config_dict.items() if not k.startswith("_")}
293+
294+
if len(config_dict) > 0:
295+
logger.warning(
296+
f"The config attributes {config_dict} were passed to {cls.__name__}, "
297+
"but are not expected and will be ignored. Please verify your "
298+
f"{cls.config_name} configuration file."
299+
)
300+
301+
unused_kwargs = {**config_dict, **kwargs}
293302

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

0 commit comments

Comments
 (0)