[Feat] Enable Layerwise CPU offloading for SD3.5, Ovis-Image, Nextstep_1, LongCat-Image (#2339)
Signed-off-by: Yuanheng Zhao <jonathan.zhaoyh@gmail.com> Signed-off-by: yuanheng <jonathan.zhaoyh@gmail.com>
This commit is contained in:
1 parent
b246617fe5
commit
8a55d3d01f
8 files changed
+20
-11
No files matched your search
@@ -582,6 +582,7 @@ class LongCatImageTransformer2DModel(nn.Module):
|
||||
"""
|
||||
|
||||
_repeated_blocks = ["LongCatImageTransformerBlock", "LongCatImageSingleTransformerBlock"]
|
||||
_layerwise_offload_blocks_attrs = ["transformer_blocks", "single_transformer_blocks"]
|
||||
|
||||
# Sequence Parallelism for LongCat (following diffusers' _cp_plan pattern)
|
||||
_sp_plan = {
|
||||
|
||||
@@ -114,6 +114,8 @@ class NextStepConfig(LlamaConfig):
|
||||
|
||||
|
||||
class NextStepModel(nn.Module):
|
||||
_layerwise_offload_blocks_attrs = ["layers"]
|
||||
|
||||
def __init__(self, config: NextStepConfig):
|
||||
super().__init__()
|
||||
self.config = config
|
||||
|
||||
@@ -366,6 +366,7 @@ class OvisImageTransformer2DModel(nn.Module):
|
||||
"""
|
||||
|
||||
_repeated_blocks = ["OvisImageTransformerBlock", "OvisImageSingleTransformerBlock"]
|
||||
_layerwise_offload_blocks_attrs = ["transformer_blocks", "single_transformer_blocks"]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
@@ -387,6 +387,7 @@ class SD3Transformer2DModel(nn.Module):
|
||||
"""
|
||||
|
||||
_repeated_blocks = ["SD3TransformerBlock"]
|
||||
_layerwise_offload_blocks_attrs = ["transformer_blocks"]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
Reference in new issue
Block a user