Skip to content

Open-Sora: Democratizing Efficient Video Production for All

Python

[fix] pixart-sigma

zhengzangw7b08fb289ce9
diff --git a/configs/pixart/inference/1x2048MS.py b/configs/pixart/inference/1x2048MS.py
index 7859a69..42a7fa3 100644
--- a/configs/pixart/inference/1x2048MS.py
+++ b/configs/pixart/inference/1x2048MS.py
@@ -4,10 +4,13 @@ image_size = (2560, 1536)
# image_size = (2048, 2048)
model = dict(
- type="PixArt-Sigma-XL/2",
+ type="PixArt-XL/2",
+ from_pretrained="PixArt-Sigma-XL-2-2K-MS.pth",
space_scale=4,
no_temporal_pos_emb=True,
- from_pretrained="PixArt-Sigma-XL-2-2K-MS.pth",
+ enable_flashattn=True,
+ enable_layernorm_kernel=True,
+ base_size=2048 // 8,
)
vae = dict(
type="VideoAutoencoderKL",
diff --git a/opensora/models/pixart/pixart.py b/opensora/models/pixart/pixart.py
index 421f836..2451d91 100644
--- a/opensora/models/pixart/pixart.py
+++ b/opensora/models/pixart/pixart.py
@@ -133,6 +133,7 @@ class PixArt(nn.Module):
enable_flashattn=False,
enable_layernorm_kernel=False,
enable_sequence_parallelism=False,
+ base_size=None,
):
super().__init__()
assert enable_sequence_parallelism is False, "Sequence parallelism is not supported in this version."
@@ -146,7 +147,10 @@ class PixArt(nn.Module):
self.num_patches = num_patches
self.num_temporal = input_size[0] // patch_size[0]
self.num_spatial = num_patches // self.num_temporal
- self.base_size = int(np.sqrt(self.num_spatial))
+ if base_size is None:
+ self.base_size = int(np.sqrt(self.num_spatial))
+ else:
+ self.base_size = base_size // patch_size[1]
self.num_heads = num_heads
self.dtype = dtype
self.no_temporal_pos_emb = no_temporal_pos_emb