Skip to content

Open-Sora: Democratizing Efficient Video Production for All

Python

[hotfix] fix caption embedder (#3)

Hongxin Liuc0fe4b384c67
diff --git a/opensora/models/layers/blocks.py b/opensora/models/layers/blocks.py
index 4df738c..1f44f1f 100644
--- a/opensora/models/layers/blocks.py
+++ b/opensora/models/layers/blocks.py
@@ -23,7 +23,10 @@ import xformers.ops
from einops import rearrange
from timm.models.vision_transformer import Mlp
-from opensora.acceleration.communications import all_to_all, split_forward_gather_backward
+from opensora.acceleration.communications import (
+ all_to_all,
+ split_forward_gather_backward,
+)
from opensora.acceleration.parallel_states import get_sequence_parallel_group
approx_gelu = lambda: nn.GELU(approximate="tanh")
@@ -564,7 +567,8 @@ class CaptionEmbedder(nn.Module):
)
self.register_buffer(
"y_embedding",
- nn.Parameter(torch.randn(token_num, in_channels) / in_channels**0.5),
+ torch.randn(token_num, in_channels) / in_channels**0.5,
+ persistent=False,
)
self.uncond_prob = uncond_prob