Skip to content

Open-Sora: Democratizing Efficient Video Production for All

Python

misc

Zangwei Zhenga445927680d0
diff --git a/configs/opensora-v1-1/inference/image.py b/configs/opensora-v1-1/inference/image.py
index 96d6783..4b2c645 100644
--- a/configs/opensora-v1-1/inference/image.py
+++ b/configs/opensora-v1-1/inference/image.py
@@ -1,7 +1,7 @@
num_frames = 1
fps = 24 // 3
# image_size = (1358, 680)
-image_size = (2160, 3840)
+image_size = (256, 256)
multi_resolution = "STDiT2"
# Define model
@@ -14,13 +14,13 @@ model = dict(
)
vae = dict(
type="VideoAutoencoderKL",
- from_pretrained="stabilityai/sd-vae-ft-ema",
+ from_pretrained="stabilityai/sdxl-vae",
micro_batch_size=4,
)
text_encoder = dict(
type="t5",
from_pretrained="DeepFloyd/t5-v1_1-xxl",
- model_max_length=120,
+ model_max_length=200,
)
scheduler = dict(
type="iddpm",
@@ -28,7 +28,7 @@ scheduler = dict(
cfg_scale=7.0,
cfg_channel=3, # or None
)
-dtype = "fp16"
+dtype = "bf16"
# Condition
prompt_path = "./assets/texts/t2v_samples.txt"
diff --git a/configs/opensora-v1-1/train/video.py b/configs/opensora-v1-1/train/video.py
index 3693cb8..e5098fc 100644
--- a/configs/opensora-v1-1/train/video.py
+++ b/configs/opensora-v1-1/train/video.py
@@ -10,7 +10,7 @@ dataset = dict(
bucket_config = { # 6s/it
"240p": {16: (1.0, 16), 32: (1.0, 8), 64: (1.0, 4), 128: (1.0, 2)},
"256": {1: (1.0, 256)},
- "512": {1: (1.0, 80)},
+ "512": {1: (0.5, 80)},
"480p": {1: (0.4, 52), 16: (0.4, 4), 32: (0.0, None)},
"720p": {16: (0.1, 2), 32: (0.0, None)}, # No examples now
"1024": {1: (0.3, 20)},
@@ -34,20 +34,21 @@ sp_size = 1
# Define model
model = dict(
type="STDiT2-XL/2",
- from_pretrained="PixArt-XL-2-1024-MS.pth",
+ # from_pretrained="PixArt-XL-2-1024-MS.pth",
+ from_pretrained="/home/zhaowangbo/zangwei/opensora/outputs/422-STDiT2-XL-2/epoch9-global_step192500/model_ckpt.pt",
input_sq_size=512, # pretrained model is trained on 512x512
enable_flashattn=True,
enable_layernorm_kernel=True,
)
vae = dict(
type="VideoAutoencoderKL",
- from_pretrained="stabilityai/sd-vae-ft-ema",
+ from_pretrained="stabilityai/sdxl-vae",
micro_batch_size=4,
)
text_encoder = dict(
type="t5",
from_pretrained="DeepFloyd/t5-v1_1-xxl",
- model_max_length=300,
+ model_max_length=200,
shardformer=True,
)
scheduler = dict(
diff --git a/tools/datasets/csvutil.py b/tools/datasets/csvutil.py
index 7c3ebdd..2c11f76 100644
--- a/tools/datasets/csvutil.py
+++ b/tools/datasets/csvutil.py
@@ -343,6 +343,7 @@ def parse_args():
# num_frames filtering
parser.add_argument("--fmin", type=int, default=None)
parser.add_argument("--fmax", type=int, default=None)
+ parser.add_argument("--hwmax", type=int, default=None)
# aesthetic filtering
parser.add_argument("--aesmin", type=float, default=None)
@@ -395,6 +396,8 @@ def get_output_path(args, input_name):
name += f"_fmin{args.fmin}"
if args.fmax is not None:
name += f"_fmax{args.fmax}"
+ if args.hwmax is not None:
+ name += f"_hwmax{args.hwmax}"
# aesthetic filtering
if args.aesmin is not None:
name += f"_aesmin{args.aesmin}"
@@ -541,6 +544,9 @@ def main(args):
if args.fmax is not None:
assert "num_frames" in data.columns
data = data[data["num_frames"] <= args.fmax]
+ if args.hwmax is not None:
+ assert "resolution" in data.columns
+ data = data[data["resolution"] <= args.hwmax]
if args.aesmin is not None:
assert "aes" in data.columns
data = data[data["aes"] >= args.aesmin]