Skip to content

Open-Sora: Democratizing Efficient Video Production for All

Python

Merge branch 'main' into dev/v1.0.1

Zangwei Zheng621da78e346a
diff --cc opensora/schedulers/iddpm/__init__.py
index 3147513,cb2d19b..11cf001
--- a/opensora/schedulers/iddpm/__init__.py
+++ b/opensora/schedulers/iddpm/__init__.py
@@@ -87,11 -86,11 +87,13 @@@ def forward_with_cfg(model, x, timestep
# https://github.com/openai/glide-text2im/blob/main/notebooks/text2im.ipynb
half = x[: len(x) // 2]
combined = torch.cat([half, half], dim=0)
+ if "x_mask" in kwargs and kwargs["x_mask"] is not None:
+ kwargs["x_mask"] = torch.cat([kwargs["x_mask"], kwargs["x_mask"]], dim=0)
model_out = model.forward(combined, timestep, y, **kwargs)
model_out = model_out["x"] if isinstance(model_out, dict) else model_out
- eps, rest = model_out[:, :3], model_out[:, 3:]
+ if cfg_channel is None:
+ cfg_channel = model_out.shape[1] // 2
+ eps, rest = model_out[:, :cfg_channel], model_out[:, cfg_channel:]
cond_eps, uncond_eps = torch.split(eps, len(eps) // 2, dim=0)
half_eps = uncond_eps + cfg_scale * (cond_eps - uncond_eps)
eps = torch.cat([half_eps, half_eps], dim=0)