mirror of
https://github.com/storytold/FineTrainers-Conditioning.git
synced 2026-10-28 08:57:10 +00:00
readme updates + refactor (#14)
* refactor * update * update * Update README.md Co-authored-by: Sayak Paul <spsayakpaul@gmail.com> * Update README.md Co-authored-by: Sayak Paul <spsayakpaul@gmail.com> * address review comments part i * fix adapter name causing peft error * prompts -> prompt * update * add video * update --------- Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
This commit is contained in:
@@ -103,10 +103,10 @@ Requires the [🧨 Diffusers library](https://github.com/huggingface/diffusers)
|
||||
```py
|
||||
import torch
|
||||
from diffusers import CogVideoXPipeline
|
||||
from diffusers import export_to_video
|
||||
from diffusers.utils import export_to_video
|
||||
|
||||
pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5b", torch_dtype=torch.bfloat16).to("cuda")
|
||||
pipe.load_lora_weights("{repo_id}", weight_name="pytorch_lora_weights.safetensors", adapter_name=["cogvideox-lora"])
|
||||
pipe.load_lora_weights("{repo_id}", weight_name="pytorch_lora_weights.safetensors", adapter_name="cogvideox-lora")
|
||||
|
||||
# The LoRA adapter weights are determined by what was used for training.
|
||||
# In this case, we assume `--lora_alpha` is 32 and `--rank` is 64.
|
||||
@@ -462,34 +462,24 @@ def main(args):
|
||||
)
|
||||
|
||||
# Dataset and DataLoader
|
||||
if not args.video_reshape_mode:
|
||||
train_dataset = VideoDatasetWithResizing(
|
||||
data_root=args.data_root,
|
||||
dataset_file=args.dataset_file,
|
||||
caption_column=args.caption_column,
|
||||
video_column=args.video_column,
|
||||
max_num_frames=args.max_num_frames,
|
||||
id_token=args.id_token,
|
||||
height_buckets=args.height_buckets,
|
||||
width_buckets=args.width_buckets,
|
||||
frame_buckets=args.frame_buckets,
|
||||
load_tensors=args.load_tensors,
|
||||
random_flip=args.random_flip,
|
||||
)
|
||||
dataset_init_kwargs = {
|
||||
"data_root": args.data_root,
|
||||
"dataset_file": args.dataset_file,
|
||||
"caption_column": args.caption_column,
|
||||
"video_column": args.video_column,
|
||||
"max_num_frames": args.max_num_frames,
|
||||
"id_token": args.id_token,
|
||||
"height_buckets": args.height_buckets,
|
||||
"width_buckets": args.width_buckets,
|
||||
"frame_buckets": args.frame_buckets,
|
||||
"load_tensors": args.load_tensors,
|
||||
"random_flip": args.random_flip,
|
||||
}
|
||||
if args.video_reshape_mode is None:
|
||||
train_dataset = VideoDatasetWithResizing(**dataset_init_kwargs)
|
||||
else:
|
||||
train_dataset = VideoDatasetWithResizeAndRectangleCrop(
|
||||
video_reshape_mode=args.video_reshape_mode,
|
||||
data_root=args.data_root,
|
||||
dataset_file=args.dataset_file,
|
||||
caption_column=args.caption_column,
|
||||
video_column=args.video_column,
|
||||
max_num_frames=args.max_num_frames,
|
||||
id_token=args.id_token,
|
||||
height_buckets=args.height_buckets,
|
||||
width_buckets=args.width_buckets,
|
||||
frame_buckets=args.frame_buckets,
|
||||
load_tensors=args.load_tensors,
|
||||
random_flip=args.random_flip,
|
||||
video_reshape_mode=args.video_reshape_mode, **dataset_init_kwargs
|
||||
)
|
||||
|
||||
def collate_fn(data):
|
||||
|
||||
Reference in New Issue
Block a user