Skip to content

Commit

Permalink
style: modify code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
YingqingHe committed Jan 16, 2025
1 parent 653ca9e commit 14a4128
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 41 deletions.
6 changes: 3 additions & 3 deletions configs/001_videocrafter2/vc2_t2v_lora.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
model:
base_learning_rate: 6.0e-06 # 1.5e-04
scale_lr: False
# empty_params_only: True # disable this means finetuning all parameters
# empty_params_only: True # comment this means finetuning all parameters
target: src.base.ddpm3d.LVDMFlow
params:
lora_args:
# lora_ckpt: "/path/to/lora.ckpt" # first time training, no need; this is for resume training.
# lora_ckpt: "/path/to/lora.ckpt" # no need for the first-time training, only used for resume training.
target_modules: ["to_q", "to_k", "to_v"]
lora_rank: 4
lora_alpha: 1
Expand Down Expand Up @@ -127,7 +127,7 @@ lightning:
image_logger:
target: src.utils.callbacks.ImageLogger
params:
batch_frequency: 100000
batch_frequency: 1000
max_images: 2
to_local: True # save videos into files
log_images_kwargs:
Expand Down
40 changes: 21 additions & 19 deletions configs/004_cogvideox/cogvideo2b.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
model:
# there might be differet to load from hf and resume from pl
# pretrained_checkpoint: "THUDM/CogVideoX-2b"
base_learning_rate: 6e-6
target: src.cogvideo_hf.cogvideo_pl.CogVideoXWorkFlow
params:
# first stage model; cond stage model ; denoising model ; scheduler
# VAE of CogVideoX
first_stage_config:
target: diffusers.AutoencoderKLCogVideoX
params:
pretrained_model_name_or_path: checkpoints/cogvideo/CogVideoX-2b
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 config equal to unet config in vc

# Denosier model
denoiser_config:
target: diffusers.CogVideoXTransformer3DModel
params:
pretrained_model_name_or_path: checkpoints/cogvideo/CogVideoX-2b
subfolder: "transformer"
load_dtype: fp16 # bf16 5b fp16 2B
load_dtype: fp16 # bf16 5b / fp16 2B
# revision: null
# variant: null
adapter_config: # the whole dict is remoable
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"]

# 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"]

# sampler config. Wrap it.
# Diffusion sampling scheduler
scheduler_config:
target: diffusers.CogVideoXDPMScheduler
params:
pretrained_model_name_or_path: checkpoints/cogvideo/CogVideoX-2b
subfolder: scheduler

## training config
### data , can a toy dataset given
# data configs
data:
target: src.data.lightning_data.DataModuleFromConfig
params:
Expand All @@ -66,23 +68,23 @@ data:
cache_dir: ~/.cache
id_token: null

### training_step in cogvideoxft
# training configs
lightning:
trainer:
benchmark: True
num_nodes: 1
accumulate_grad_batches: 2
max_epochs: 2000
precision: 32 # training precision
precision: 32
callbacks:
image_logger:
target: src.utils.callbacks.ImageLogger
params:
batch_frequency: 100000
max_images: 2
to_local: True # save videos into files
to_local: True # save videos into local files
log_images_kwargs:
unconditional_guidance_scale: 12 # need this, otherwise it is grey
unconditional_guidance_scale: 6
metrics_over_trainsteps_checkpoint:
target: pytorch_lightning.callbacks.ModelCheckpoint
params:
Expand Down
40 changes: 21 additions & 19 deletions configs/004_cogvideox/cogvideo5b.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
model:
# there might be differet to load from hf and resume from pl
# pretrained_checkpoint: "THUDM/CogVideoX-2b"
base_learning_rate: 6e-6
target: src.cogvideo_hf.cogvideo_pl.CogVideoXWorkFlow
params:
# first stage model; cond stage model ; denoising model ; scheduler
# VAE of CogVideoX
first_stage_config:
target: diffusers.AutoencoderKLCogVideoX
params:
pretrained_model_name_or_path: checkpoints/cogvideo/CogVideoX-5b
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 config equal to unet config in vc

# Denosier model
denoiser_config:
target: diffusers.CogVideoXTransformer3DModel
params:
pretrained_model_name_or_path: checkpoints/cogvideo/CogVideoX-5b
subfolder: "transformer"
load_dtype: fp16 # bf16 5b fp16 2B
load_dtype: fp16 # bf16 5b / fp16 2B
# revision: null
# variant: null
adapter_config: # the whole dict is remoable
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"]

# 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"]

# sampler config. Wrap it.
# Diffusion sampling scheduler
scheduler_config:
target: diffusers.CogVideoXDPMScheduler
params:
pretrained_model_name_or_path: checkpoints/cogvideo/CogVideoX-5b
subfolder: scheduler

## training config
### data , can a toy dataset given
# data configs
data:
target: src.data.lightning_data.DataModuleFromConfig
params:
Expand All @@ -66,23 +68,23 @@ data:
cache_dir: ~/.cache
id_token: null

### training_step in cogvideoxft
# training configs
lightning:
trainer:
benchmark: True
num_nodes: 1
accumulate_grad_batches: 2
max_epochs: 2000
precision: 32 # training precision
precision: 32
callbacks:
image_logger:
target: src.utils.callbacks.ImageLogger
params:
batch_frequency: 100000
max_images: 2
to_local: True # save videos into files
to_local: True # save videos into local files
log_images_kwargs:
unconditional_guidance_scale: 12 # need this, otherwise it is grey
unconditional_guidance_scale: 6
metrics_over_trainsteps_checkpoint:
target: pytorch_lightning.callbacks.ModelCheckpoint
params:
Expand Down

0 comments on commit 14a4128

Please sign in to comment.