mirror of
https://github.com/storytold/FineTrainers-Conditioning.git
synced 2026-10-09 00:09:45 +00:00
update README; remove print; make style
This commit is contained in:
@@ -30,6 +30,8 @@ huggingface-cli download \
|
||||
|
||||
Then launch LoRA fine-tuning. For CogVideoX and Mochi, refer to [this](./training/README.md) and [this](./training/mochi-1/README.md).
|
||||
|
||||
Note: It is recommended to use Pytorch 2.5.1 or above for training. Previous versions can lead to completely black videos, OOM errors, or other issues and are not tested.
|
||||
|
||||
<details>
|
||||
<summary> LTX Video </summary>
|
||||
|
||||
@@ -52,6 +54,8 @@ CAPTION_COLUMN="prompts.txt"
|
||||
VIDEO_COLUMN="videos.txt"
|
||||
OUTPUT_DIR="/path/to/output/directory/ltx-video/ltxv_disney"
|
||||
|
||||
ID_TOKEN="BW_STYLE"
|
||||
|
||||
# Model arguments
|
||||
model_cmd="--model_name ltx_video \
|
||||
--pretrained_model_name_or_path Lightricks/LTX-Video"
|
||||
@@ -60,7 +64,7 @@ model_cmd="--model_name ltx_video \
|
||||
dataset_cmd="--data_root $DATA_ROOT \
|
||||
--video_column $VIDEO_COLUMN \
|
||||
--caption_column $CAPTION_COLUMN \
|
||||
--id_token BW_STYLE \
|
||||
--id_token $ID_TOKEN \
|
||||
--video_resolution_buckets 49x512x768 \
|
||||
--caption_dropout_p 0.05"
|
||||
|
||||
@@ -99,7 +103,7 @@ optimizer_cmd="--optimizer adamw \
|
||||
--max_grad_norm 1.0"
|
||||
|
||||
# Validation arguments
|
||||
validation_cmd="--validation_prompts \"afkx A black and white animated scene unfolds with an anthropomorphic goat surrounded by musical notes and symbols, suggesting a playful environment. Mickey Mouse appears, leaning forward in curiosity as the goat remains still. The goat then engages with Mickey, who bends down to converse or react. The dynamics shift as Mickey grabs the goat, potentially in surprise or playfulness, amidst a minimalistic background. The scene captures the evolving relationship between the two characters in a whimsical, animated setting, emphasizing their interactions and emotions.@@@49x512x768:::A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage@@@49x512x768\" \
|
||||
validation_cmd="--validation_prompts \"$ID_TOKEN A black and white animated scene unfolds with an anthropomorphic goat surrounded by musical notes and symbols, suggesting a playful environment. Mickey Mouse appears, leaning forward in curiosity as the goat remains still. The goat then engages with Mickey, who bends down to converse or react. The dynamics shift as Mickey grabs the goat, potentially in surprise or playfulness, amidst a minimalistic background. The scene captures the evolving relationship between the two characters in a whimsical, animated setting, emphasizing their interactions and emotions.@@@49x512x768:::$ID_TOKEN A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage@@@49x512x768\" \
|
||||
--num_validation_videos 1 \
|
||||
--validation_steps 100"
|
||||
|
||||
@@ -221,6 +225,8 @@ CAPTION_COLUMN="prompts.txt"
|
||||
VIDEO_COLUMN="videos.txt"
|
||||
OUTPUT_DIR="/path/to/models/hunyuan-video/hunyuan-video-loras/hunyuan-video_cakify_500_3e-5_constant_with_warmup"
|
||||
|
||||
ID_TOKEN="afkx"
|
||||
|
||||
# Model arguments
|
||||
model_cmd="--model_name hunyuan_video \
|
||||
--pretrained_model_name_or_path hunyuanvideo-community/HunyuanVideo"
|
||||
@@ -229,8 +235,8 @@ model_cmd="--model_name hunyuan_video \
|
||||
dataset_cmd="--data_root $DATA_ROOT \
|
||||
--video_column $VIDEO_COLUMN \
|
||||
--caption_column $CAPTION_COLUMN \
|
||||
--id_token afkx \
|
||||
--video_resolution_buckets 17x512x768 49x512x768 61x512x768 129x512x768 \
|
||||
--id_token $ID_TOKEN \
|
||||
--video_resolution_buckets 17x512x768 49x512x768 61x512x768 \
|
||||
--caption_dropout_p 0.05"
|
||||
|
||||
# Dataloader arguments
|
||||
@@ -268,7 +274,7 @@ optimizer_cmd="--optimizer adamw \
|
||||
--max_grad_norm 1.0"
|
||||
|
||||
# Validation arguments
|
||||
validation_cmd="--validation_prompts \"afkx A baker carefully cuts a green bell pepper cake on a white plate against a bright yellow background, followed by a strawberry cake with a similar slice of cake being cut before the interior of the bell pepper cake is revealed with the surrounding cake-to-object sequence.@@@49x512x768:::afkx A cake shaped like a Nutella container is carefully sliced, revealing a light interior, amidst a Nutella-themed setup, showcasing deliberate cutting and preserved details for an appetizing dessert presentation on a white base with accompanying jello and cutlery, highlighting culinary skills and creative cake designs.@@@49x512x768:::afkx A cake shaped like a Nutella container is carefully sliced, revealing a light interior, amidst a Nutella-themed setup, showcasing deliberate cutting and preserved details for an appetizing dessert presentation on a white base with accompanying jello and cutlery, highlighting culinary skills and creative cake designs.@@@61x512x768:::afkx A vibrant orange cake disguised as a Nike packaging box sits on a dark surface, meticulous in its detail and design, complete with a white swoosh and 'NIKE' logo. A person's hands, holding a knife, hover over the cake, ready to make a precise cut, amidst a simple and clean background.@@@61x512x768:::afkx A vibrant orange cake disguised as a Nike packaging box sits on a dark surface, meticulous in its detail and design, complete with a white swoosh and 'NIKE' logo. A person's hands, holding a knife, hover over the cake, ready to make a precise cut, amidst a simple and clean background.@@@97x512x768:::afkx A vibrant orange cake disguised as a Nike packaging box sits on a dark surface, meticulous in its detail and design, complete with a white swoosh and 'NIKE' logo. A person's hands, holding a knife, hover over the cake, ready to make a precise cut, amidst a simple and clean background.@@@129x512x768:::A person with gloved hands carefully cuts a cake shaped like a Skittles bottle, beginning with a precise incision at the lid, followed by careful sequential cuts around the neck, eventually detaching the lid from the body, revealing the chocolate interior of the cake while showcasing the layered design's detail.@@@61x512x768:::afkx A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage@@@61x512x768\" \
|
||||
validation_cmd="--validation_prompts \"$ID_TOKEN A baker carefully cuts a green bell pepper cake on a white plate against a bright yellow background, followed by a strawberry cake with a similar slice of cake being cut before the interior of the bell pepper cake is revealed with the surrounding cake-to-object sequence.@@@49x512x768:::$ID_TOKEN A cake shaped like a Nutella container is carefully sliced, revealing a light interior, amidst a Nutella-themed setup, showcasing deliberate cutting and preserved details for an appetizing dessert presentation on a white base with accompanying jello and cutlery, highlighting culinary skills and creative cake designs.@@@49x512x768:::$ID_TOKEN A cake shaped like a Nutella container is carefully sliced, revealing a light interior, amidst a Nutella-themed setup, showcasing deliberate cutting and preserved details for an appetizing dessert presentation on a white base with accompanying jello and cutlery, highlighting culinary skills and creative cake designs.@@@61x512x768:::$ID_TOKEN A vibrant orange cake disguised as a Nike packaging box sits on a dark surface, meticulous in its detail and design, complete with a white swoosh and 'NIKE' logo. A person's hands, holding a knife, hover over the cake, ready to make a precise cut, amidst a simple and clean background.@@@61x512x768:::$ID_TOKEN A vibrant orange cake disguised as a Nike packaging box sits on a dark surface, meticulous in its detail and design, complete with a white swoosh and 'NIKE' logo. A person's hands, holding a knife, hover over the cake, ready to make a precise cut, amidst a simple and clean background.@@@97x512x768:::$ID_TOKEN A vibrant orange cake disguised as a Nike packaging box sits on a dark surface, meticulous in its detail and design, complete with a white swoosh and 'NIKE' logo. A person's hands, holding a knife, hover over the cake, ready to make a precise cut, amidst a simple and clean background.@@@129x512x768:::$ID_TOKEN A person with gloved hands carefully cuts a cake shaped like a Skittles bottle, beginning with a precise incision at the lid, followed by careful sequential cuts around the neck, eventually detaching the lid from the body, revealing the chocolate interior of the cake while showcasing the layered design's detail.@@@61x512x768:::$ID_TOKEN A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage@@@61x512x768\" \
|
||||
--num_validation_videos 1 \
|
||||
--validation_steps 100"
|
||||
|
||||
@@ -350,7 +356,7 @@ Training configuration: {
|
||||
| after epoch 1 | 39.748 | 40.910 |
|
||||
| after training end | 25.288 | 40.910 |
|
||||
|
||||
Note: requires about `59` GB of VRAM without precomputation.
|
||||
Note: requires about `59` GB of VRAM when validation is performed.
|
||||
|
||||
LoRA with rank 128, batch size 1, gradient checkpointing, optimizer adamw, `49x512x768` resolutions, **with precomputation**:
|
||||
|
||||
@@ -377,7 +383,7 @@ Training configuration: {
|
||||
| after validation end | 39.558 | 46.947 |
|
||||
| after training end | 24.842 | 41.039 |
|
||||
|
||||
Note: requires about `47` GB of VRAM with precomputation. If validation is not performed, the memory usage is reduced to about `42` GB.
|
||||
Note: requires about `47` GB of VRAM with validation. If validation is not performed, the memory usage is reduced to about `42` GB.
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@@ -60,7 +60,9 @@ class Args:
|
||||
# Training arguments
|
||||
training_type: str = None
|
||||
seed: int = 42
|
||||
mixed_precision: str = None # TODO: consider removing later https://github.com/a-r-r-o-w/finetrainers/pull/139#discussion_r1897438414
|
||||
mixed_precision: str = (
|
||||
None # TODO: consider removing later https://github.com/a-r-r-o-w/finetrainers/pull/139#discussion_r1897438414
|
||||
)
|
||||
batch_size: int = 1
|
||||
train_epochs: int = 1
|
||||
train_steps: int = None
|
||||
|
||||
@@ -520,7 +520,7 @@ class Trainer:
|
||||
)
|
||||
total_training_steps = self.state.train_steps * self.state.accelerator.num_processes
|
||||
num_warmup_steps = self.args.lr_warmup_steps * self.state.accelerator.num_processes
|
||||
|
||||
|
||||
if use_deepspeed_lr_scheduler:
|
||||
from accelerate.utils import DummyScheduler
|
||||
|
||||
@@ -714,7 +714,6 @@ class Trainer:
|
||||
loss = loss.mean(list(range(1, loss.ndim)))
|
||||
# Average loss across batch dimension
|
||||
loss = loss.mean()
|
||||
print(f"{self.transformer.dtype=}, {accelerator.mixed_precision=}")
|
||||
accelerator.backward(loss)
|
||||
|
||||
if accelerator.sync_gradients:
|
||||
|
||||
Reference in New Issue
Block a user