-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14a4128
commit 91dde0e
Showing
11 changed files
with
1,008 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
model: | ||
base_learning_rate: 6e-6 | ||
target: src.cogvideo_hf.cogvideo_i2v.CogVideoXI2V | ||
params: | ||
noised_image_input: True | ||
noised_image_dropout: 0.05 | ||
# VAE of CogVideoX | ||
first_stage_config: | ||
target: diffusers.AutoencoderKLCogVideoX | ||
params: | ||
pretrained_model_name_or_path: checkpoints/cogvideo/CogVideoX-5b-I2V | ||
subfolder: "vae" | ||
|
||
# Text encoder (T5) of CogVideoX | ||
cond_stage_config: | ||
target: src.lvdm.modules.encoders.condition.FrozenT5Embedder | ||
params: | ||
version: "DeepFloyd/t5-v1_1-xxl" | ||
device: "cuda" | ||
max_length: 226 | ||
freeze: True | ||
|
||
# Denosier model | ||
denoiser_config: | ||
target: diffusers.CogVideoXTransformer3DModel | ||
params: | ||
pretrained_model_name_or_path: checkpoints/cogvideo/CogVideoX-5b-I2V | ||
subfolder: "transformer" | ||
load_dtype: fp16 # bf16 5b / fp16 2B | ||
# revision: null | ||
# variant: null | ||
|
||
# Lora module | ||
adapter_config: | ||
target: peft.LoraConfig | ||
params: | ||
r: 4 | ||
lora_alpha: 1.0 | ||
init_lora_weights: True | ||
target_modules: ["to_k", "to_q", "to_v", "to_out.0"] | ||
|
||
# Diffusion sampling scheduler | ||
scheduler_config: | ||
target: diffusers.CogVideoXDPMScheduler | ||
params: | ||
pretrained_model_name_or_path: checkpoints/cogvideo/CogVideoX-5b-I2V | ||
subfolder: scheduler | ||
|
||
# data configs | ||
# data: | ||
# target: src.data.lightning_data.DataModuleFromConfig | ||
# params: | ||
# batch_size: 2 | ||
# num_workers: 16 | ||
# wrap: false | ||
# train: | ||
# target: src.data.cogvideo_dataset.VideoDataset | ||
# params: | ||
# instance_data_root: inputs/data-cartoon-talk #"inputs/t2v/cogvideo/elon_musk_video" | ||
# dataset_name: null | ||
# dataset_config_name: null | ||
# caption_column: "labels.txt" | ||
# video_column: "videos.txt" | ||
# height: 480 | ||
# width: 720 | ||
# fps: 28 | ||
# max_num_frames: 2 | ||
# skip_frames_start: 0 | ||
# skip_frames_end: 0 | ||
# cache_dir: ~/.cache | ||
# id_token: null | ||
# image_to_video: true | ||
data: | ||
target: src.data.lightning_data.DataModuleFromConfig | ||
params: | ||
batch_size: 1 | ||
num_workers: 16 | ||
wrap: false | ||
train: | ||
target: src.data.datasets.DatasetFromCSV | ||
params: | ||
csv_path: temp/apply_lipstick.csv | ||
height: 480 | ||
width: 720 | ||
video_length: 49 | ||
frame_interval: 1 | ||
train: True | ||
image_to_video: true | ||
validation: | ||
target: src.data.datasets.DatasetFromCSV | ||
params: | ||
csv_path: temp/apply_lipstick.csv | ||
height: 480 | ||
width: 720 | ||
video_length: 49 | ||
frame_interval: 1 | ||
train: False | ||
image_to_video: true | ||
|
||
# training configs | ||
lightning: | ||
trainer: | ||
benchmark: True | ||
num_nodes: 1 | ||
accumulate_grad_batches: 2 | ||
max_epochs: 2000 | ||
precision: 32 | ||
callbacks: | ||
image_logger: | ||
target: src.utils.callbacks.ImageLogger | ||
params: | ||
batch_frequency: 100000 | ||
max_images: 2 | ||
to_local: True # save videos into local files | ||
log_images_kwargs: | ||
unconditional_guidance_scale: 6 | ||
metrics_over_trainsteps_checkpoint: | ||
target: pytorch_lightning.callbacks.ModelCheckpoint | ||
params: | ||
filename: "{epoch:06}-{step:09}" | ||
save_weights_only: False | ||
# every_n_epochs: 300 | ||
every_n_train_steps: 10 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
config=configs/004_cogvideox/cogvideo5b-i2v.yaml | ||
ckpt=results/train/cogvideox_i2v_5b/$YOUR_CKPT_PATH.ckpt | ||
prompt_dir=$YOUR_PROMPT_DIR | ||
|
||
current_time=$(date +%Y%m%d%H%M%S) | ||
savedir="results/inference/i2v/cogvideox-i2v-lora-$current_time" | ||
|
||
python3 scripts/inference_cogvideo.py \ | ||
--config $config \ | ||
--ckpt_path $ckpt \ | ||
--prompt_dir $prompt_dir \ | ||
--savedir $savedir \ | ||
--bs 1 --height 480 --width 720 \ | ||
--fps 16 \ | ||
--seed 6666 \ | ||
--mode i2v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export TOKENIZERS_PARALLELISM=false | ||
|
||
# dependencies | ||
CONFIG="configs/004_cogvideox/cogvideo5b-i2v.yaml" # experiment config | ||
|
||
# exp saving directory: ${RESROOT}/${CURRENT_TIME}_${EXPNAME} | ||
RESROOT="results/train" # experiment saving directory | ||
EXPNAME="cogvideox_i2v_5b" # experiment name | ||
CURRENT_TIME=$(date +%Y%m%d%H%M%S) # current time | ||
|
||
# run | ||
python scripts/train.py \ | ||
-t \ | ||
--base $CONFIG \ | ||
--logdir $RESROOT \ | ||
--name "$CURRENT_TIME"_$EXPNAME \ | ||
--devices '0,' \ | ||
lightning.trainer.num_nodes=1 \ | ||
--auto_resume |
Oops, something went wrong.