Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
53aaae8
update train
helloyongyang Aug 3, 2026
53ac25e
update
helloyongyang Aug 3, 2026
d49969e
Merge remote-tracking branch 'origin/main' into train_big_update
helloyongyang Aug 5, 2026
7b3385a
big refactor
helloyongyang Aug 10, 2026
7240239
Merge remote-tracking branch 'origin/main' into train_big_update
helloyongyang Aug 10, 2026
23b5925
fix ci
helloyongyang Aug 10, 2026
5aa7945
update
helloyongyang Aug 11, 2026
eb250fa
1
helloyongyang Aug 11, 2026
b6c2f26
Merge remote-tracking branch 'origin/main' into train_big_update
helloyongyang Aug 17, 2026
e3e2445
update minimax h3
helloyongyang Aug 17, 2026
3f69725
Merge remote-tracking branch 'origin/main' into train_big_update
helloyongyang Aug 17, 2026
b01487e
update cm
helloyongyang Aug 17, 2026
f7703b6
update
helloyongyang Aug 17, 2026
1afa84e
dopsd
helloyongyang Aug 17, 2026
537730e
ci
helloyongyang Aug 17, 2026
0fb2c11
update h3
helloyongyang Aug 18, 2026
e48e6aa
update
helloyongyang Aug 18, 2026
4894542
Merge remote-tracking branch 'origin/main' into train_big_update
helloyongyang Aug 18, 2026
b4fb439
update
helloyongyang Aug 18, 2026
95ab0c5
Merge remote-tracking branch 'origin/main' into train_big_update
helloyongyang Aug 21, 2026
a6990da
update qwen image edit
helloyongyang Aug 21, 2026
95f27b7
update
helloyongyang Aug 21, 2026
aa408b2
update image models
helloyongyang Aug 22, 2026
f67b59e
update dataset
helloyongyang Aug 23, 2026
922951c
Merge remote-tracking branch 'origin/main' into train_big_update
helloyongyang Aug 23, 2026
67eec1f
update longcat & remove cdm
helloyongyang Aug 23, 2026
fbf764b
update flux & remove native infer
helloyongyang Aug 23, 2026
fdc1717
update comment
helloyongyang Aug 23, 2026
474b06d
Add training cache
helloyongyang Aug 24, 2026
96f08a6
update
helloyongyang Aug 24, 2026
8980359
Merge remote-tracking branch 'origin/main' into train_big_update
helloyongyang Aug 24, 2026
e167ba6
remove fastwam
helloyongyang Aug 24, 2026
96e2dea
update cache
helloyongyang Aug 24, 2026
d3f20a7
update cache config
helloyongyang Aug 24, 2026
aee39e7
Merge remote-tracking branch 'origin/main' into train_big_update
helloyongyang Aug 24, 2026
8e0551a
fix
helloyongyang Aug 24, 2026
678f972
remove ltx
helloyongyang Aug 24, 2026
0d403ac
update video models
helloyongyang Aug 24, 2026
b870b6b
update video cache
helloyongyang Aug 24, 2026
39e1d21
remove wan 5b & remove opsd
helloyongyang Aug 24, 2026
dbacd7e
fix
helloyongyang Aug 24, 2026
2bebf9e
update
helloyongyang Aug 24, 2026
760166a
remove lightx2v deps
helloyongyang Aug 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
66 changes: 66 additions & 0 deletions lightx2v_train/cache_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import argparse

import torch
from loguru import logger

from lightx2v_train.data import build_data, build_sample_processor
from lightx2v_train.model_zoo import build_model
from lightx2v_train.runtime import (
cleanup_distributed,
init_distributed,
load_config,
setup_logger,
)
from lightx2v_train.trainers import build_trainer


def parse_args():
parser = argparse.ArgumentParser(description="Build a training dataset cache with LightX2V.")
parser.add_argument("--config", required=True, help="Path to a YAML config file.")
parser.add_argument("--output_dir", required=True, help="Directory for cache_data.jsonl and cached tensors.")
parser.add_argument("--save_dtype", choices=("bf16", "fp16", "fp32"), default="bf16")
parser.add_argument("--seed", type=int, default=0)
parser.add_argument("--overwrite", action="store_true")
return parser.parse_args()


def main():
args = parse_args()
config = load_config(args.config)
config["training_cache"] = {
"output_dir": args.output_dir,
"save_dtype": args.save_dtype,
"seed": args.seed,
"overwrite": args.overwrite,
}
config["data"]["train"]["preserve_records"] = True

torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
init_distributed(config)
setup_logger(config)

try:
sample_processor = build_sample_processor(config)
dataloader = build_data(config, train_or_val="train", sample_processor=sample_processor)

model = build_model(config)
model.load_components(
load_transformer=False,
load_vae=True,
load_condition_encoder=True,
)

trainer = build_trainer(config)
trainer.set_model(model)
trainer.set_data(dataloader)
trainer.train()
except Exception:
logger.exception("Training cache build failed")
raise
finally:
cleanup_distributed()


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ data:
name: prompt_dataset
data_path: /data/nvme5/gushiqiao/datatets/lingbot_video/vidprom_filtered_extended_first5k_auto_negative.jsonl
max_samples: 5
batch_size: 1
num_workers: 0
pin_memory: true
shuffle: false
Expand Down
50 changes: 50 additions & 0 deletions lightx2v_train/configs/infer/longcat_image_edit_lora.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
model:
name: longcat_image_edit
pretrained_model_name_or_path: /path/to/LongCat-Image-Edit
attention_backend: _native_flash
running_dtype: bf16

data:
processor:
target_area: 1048576 # 1024 * 1024
val:
name: image_dataset
num_workers: 4
shuffle: false
data_path:
- /path/to/LightX2V_train_data_examples/dataset_edit/val.jsonl

scheduler:
num_train_timesteps: 1000
timestep_distribution: logitnormal
logitnormal_mean: 0.0
logitnormal_std: 1.0
min_t: 0.001
max_t: 1.0
time_shift_settings:
do_time_shift: true
shift_type: exponential
time_shift_power: 1.0
dynamic_shift: true
patch_size: [2, 2]
shift_x1: 256
shift_x2: 4096
shift_y1: 0.5
shift_y2: 1.15

inference:
method: image_infer
negative_prompt: ""
default_width: 1024
default_height: 1024
num_inference_steps: 50
enable_cfg: true
cfg_guidance_scale: 4.5
seed: 42
output_dir: ./output_infer/longcat_image_edit_lora
lora_config:
path: /path/to/pytorch_lora_weights.safetensors

logging:
rank_zero_only: true
infer_log_every_steps: 10
75 changes: 0 additions & 75 deletions lightx2v_train/configs/infer/wan.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ data:
data_path:
- /path/to/prompts/wan_t2v_prompts.txt
max_samples: 1
batch_size: 1
num_workers: 0
shuffle: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ data:
data_path:
- /path/to/wan_t2v_prompts.txt
max_samples: 1
batch_size: 1
num_workers: 0
shuffle: false

Expand Down
87 changes: 0 additions & 87 deletions lightx2v_train/configs/infer/wan2_2_ti2v_5b_tf_ar.yaml

This file was deleted.

Loading
Loading