[Refactor] Migrate existing pipelines to use SupportsComponentDiscovery for offload discovery (#3076)
Signed-off-by: Nick Cao <ncao@redhat.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
8fa0394d29
commit
e957d16f8d
43 files changed
+392
-66
No files matched your search
@@ -204,12 +204,6 @@ class ModelLevelOffloadBackend(OffloadBackend):
|
||||
return
|
||||
|
||||
modules = ModuleDiscovery.discover(pipeline)
|
||||
if not modules.dits:
|
||||
logger.warning("No DiT/transformer modules found, skipping model-level offloading")
|
||||
return
|
||||
if not modules.encoders:
|
||||
logger.warning("No encoder modules found, skipping model-level offloading")
|
||||
return
|
||||
|
||||
# Move encoders to GPU
|
||||
for enc in modules.encoders:
|
||||
@@ -229,6 +223,17 @@ class ModelLevelOffloadBackend(OffloadBackend):
|
||||
except Exception as exc:
|
||||
logger.warning("Failed to move resident module '%s' to GPU: %s", name, exc)
|
||||
|
||||
if not modules.dits:
|
||||
logger.warning("No DiT/transformer modules found, skipping model-level offloading")
|
||||
return
|
||||
|
||||
if not modules.encoders:
|
||||
# Nothing to swap against — move DiTs to GPU and skip hooks.
|
||||
for dit in modules.dits:
|
||||
dit.to(self.device)
|
||||
logger.warning("No encoder modules found, skipping model-level offloading")
|
||||
return
|
||||
|
||||
# Apply sequential offloading hooks
|
||||
apply_sequential_offload(
|
||||
dit_modules=modules.dits,
|
||||
|
||||
Reference in new issue
Block a user