NVIDIA NeMo と Diffusers で動画・画像モデルを大規模微調整
Hugging Face は NVIDIA の NeMo Automodel と Diffusers を統合し、大規模な画像・動画モデルの微調整を可能にする手法を発表した。
キーポイント
NeMo Automodel と Diffusers の統合
NVIDIA の大規模モデル管理ツールである NeMo Automodel と、Hugging Face の生成 AI ライブラリ Diffusers を組み合わせることで、効率的な微調整ワークフローを実現した。
スケーラブルな微調整の実現
この統合により、単一のモデルだけでなく、大規模な画像および動画生成モデルを組織的に微調整する能力が強化された。
マルチモーダル生成の効率化
テキストから画像・動画を生成するモデルの学習コストと時間を削減し、開発者がより迅速にドメイン固有のモデルを構築できる環境を提供する。
重要な引用
Fine-tune video and image models at scale with NVIDIA NeMo Automodel and 🤗 Diffusers
Hugging Face is announcing a method to fine-tune video and image models at scale by combining NVIDIA's NeMo Automodel with Hugging Face Diffusers.
影響分析・編集コメントを表示
影響分析
この発表は、生成 AI モデルの開発において、大規模な計算リソースを必要とする微調整作業をより民主化し、コスト効率を高める重要な一歩です。特に動画生成モデルのような計算集約的なタスクにおいて、開発サイクルの短縮と実用化の加速に寄与すると考えられます。
編集コメント
生成 AI の分野で、大規模モデルの微調整という専門的なタスクを、オープンソースライブラリと大手ベンダーのインフラがシームレスに連携して支援する動きは、開発者の負担軽減に直結します。特に動画生成のような計算コストの高い領域でのこの連携は、実用化の障壁を下げる重要な技術的進展と言えます。
NVIDIA と Hugging Face の共同投稿です。本稿の統合作業への貢献と共著者としての役割を果たした、Hugging Face の Sayak Paul 氏に特別なお礼を申し上げます。
ここ数年で最も注目を集めたオープンソースリリースの多くは、拡散モデル(Diffusion Models)によって支えられています。例えばテキストから画像を生成する FLUX.1-dev や、テキストから動画を生成する Wan 2.1、HunyuanVideo などです。これらのモデルは、推論(Inference)、適応、パイプラインの構築において研究者や開発者にとって単一かつ一貫したインターフェースを提供する 🤗 Diffusers ライブラリが事実上の標準プラットフォームとなっています。
さらに近年、拡散モデルのトレーニングやファインチューニング(微調整)も急増しています。これに伴い、1 つの GPU から数百個に及ぶ環境まで柔軟にスケールできる構成に加え、メモリ効率の良いシャード処理、潜在空間のキャッシュ化、マルチ解像度バケッティングをサポートするユーティリティが強く求められています。
これらの技術的ニーズに応えるため、私たちはオープンソースライブラリ「NVIDIA NeMo Automodel」を提供しています。本稿では、NVIDIA と Hugging Face の連携についてご紹介します。この連携により、Hugging Face Hub 上の Diffusers フォーマットに対応するあらゆるモデルに対して、チェックポイントの変換やモデルの書き換えを行わずに、本番環境で利用可能な分散拡散学習が可能になります。
この統合の詳細は Diffusers トレーニングガイド に記載されており、Apache 2.0 ライセンスの下で完全にオープンソースとして公開されています。
目次
- NeMo Automodel とは何か
- サポート対象の拡散モデル
- この連携がもたらす可能性
- フィンチューニングワークフローの概要
- データセットの事前エンコード
- 既存の FLUX YAML を用いた学習の実行
- 学習済みチェックポイントからの生成
- パフォーマンス
- その他のフィントゥーン/LoRA の事例
- 今日から試す
- 次回の予定:Pythonic なレシピ API
- リソース
NeMo Automodel とは何か
NeMo Automodel は、NVIDIA NeMo フレームワークの一部であるオープンソースの PyTorch DTensor ネイティブなトレーニングライブラリです。Diffusers エコシステムにとって重要な 2 つの設計原則に基づいて構築されています:
- Hugging Face ネイティブ対応。Hugging Face Hub 上の任意の Diffusers モデル ID を
pretrained_model_name_or_pathに指定するだけで、トレーニングを開始できます。NeMo Automodel は、モデル読み込みに Diffusers のモデルクラス(例:WanTransformer3DModel)を、生成には Diffusers のパイプライン(WanPipeline)を利用します。学習済みチェックポイントは、Diffusers エコシステム内へシームレスに往返可能です。
- 1 つのプログラムで、あらゆる規模に対応。レシピやトレーニングスクリプトは、あらゆるスケールのトレーニングに適するよう簡単に修正できます。並列処理はコードの書き換えではなく設定次第です。FSDP2、テンソル並列、エキスパート並列、コンテキスト並列、パイプライン並列を切り替えるには、モデルを書き換えるのではなく、設定宣言を変更するだけで済みます。
AutoModel は現在、フローマッチングモデルのみをサポートしています。内部ではトレーニング目的としてフローマッチングを採用し、潜在空間での学習(事前符号化された VAE 出力経由)とマルチ解像度のバケット型データローダーを活用してスループットを加速しています。
サポートされている拡散モデル
NeMo Automodel の統合には、以下のオープンソース拡散モデル向けのすぐに使える微調整レシピが同梱されています。このリストは、examples/diffusion/finetune ディレクトリに現在含まれるレシピを反映したものです。
| モデル | Hugging Face ID | タスク | パラメータ数 | LoRA レシピ |
|---|---|---|---|---|
| Wan 2.1 T2V 1.3B / 14B | Wan-AI/Wan2.1-T2V-1.3B-Diffusers Wan-AI/Wan2.1-T2V-14B-Diffusers | テキストから動画へ (Text-to-Video) | 13 億 (単一の 40GB A100 で動作可能) / 140 億 | あり |
Wan 2.2 T2V A14B
Wan-AI/Wan2.2-T2V-A14B-Diffusers
テキストから動画へ (Text-to-Video)
総パラメータ数 270 億(MoE 構造)、1 ステップあたりアクティブなパラメータは 140 億
対応なし
FLUX.1-dev
テキストから画像へ (Text-to-Image)
120 億
対応あり
FLUX.2-dev
テキストから画像へ (Text-to-Image)
320 億
対応あり
HunyuanVideo 1.5
hunyuanvideo-community/HunyuanVideo-1.5-Diffusers-720p_t2v
テキストから動画へ (Text-to-Video)
130 億
対応あり
Qwen-Image
テキストから画像へ (Text-to-Image)
200 億(MMDiT 構造)
対応あり
この連携で実現すること
Diffusers を利用するユーザーにとって、この連携による実利的なメリットは具体的な機能として明確です。
チェックポイントの変換が不要になります。Hugging Face Hub にある事前学習済みモデルの重み(weights)を、そのまま即座に使用できます。「トレーニング用フォーマット」に変換して、また別の形式に戻すといった手間もありません。微調整したチェックポイントは、推論用に DiffusionPipeline へ直接読み込めるし、共有のために再び Hub へアップロードすることも可能です。量子化やコンパイル、LoRA アダプタのカスタムサンプリ器等の周辺ツールも、そのまま動作し続けます。
新モデルサポートへの高速パス。
Diffusers に新しい拡散モデルが登場しても、NeMo Automodel で利用可能にするには、大規模な独自トレーニングスクリプトを作成する必要はありません。必要なのはデータ前処理ハンドラーとモデルアダプターという、小さくまとまったコード追加だけです。残りのレシピスタック(FSDP2、バケット化されたデータローディング、チェックポイント保存、生成処理)はそのまま流用でき、YAML で定義するワークフローも同じものが適用されます。
フル微調整とパラメータ効率の高い微調整の両方に対応。
フル微調整(Full Fine-tuning)と LoRA 方式の PEFT(Parameter-Efficient Fine-Tuning)のどちらもサポートしています。大規模クラスターで最大品質を目指す場合はフル微調整を、単一ノードで最大効率を求める場合は LoRA を選択可能です。どちらの場合も、同じレシピ構造で対応できます。
内蔵スクリプトを超えるスケーラブルなトレーニング。
NeMo Automodel は、FSDP2、テンソル並列、コンテキスト並列、パイプライン並列といったシャーディングスキームや、マルチノードオーケストレーション(現在は SLURM 対応、Kubernetes 対応は近日予定)、マルチ解像度バケット化などの機能を追加しています。これらの機能により、FLUX.1-dev(12B)や HunyuanVideo(13B)のような大規模モデルのトレーニングも可能になります。
微調整ワークフローの概要
ここでは、対応するモデルのいずれかをファインチューニングするための一般的なワークフローを解説します。
Automodel の推奨インストール方法は、NeMo Automodel Docker コンテナ(nvcr.io/nvidia/nemo-automodel:26.06)を使用することです。このコンテナには PyTorch、TransformerEngine、およびその他の CUDA 対応依存関係が事前にビルド済みで含まれています。
あるいは、pip3 install nemo-automodel またはソースコードからのインストール(pip3 install git+https://github.com/NVIDIA-NeMo/Automodel.git)も可能です。詳細なオプションについては、インストールガイド をご覧ください。
本ガイドでは、78 枚の ライダー・ウェイト・タロットデータセット 上で FLUX.1-dev のフルトランスフォーマーファインチューニングを行い、その結果得られたチェックポイントから画像を生成するまでの一連の流れを追います。
既存の YAML 設定ファイルを流用し、実行固有の設定はコマンドライン引数で上書きする形式を採用しているため、新規に設定ファイルを作成する必要はありません。
1. データセットの事前エンコード
拡散モデルのレシピでは、各トレーニングステップでソース画像を直接エンコードするのではなく、事前にキャッシュされた VAE の潜在表現(latents)とテキスト埋め込み(embeddings)を利用します。78 枚のライダー・ウェイト画像を Hugging Face からストリーミングし、利用可能なすべての GPU に前処理を分散して実行します。
uv run --locked --no-default-groups \
--extra diffusion \
--extra diffusion-media \
python -m tools.diffusion.preprocessing_multiprocess image \
--dataset_name multimodalart/1920-raider-waite-tarot-public-domain \
--dataset_media_column image \
--dataset_caption_column caption \
--dataset_streaming \
--max_images 78 \
--output_dir /cache/flux_tarot \
--processor flux \
--model_name black-forest-labs/FLUX.1-dev \
--max_pixels 245760
キャプションにはすでにトリガートークンが含まれています。このピクセル予算と、データセットの縦長アスペクト比を考慮すると、事前処理によってサンプルはショーケース実行で使われている 384×640 のバケットに割り当てられます。
画像トレーニング用の事前処理では、.pt キャッシュファイルとシャード化されたメタデータが生成されます:
/cache/flux_tarot/
├── 384x640/
│ ├── <hash1>.pt
│ └── ...
├── metadata_shard_0000.json
├── metadata.json
└── _hf_dataset/
└── images/
2. 既存の FLUX YAML を使ってトレーニングを開始する
examples/diffusion/finetune/flux_t2i_flow.yaml をそのまま使用します。この YAML ファイルには、FLUX.1-dev の選択、トランスフォーマー全体の微調整、FLUX flow-matching アダプターの適用、有効バッチサイズ 32、および 8 分割の FSDP2 が既に設定されています。
タロット特有のパスや設定は、コマンドラインのオーバーライドで指定します:
uv run --locked --no-default-groups --extra diffusion \
torchrun --nproc-per-node=8 \
examples/diffusion/finetune/finetune.py \
-c examples/diffusion/finetune/flux_t2i_flow.yaml \
--model.transformer_engine_fp8 false \
--data.dataloader.cache_dir /cache/flux_tarot \
--data.dataloader.base_resolution '[384,640]' \
--lr_scheduler.lr_decay_style constant \
--lr_scheduler.lr_warmup_steps 20 \
--step_scheduler.max_steps 200 \
--step_scheduler.ckpt_every_steps 50 \
--checkpoint.checkpoint_dir /tmp/flux_tarot/checkpoints/full \
--checkpoint.save_consolidated true \
--seed 2026
この実行により、ステップ数 50, 100, 150, 200 の時点でチェックポイントが生成されます。最終的なチェックポイントは epoch_66_step_199 というラベルで保存されますが、これはゼロベースの番号付けであるため、実際には完了した 200 ステップ目のオプティマイザの状態を表しています。
3. 微調整済みチェックポイントからの生成
既存の FLUX 生成用 YAML ファイルを利用し、model.checkpoint パラメータにトレーニングが完了したチェックポイントを指定します。
uv run --locked --no-default-groups --extra diffusion \
python examples/diffusion/generate/generate.py \
-c examples/diffusion/generate/configs/generate_flux.yaml \
--model.checkpoint /tmp/flux_tarot/checkpoints/full/epoch_66_step_199 \
--inference.height 640 \
--inference.width 384 \
--inference.prompts '["a trtcrd of an astronaut tending a rose garden on Mars, \"the gardener\""]' \
--output.output_dir /tmp/flux_tarot/generations/full/step_200 \
--seed 2026
学習したタロットスタイルを呼び出すには、trtcrd を含める必要があります。対照的な比較実験として、シードとシーンは固定しつつトリガーのみを外して実行します:
uv run --locked --no-default-groups --extra diffusion \
python examples/diffusion/generate/generate.py \
-c examples/diffusion/generate/configs/generate_flux.yaml \
--model.checkpoint /tmp/flux_tarot/checkpoints/full/epoch_66_step_199 \
--inference.height 640 \
--inference.width 384 \
--inference.prompts '["an astronaut tending a rose garden on Mars, \"the gardener\""]' \
--output.output_dir /tmp/flux_tarot/generations/control \
--seed 2026
結果
学習ステップ 200 において、トリガー付きの「宇宙飛行士」プロンプトは、要求された内容(火星でバラ園の手入れをする宇宙飛行士)を維持したまま、クリーム色・赤・黒を基調としたヴィンテージなパレット、太いインクによる輪郭線、フラットな色彩領域、経年劣化を感じさせる紙のトーン、寓話的なカード構成といった特徴を獲得します。一方、トリガーを外した場合の宇宙飛行士の画像は依然として写実的な写真のままです。これは、学習された効果がモデル全体を置き換えるものではなく、trtcrd に強く依存していることを示しています。
| プロンプト(シード) | ベースライン | 微調整済み(ステップ 200) |
|---|---|---|
| 火星でバラ園の手入れをする宇宙飛行士 (seed 2026) | image | image |
月明かりに照らされた火星の庭園にいる宇宙飛行士 (シード:2028)


二つの月のもとで苗木を植える宇宙飛行士 (シード:2029)


4. パフォーマンス
すべての測定は、NVIDIA H100 80GB GPU を 8 基搭載した 1 ノード環境で実施しました。結果は、安定状態にある 10 ステップのウィンドウを 3 回繰り返して得た平均値と標準偏差です。
テキストから画像へ — 512×512 (秒単位の比較)
| モデル | 学習方法 | パラレル処理 | GBS / LBS | ステップ時間 | 生成速度 (枚/秒) | GPU あたり生成速度 (枚/秒/GPU) | 最大使用メモリ (GPU あたり) |
|---|---|---|---|---|---|---|---|
| FLUX.1-dev | フル学習 | FSDP2 | 32 / 4 | 0.902 ± 0.039 秒 | 35.51 ± 1.55 | 4.44 ± 0.19 | 63.88 GiB |
| FLUX.1-dev | LoRA r64 | DDP | 48 / 6 | 0.894 ± 0.008 秒 | 53.73 ± 0.48 | 6.72 ± 0.06 | 67.43 GiB |
| Qwen-Image | フル学習 | FSDP2 | 40 / 5 | 0.974 ± 0.075 秒 | 41.21 ± 3.06 | 5.15 ± 0.38 | 53.55 GiB |
| Qwen-Image | LoRA r64 | DDP | 24 / 3 | 0.515 ± 0.006 秒 | 46.63 ± 0.54 | 5.83 ± 0.07 | 66.33 GiB |
テキストから動画へ — 512×512×49 フレーム
各サンプルは、49 フレームの動画クリップ 1 つです。
| モデル | 学習方法 | GBS / LBS | アクティベーションチェックポイント | ステップ時間 | 生成速度 (本/秒) | GPU あたり生成速度 (本/秒/GPU) | 最大使用メモリ (GPU あたり) |
|---|
Wan 2.1 1.3B
フル微調整
8 / 1
オフ
0.942 ± 0.038 秒
8.50 ± 0.35
1.06 ± 0.04
6.09 GiB
Wan 2.1 14B
フル微調整
8 / 1
オン
3.798 ± 0.017 秒
2.107 ± 0.006
0.263 ± 0.006
33.35 GiB
Wan 2.1 14B
LoRA r64
16 / 2
オン
7.585 ± 0.014 秒
2.110 ± 0.000
0.263 ± 0.000
24.07 GiB
Wan 2.2 A14B(高ノイズ)
フル微調整
8 / 1
オン
4.628 ± 0.031 秒
1.730 ± 0.010
0.217 ± 0.006
23.57 GiB
HunyuanVideo 1.5
フル微調整
8 / 1
オン
5.926 ± 0.046 秒
1.350 ± 0.010
0.170 ± 0.000
15.90 GiB
HunyuanVideo 1.5
LoRA r64
8 / 1
オン
5.575 ± 0.006 秒
1.433 ± 0.006
0.180 ± 0.000
10.58 GiB
測定詳細
- ハードウェア:H100(80GB HBM3)を 8 基、NVLink でフル接続。
- イメージデータセット:lambda/naruto-blip-captions(256 サンプルをキャッシュ)。
- ビデオデータセット:svjack/Lelouch_Vi_Britannia_FramePack_First_Last_Frame_Video_Captioned(112 サンプルをキャッシュ)。
- バッチ処理は drop_last=true で強制実行。
- チェックポイントの書き出しは無効化。
- ステップ時間は、データ読み込み、順伝播、逆伝播、勾配クリッピング、オプティマイザ、スケジューラの処理時間を合計したもの。
- メモリ使用量はピーク時の PyTorch CUDA アロケータの使用量であり、NVML で計測されるデバイス全体のメモリではありません。
その他の微調整・LoRA 事例
微調整と LoRA の結果は、NeMo Automodel がドメイン特化にどれほど強力かを示しています。例えば、Wan 2.1 モデルをジブリ映画の動画データセットで微調整したところ、出力スタイルが適応され、ベースラインと比較して花の外観に明確な変化が見られるようになりました。
*ベースライン:*
*ジブリ動画で微調整後:*
LoRA の使用による明確な影響も確認できました。Wan 2.1 にアダプターを適用すると、動画全体に特徴的なジブリ風のスタイルが現れ、特にキャラクターの目の表現にその効果が顕著でした。
*LoRA なし:*
*LoRA あり:*
FLUX.2 の事例を含め、これらの結果はユーザーが目的に応じて最適な選択を行えることを示しています。最高品質を求める場合はフルファインチューニングを、効率性を重視する場合は LoRA 方式の PEFT を採用することで、特定のスタイルドメインに特化した出力を実現できます。
今日から試せる
統合の詳細やその他のファインチューニング例については、NeMo Automodel ドキュメントをご覧ください。
今後の予定:Pythonic なレシピ API
YAML は再現性の高い設定ファイルとして優れており、特にチェックインやレビュー、再利用を重視するチームには適しています。しかし、プログラムからの制御が必要なケースも多々あります。
次回の NeMo Automodel リリースでは、拡散モデルのレシピを完全に型付けされた Pythonic な API としても公開する予定です。ユーザーは Python コードから直接、モデル構成、データセット、オプティマイザー、PEFT/LoRA、並列処理、チェックポイント、生成設定などを組み合わせて記述できるようになります。
この Pythonic なアプローチにより、既存のトレーニングコードやノートブック、実験ワークフローからレシピをより容易に利用可能にし、YAML によるクイックスタートパスと並行して、第一級クラスの Python インターフェースを提供します。
リソース
- NeMo Automodel GitHub
- Diffusion Fine-Tuning Guide(拡散モデルファインチューニングガイド)
- Diffusion Dataset Preparation(拡散モデル用データセット準備)
- トランスフォーマー(LLM/VLM)のファインチューニングにおける NeMo Automodel
原文を表示
*A joint post from NVIDIA and Hugging Face. Special thanks to Sayak Paul from Hugging Face for their contributions to the integration work and for co-authoring this blog.*
Diffusion models power some of the most exciting open-source releases of the last two years — such as FLUX.1-dev for text-to-image and Wan 2.1 and HunyuanVideo for text-to-video. The 🤗 Diffusers library has become the de facto home for these models, giving researchers and builders a single, consistent interface for inference, adaptation, and pipeline composition.
In addition, training and fine-tuning diffusion models are also on the rise, requiring utilities that offer memory-efficient sharding, latent caching, multiresolution bucketing, and configurations that scale gracefully from one GPU to hundreds.
To cater to these technical demands, we offer the NVIDIA NeMo Automodel open-source library. Today, we're highlighting the collaboration between NVIDIA and Hugging Face that brings production-grade, distributed diffusion training to any Diffusers-format model on the Hugging Face Hub — with no checkpoint conversion and no model rewrites for any new model. The integration is documented in the Diffusers training guide and is fully open source under Apache 2.0.
Table of contents
- What is NeMo Automodel?
- Supported diffusion models
- What this collaboration unlocks
- A look at the fine-tuning workflow
- Pre-encode the dataset
- 2. Launch training with the existing FLUX YAML
- 3. Generate from the fine-tuned checkpoint
- 4. Performance
- Other Finetuned/LoRA examples
- Try it today
- Coming next: Pythonic recipe APIs
- Resources
What is NeMo Automodel?
NeMo Automodel is an open-source PyTorch DTensor-native training library, part of the NVIDIA NeMo framework, built around two design principles that matter for the Diffusers ecosystem:
- Hugging Face native. Point pretrained_model_name_or_path at any Diffusers model ID on the Hub and start training. NeMo Automodel uses Diffusers model classes (e.g. WanTransformer3DModel) for loading and Diffusers pipelines (WanPipeline) for generation. Checkpoints round-trip cleanly back into the Diffusers ecosystem.
- One program, any scale. The recipes and training scripts can be easily modified to suit training at any scale. Parallelism is a configuration choice, not a code rewrite — switch between FSDP2, tensor parallel, expert parallel, context parallel, and pipeline parallel by declaring configurations, not rewriting models.
AutoModel currently supports flow-matching models only. Under the hood, it uses flow matching as the training objective, with latent-space training (via pre-encoded VAE outputs) and multiresolution bucketed dataloading to accelerate throughput.
Supported diffusion models
NeMo Automodel integration ships with ready-to-use fine-tuning recipes for the open diffusion models below. The list reflects the recipes currently in examples/diffusion/finetune.
Model
Hugging Face ID
Task
Parameters
LoRA recipe
Wan 2.1 T2V 1.3B / 14B
Wan-AI/Wan2.1-T2V-1.3B-Diffusers**Wan-AI/Wan2.1-T2V-14B-Diffusers
Text-to-Video
1.3B (fits on a single 40GB A100) / 14B
Yes
Wan 2.2 T2V A14B
Wan-AI/Wan2.2-T2V-A14B-Diffusers
Text-to-Video
27B total (MoE), 14B active per step
No
FLUX.1-dev
Text-to-Image
12B
Yes
FLUX.2-dev
Text-to-Image
32B
Yes
HunyuanVideo 1.5
hunyuanvideo-community/HunyuanVideo-1.5-Diffusers-720p_t2v
Text-to-Video
13B
Yes
Qwen-Image
Text-to-Image
20B (MMDiT)
Yes
What this collaboration unlocks
For Diffusers users, the practical gains break down into a few concrete capabilities.
No checkpoint conversion.** Pretrained weights from the Hub work out of the box. There's no separate "training format" to convert to, then convert back. Your fine-tuned checkpoint loads directly into a DiffusionPipeline for inference, or back to the Hub for sharing. Downstream tools — quantization, compilation, LoRA adapters, custom samplers — all keep working.
Fast path to new model support. When a new diffusion model lands in Diffusers, enabling it in NeMo Automodel takes a small, contained code addition — a data preprocessing handler and a model adapter — rather than a full custom training script. The rest of the recipe stack (FSDP2, bucketed dataloading, checkpointing, generation) carries over unchanged, and the same YAML-driven workflow applies.
Full and parameter-efficient fine-tuning. Both full fine-tuning and LoRA-style PEFT are supported, so you can choose between maximum quality (full FT on a large cluster) or maximum efficiency (LoRA on a single node). The same recipe structure handles both.
Scalable training that goes beyond what built-in scripts offer. NeMo Automodel adds sharding schemes such as FSDP2, tensor, context, and pipeline parallelisms, multi-node orchestration (SLURM today, Kubernetes coming), and multiresolution bucketing. These capabilities make training larger models like FLUX.1-dev (12B) and HunyuanVideo (13B) possible.
A look at the fine-tuning workflow
In this section, we walk through the typical workflow for fine-tuning any of the supported models. The recommended way to install Automodel is the NeMo Automodel Docker container (nvcr.io/nvidia/nemo-automodel:26.06), which ships with PyTorch, TransformerEngine, and other CUDA-compiled dependencies pre-built. Alternatively, install with pip3 install nemo-automodel or from source (pip3 install git+https://github.com/NVIDIA-NeMo/Automodel.git); see the installation guide for all options.
This guide walks through a full-transformer fine-tune of FLUX.1-dev on the 78-card Rider–Waite tarot dataset, then generating from the resulting checkpoint. It reuses the checked-in YAML configs and applies run-specific settings as command-line overrides, so no new config files are required.
1. Pre-encode the dataset
The diffusion recipe consumes cached VAE latents and text embeddings instead of encoding source images during every training step. Stream the 78 Rider–Waite images directly from Hugging Face and distribute preprocessing across all visible GPUs:
uv run --locked --no-default-groups \
--extra diffusion \
--extra diffusion-media \
python -m tools.diffusion.preprocessing_multiprocess image \
--dataset_name multimodalart/1920-raider-waite-tarot-public-domain \
--dataset_media_column image \
--dataset_caption_column caption \
--dataset_streaming \
--max_images 78 \
--output_dir /cache/flux_tarot \
--processor flux \
--model_name black-forest-labs/FLUX.1-dev \
--max_pixels 245760
The captions already contain the trtcrd trigger token. With this pixel budget and the dataset's portrait aspect ratio, preprocessing assigns the samples to the 384×640 bucket used by the showcase run.
For image training, preprocessing produces .pt cache files and sharded metadata:
/cache/flux_tarot/
├── 384x640/
│ ├── <hash1>.pt
│ └── ...
├── metadata_shard_0000.json
├── metadata.json
└── _hf_dataset/
└── images/
2. Launch training with the existing FLUX YAML
Use examples/diffusion/finetune/flux_t2i_flow.yaml directly. The YAML already selects FLUX.1-dev, full transformer fine-tuning, the FLUX flow-matching adapter, an effective batch size of 32, and eight-way FSDP2.
Supply the tarot-specific paths and settings as command-line overrides:
uv run --locked --no-default-groups --extra diffusion \
torchrun --nproc-per-node=8 \
examples/diffusion/finetune/finetune.py \
-c examples/diffusion/finetune/flux_t2i_flow.yaml \
--model.transformer_engine_fp8 false \
--data.dataloader.cache_dir /cache/flux_tarot \
--data.dataloader.base_resolution '[384,640]' \
--lr_scheduler.lr_decay_style constant \
--lr_scheduler.lr_warmup_steps 20 \
--step_scheduler.max_steps 200 \
--step_scheduler.ckpt_every_steps 50 \
--checkpoint.checkpoint_dir /tmp/flux_tarot/checkpoints/full \
--checkpoint.save_consolidated true \
--seed 2026
The run produces checkpoints at steps 50, 100, 150, and 200. The final checkpoint is labeled epoch_66_step_199; the label is zero-based even though it represents the completed 200th optimizer step.
3. Generate from the fine-tuned checkpoint
Use the existing FLUX generation YAML and point model.checkpoint at the complete training checkpoint:
uv run --locked --no-default-groups --extra diffusion \
python examples/diffusion/generate/generate.py \
-c examples/diffusion/generate/configs/generate_flux.yaml \
--model.checkpoint /tmp/flux_tarot/checkpoints/full/epoch_66_step_199 \
--inference.height 640 \
--inference.width 384 \
--inference.prompts '["a trtcrd of an astronaut tending a rose garden on Mars, \"the gardener\""]' \
--output.output_dir /tmp/flux_tarot/generations/full/step_200 \
--seed 2026
Include trtcrd to invoke the learned tarot style. For a control comparison, keep the seed and scene fixed but omit the trigger:
uv run --locked --no-default-groups --extra diffusion \
python examples/diffusion/generate/generate.py \
-c examples/diffusion/generate/configs/generate_flux.yaml \
--model.checkpoint /tmp/flux_tarot/checkpoints/full/epoch_66_step_199 \
--inference.height 640 \
--inference.width 384 \
--inference.prompts '["an astronaut tending a rose garden on Mars, \"the gardener\""]' \
--output.output_dir /tmp/flux_tarot/generations/control \
--seed 2026
Results
At step 200, the triggered astronaut prompts retain their requested content while acquiring a cream, red, and black vintage palette, heavy ink contours, flat color fields, aged-paper tones, and allegorical card composition. The untriggered astronaut remains photographic, demonstrating that the learned effect is substantially associated with trtcrd rather than replacing the base model globally.
Prompt (seed)
Baseline
Fine-tuned (step 200)
Astronaut tending a rose garden on Mars (seed 2026)


Astronaut in a moonlit garden on Mars (seed 2028)


Astronaut planting a sapling beneath two moons (seed 2029)


4. Performance
All measurements were collected on one node with 8× NVIDIA H100 80GB GPUs. Results are means ± sample standard deviation over three steady-state 10-step windows.
Text-to-image — 512×512(see if seconds can be aligned)
Model
Training
Parallelism
GBS / LBS
Step time
Images/s
Images/s/GPU
Peak allocated/GPU
FLUX.1-dev
Full
FSDP2
32 / 4
0.902 ± 0.039 s
35.51 ± 1.55
4.44 ± 0.19
63.88 GiB
FLUX.1-dev
LoRA r64
DDP
48 / 6
0.894 ± 0.008 s
53.73 ± 0.48
6.72 ± 0.06
67.43 GiB
Qwen-Image
Full
FSDP2
40 / 5
0.974 ± 0.075 s
41.21 ± 3.06
5.15 ± 0.38
53.55 GiB
Qwen-Image
LoRA r64
DDP
24 / 3
0.515 ± 0.006 s
46.63 ± 0.54
5.83 ± 0.07
66.33 GiB
Text-to-video — 512×512×49 frames
Each sample is one 49-frame video clip.
Model
Training
GBS / LBS
Activation checkpointing
Step time
Clips/s
Clips/s/GPU
Peak allocated/GPU
Wan 2.1 1.3B
Full
8 / 1
Off
0.942 ± 0.038 s
8.50 ± 0.35
1.06 ± 0.04
6.09 GiB
Wan 2.1 14B
Full
8 / 1
On
3.798 ± 0.017 s
2.107 ± 0.006
0.263 ± 0.006
33.35 GiB
Wan 2.1 14B
LoRA r64
16 / 2
On
7.585 ± 0.014 s
2.110 ± 0.000
0.263 ± 0.000
24.07 GiB
Wan 2.2 A14B, high-noise
Full
8 / 1
On
4.628 ± 0.031 s
1.730 ± 0.010
0.217 ± 0.006
23.57 GiB
HunyuanVideo 1.5
Full
8 / 1
On
5.926 ± 0.046 s
1.350 ± 0.010
0.170 ± 0.000
15.90 GiB
HunyuanVideo 1.5
LoRA r64
8 / 1
On
5.575 ± 0.006 s
1.433 ± 0.006
0.180 ± 0.000
10.58 GiB
Measurement details
- Hardware: 8× H100 80GB HBM3, fully NVLink-connected.
- Image dataset: lambda/naruto-blip-captions, 256 cached samples.
- Video dataset: svjack/Lelouch_Vi_Britannia_FramePack_First_Last_Frame_Video_Captioned, 112 cached samples.
- Full batches were enforced with drop_last=true.
- Checkpoint writes were disabled.
- Step time includes dataloading, forward, backward, gradient clipping, optimizer, and scheduler work.
- Memory is peak PyTorch CUDA allocator usage, not total NVML device memory.
Other Finetuned/LoRA examples
The results from fine-tuning and LoRA showcase the power of NeMo Automodel for domain specialization. For instance, fine-tuning the Wan 2.1 model on a Ghibli video dataset successfully adapted the output style, demonstrated by a noticeable change in a flower's appearance compared to the baseline.
*Baseline:*
*Finetuned on Ghibli's videos:*
We also observed the distinct impact of using LoRA, where applying the adapter to Wan 2.1 caused the video to adopt a characteristic Ghibli style, particularly visible in the highlighting of characters' eyes.
*No LoRA:*
*LoRA:*
These examples, including those for FLUX.2, confirm that users can achieve both maximum quality via full fine-tuning and maximum efficiency via LoRA-style PEFT, tailoring the output to specific stylistic domains.
Try it today
Learn more about the integration and find more fine-tuning examples in the NeMo Automodel documentation
Coming next: Pythonic recipe APIs
YAML is a strong fit for reproducible configuration, especially for teams that want files they can check in, review, and reuse, but many teams also need a programmatic interface.
In an upcoming NeMo Automodel release, we plan to surface the diffusion recipes through a fully typed Pythonic API as well. Users will be able to compose the same model, data, optimizer, PEFT/LoRA, parallelism, checkpointing, and generation pieces directly from Python.
The Pythonic path is intended to make the recipes easier to use from existing training code, notebooks, and experiment workflows, and to offer a first-class Pythonic interface alongside the YAML quick-start path.
Resources
- NeMo Automodel GitHub
- Diffusion Fine-Tuning Guide
- Diffusion Dataset Preparation
- NeMo Automodel for Transformers (LLM/VLM fine-tuning)
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み