🚀 ltxvideo - disney
このプロジェクトは、Lightricks/LTX - Video をベースとしたLyCORISアダプターです。主に、スタイルが「Steamboat Willie」の白黒ディズニーシーンのビデオ生成に特化しています。
🚀 クイックスタート
このアダプターを使用することで、ベースモデルの性能を向上させ、特定のスタイルのビデオを生成できます。以下のセクションで、詳細な設定や使用方法を説明します。
✨ 主な機能
📚 ドキュメント
検証設定
- CFG:
3.8
- CFG Rescale:
0.0
- Steps:
25
- Sampler:
FlowMatchEulerDiscreteScheduler
- Seed:
42
- Resolution:
768x512
注意: 検証設定は 訓練設定 と必ずしも同じではありません。
訓練設定
- 訓練エポック数: 2666
- 訓練ステップ数: 8000
- 学習率: 5e - 05
- 学習率スケジュール: cosine
- ウォームアップステップ数: 400000
- 最大勾配値: 0.0
- 有効バッチサイズ: 24
- マイクロバッチサイズ: 8
- 勾配累積ステップ数: 1
- GPU数: 3
- 勾配チェックポイント: True
- 予測タイプ: flow - matching (追加パラメータ=['training_scheduler_timestep_spacing=trailing', 'inference_scheduler_timestep_spacing=trailing'])
- オプティマイザ: adamw_bf16
- 訓練可能パラメータ精度: Pure BF16
- ベースモデル精度:
int8 - quanto
- キャプションドロップアウト確率: 10.0%
LyCORIS設定
{
"bypass_mode": true,
"algo": "lokr",
"multiplier": 1.0,
"full_matrix": true,
"linear_dim": 10000,
"linear_alpha": 1,
"factor": 4,
"apply_preset": {
"target_module": [
"Attention",
"FeedForward"
],
"module_algo_map": {
"FeedForward": {
"factor": 4
},
"Attention": {
"factor": 2
}
}
}
}
データセット
disney - black - and - white
- 繰り返し回数: 0
- 画像総数: ~69
- アスペクトバケット総数: 1
- 解像度: 0.2304メガピクセル
- クロップ: False
- クロップスタイル: None
- クロップアスペクト: None
- 正則化データとしての使用: No
指数移動平均 (EMA)
SimpleTunerは、EMA重みのsafetensorsバリアントとptファイルを生成します。safetensorsファイルは推論に、ptファイルは追加の微調整に使用されます。EMAモデルは、よりバランスの取れた結果を提供する可能性がありますが、通常、モデル重みの減衰平均であるため、完全なモデルと比較して訓練不足に感じられることがあります。
💻 使用例
基本的な使用法
import torch
from diffusers import DiffusionPipeline
from lycoris import create_lycoris_from_weights
def download_adapter(repo_id: str):
import os
from huggingface_hub import hf_hub_download
adapter_filename = "pytorch_lora_weights.safetensors"
cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
os.makedirs(path_to_adapter, exist_ok=True)
hf_hub_download(
repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
)
return path_to_adapter_file
model_id = 'Lightricks/LTX-Video'
adapter_repo_id = 'bghira/ltxvideo-disney'
adapter_filename = 'pytorch_lora_weights.safetensors'
adapter_file_path = download_adapter(repo_id=adapter_repo_id)
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
lora_scale = 1.0
wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
wrapper.merge_to()
prompt = "A black and white disney scene in the style of Steamboat Willie"
negative_prompt = 'ugly, cropped, blurry, low-quality, mediocre average'
from optimum.quanto import quantize, freeze, qint8
quantize(pipeline.transformer, weights=qint8)
freeze(pipeline.transformer)
pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu')
model_output = pipeline(
prompt=prompt,
negative_prompt=negative_prompt,
num_inference_steps=25,
generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
width=768,
height=512,
guidance_scale=3.8,
).frames[0]
from diffusers.utils.export_utils import export_to_gif
export_to_gif(model_output, "output.gif", fps=25)
📄 ライセンス
ライセンスは other です。