Open-Sora: Democratizing Efficient Video Production for All
Python
[exp] complete config
Zangwei Zhengc863c1d5e900
diff --git a/configs/opensora-v1-2/train/stage1-gc.py b/configs/opensora-v1-2/train/stage1-gc.pyindex f7e7430..eb73c2f 100644--- a/configs/opensora-v1-2/train/stage1-gc.py+++ b/configs/opensora-v1-2/train/stage1-gc.py@@ -4,22 +4,22 @@ dataset = dict(transform_name="resize_crop",frame_interval=1,)-bucket_config = { # 12s/it- "144p": {1: (1.0, 100)},+bucket_config = { # 20s/it+ "144p": {1: (1.0, 100), 51: (1.0, 30), 102: (1.0, 20), 204: (1.0, 8), 408: (1.0, 4)},# ---- "256": {1: (0.5, 100)},- "240p": {1: (0.5, 100)},+ "256": {1: (0.5, 100), 51: (0.3, 24), 102: (0.3, 12), 204: (0.3, 4), 408: (0.3, 2)},+ "240p": {1: (0.5, 100), 51: (0.3, 24), 102: (0.3, 12), 204: (0.3, 4), 408: (0.3, 2)},# ---- "360p": {1: (0.5, 60)},- "512": {1: (0.5, 60)},+ "360p": {1: (0.5, 60), 51: (0.3, 12), 102: (0.3, 6), 204: (0.3, 2), 408: (0.3, 1)},+ "512": {1: (0.5, 60), 51: (0.3, 12), 102: (0.3, 6), 204: (0.3, 2), 408: (0.3, 1)},# ---- "480p": {1: (0.5, 40)},+ "480p": {1: (0.5, 40), 51: (0.3, 6), 102: (0.3, 3), 204: (0.3, 1), 408: (0.0, None)},# ---- "720p": {1: (0.2, 20)},- "1024": {1: (0.1, 20)},+ "720p": {1: (0.2, 20), 51: (0.3, 2), 102: (0.3, 1), 204: (0.0, None)},+ "1024": {1: (0.1, 20), 51: (0.3, 2), 102: (0.3, 1), 204: (0.0, None)},# ---"1080p": {1: (0.1, 10)},- # ---+ # # ---"2048": {1: (0.1, 5)},}grad_checkpoint = True@@ -69,6 +69,20 @@ scheduler = dict(sample_method="logit-normal",)+# Mask settings+mask_ratios = {+ "mask_random": 0.4,+ "mask_intepolate": 0.01,+ "mask_quarter_random": 0.01,+ "mask_quarter_head": 0.01,+ "mask_quarter_tail": 0.01,+ "mask_quarter_head_tail": 0.01,+ "mask_image_random": 0.01,+ "mask_image_head": 0.01,+ "mask_image_tail": 0.01,+ "mask_image_head_tail": 0.01,+}+# Log settingsseed = 42outputs = "outputs"diff --git a/configs/opensora-v1-2/train/stage1.py b/configs/opensora-v1-2/train/stage1.pyindex e467240..605b4c7 100644--- a/configs/opensora-v1-2/train/stage1.py+++ b/configs/opensora-v1-2/train/stage1.py@@ -5,15 +5,15 @@ dataset = dict(frame_interval=1,)bucket_config = { # 2s/it- "144p": {1: (0.5, 48), 32: (1.0, 2), 48: (1.0, 4), 96: (1.0, 2), 192: (1.0, 1)},+ "144p": {1: (0.5, 48), 34: (1.0, 2), 51: (1.0, 4), 102: (1.0, 2), 204: (1.0, 1)},# ---- "256": {1: (0.6, 20), 32: (0.5, 2), 48: (0.5, 1), 64: (0.5, 1), 128: (0.0, None)},- "240p": {1: (0.6, 20), 32: (0.5, 2), 48: (0.5, 1), 64: (0.5, 1), 128: (0.0, None)},+ "256": {1: (0.6, 20), 34: (0.5, 2), 51: (0.5, 1), 68: (0.5, 1), 136: (0.0, None)},+ "240p": {1: (0.6, 20), 34: (0.5, 2), 51: (0.5, 1), 68: (0.5, 1), 136: (0.0, None)},# ---- "360p": {1: (0.5, 8), 32: (0.2, 1), 96: (0.0, None)},- "512": {1: (0.5, 8), 32: (0.2, 1), 96: (0.0, None)},+ "360p": {1: (0.5, 8), 34: (0.2, 1), 102: (0.0, None)},+ "512": {1: (0.5, 8), 34: (0.2, 1), 102: (0.0, None)},# ---- "480p": {1: (0.2, 4), 16: (0.3, 1), 64: (0.0, None)},+ "480p": {1: (0.2, 4), 17: (0.3, 1), 68: (0.0, None)},# ---"720p": {1: (0.1, 2)},"1024": {1: (0.1, 2)},@@ -41,7 +41,7 @@ model = dict(vae = dict(type="VideoAutoencoderPipeline",from_pretrained="pretrained_models/vae-v2",- micro_frame_size=16,+ micro_frame_size=17,vae_2d=dict(type="VideoAutoencoderKL",from_pretrained="PixArt-alpha/pixart_sigma_sdxlvae_T5_diffusers",@@ -69,18 +69,18 @@ scheduler = dict()# Mask settings-# mask_ratios = {-# "mask_random": 0.4,-# "mask_intepolate": 0.01,-# "mask_quarter_random": 0.01,-# "mask_quarter_head": 0.01,-# "mask_quarter_tail": 0.01,-# "mask_quarter_head_tail": 0.01,-# "mask_image_random": 0.01,-# "mask_image_head": 0.01,-# "mask_image_tail": 0.01,-# "mask_image_head_tail": 0.01,-# }+mask_ratios = {+ "mask_random": 0.4,+ "mask_intepolate": 0.01,+ "mask_quarter_random": 0.01,+ "mask_quarter_head": 0.01,+ "mask_quarter_tail": 0.01,+ "mask_quarter_head_tail": 0.01,+ "mask_image_random": 0.01,+ "mask_image_head": 0.01,+ "mask_image_tail": 0.01,+ "mask_image_head_tail": 0.01,+}# Log settingsseed = 42diff --git a/opensora/schedulers/rf/rectified_flow.py b/opensora/schedulers/rf/rectified_flow.pyindex 6ff2348..598165a 100644--- a/opensora/schedulers/rf/rectified_flow.py+++ b/opensora/schedulers/rf/rectified_flow.py@@ -14,14 +14,16 @@ def timestep_transform(base_num_frames=1,scale=1.0,num_timesteps=1,- temporal_reduction=4,):t = t / num_timesteps- # NOTE: temporal_reduction is hardcoded to 4, this should be equal to the temporal reduction factor of the vaeresolution = model_kwargs["height"] * model_kwargs["width"]ratio_space = (resolution / base_resolution).sqrt()# NOTE: currently, we do not take fps into account- num_frames = (model_kwargs["num_frames"] - 1) // temporal_reduction + 1+ # NOTE: temporal_reduction is hardcoded, this should be equal to the temporal reduction factor of the vae+ if model_kwargs["num_frames"][0] == 1:+ num_frames = torch.ones_like(model_kwargs["num_frames"])+ else:+ num_frames = model_kwargs["num_frames"] // 17 * 5ratio_time = (num_frames / base_num_frames).sqrt()ratio = ratio_space * ratio_time * scale