From 3e4a772ead837ec3361b9384ace4e54768edc731 Mon Sep 17 00:00:00 2001 From: yiyixuxu Date: Fri, 25 Apr 2025 19:43:38 +0200 Subject: [PATCH] fix --- src/diffusers/pipelines/modular_pipeline.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/diffusers/pipelines/modular_pipeline.py b/src/diffusers/pipelines/modular_pipeline.py index 5cd5221a76..ccaed29daa 100644 --- a/src/diffusers/pipelines/modular_pipeline.py +++ b/src/diffusers/pipelines/modular_pipeline.py @@ -1225,8 +1225,8 @@ class ModularLoader(ConfigMixin, PushToHubMixin): """ for name, module in kwargs.items(): - current_module = getattr(self, name, None) - + is_initialized = hasattr(self, name) + # update config based on the updated component spec component_spec = self.component_specs.get(name) if component_spec is None: @@ -1245,6 +1245,12 @@ class ModularLoader(ConfigMixin, PushToHubMixin): self.register_to_config(**register_dict) # set the component as attribute + # if it is not set yet, just set it and skip the warnings below + if not is_initialized: + setattr(self, name, module) + continue + + current_module = getattr(self, name, None) # skip if the component is already registered with the same object if current_module is module: logger.info(f"register_components: {name} is already registered with same object, skipping")