使用 NVIDIA NeMo Automodel 與 🤗 Diffusers 大規模微調視訊與影像模型
重點摘要
本篇文章由 NVIDIA 與 Hugging Face 合作撰寫,感謝 Hugging Face 的 Sayak Paul 在整合工作上的貢獻及共同撰稿。Diffusion 模型驅動了過去兩年來最令人振奮的開源專案,例如用於文字生成影像的 FLUX.1-dev,以及用於文字生成視訊的 Wan 2.1 與 HunyuanVideo。🤗 Diffusers 程式庫已成為這些模型開發與部署的核心工具。本文將介紹如何結合 NVIDIA NeMo Automodel 與 🤗 Diffusers,實現大規模的視訊與影像模型微調,幫助企業級應用更有效率地客製化生成式 AI 模型。
Back to Articles Fine-tune video and image models at scale with NVIDIA NeMo Automodel and 🤗 Diffusers Enterprise + Article Published July 17, 2026 Upvote 1 Pranav Prashant Thombre pthombre Follow nvidia linnan wang linnanwang Follow nvidia Alexandros Koumparoulis akoumpa Follow nvidia Wenwen Gao wgao2021 Follow nvidia Sylendran Arunagiri Sylendran95 Follow nvidia Bernard Nguyen bernardwin Follow nvidia 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 1.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-DiffusersWan-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 black-forest-labs/FLUX.1-dev Text-to-Image 12B Yes FLUX.
2-dev black-forest-labs/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 Qwen/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 us
Related
相關文章

曝字節訓10億參數大模型,或超Mythos 5,張一鳴、梁汝波先後發聲
字節跳動正在訓練一個參數量高達10萬億的AI模型,規模可能超越Anthropic的Mythos 5。創辦人張一鳴在內部會議中強調編程的關鍵地位,並反對模型蒸餾,認為這只能複製而非超越對手。字節跳動在AI領域持續加大投入,同時在產品端與訓練端採取雙線進攻策略。

AI 需求擠爆雲計算,消息稱 AWS 要求工程師關閉閒置服務器減少資源浪費
因AI需求導致算力緊缺,亞馬遜AWS要求工程師關閉閒置的EC2實例,以減少資源浪費。數據顯示約65%的EC2實例在30天內平均CPU利用率低於20%,AWS因此升級計算優化器自動標記低使用率虛擬機。此外,AWS過去一年新增3.8吉瓦電力容量,仍難以應對GPU雲端實例的龐大需求。
使用 NVIDIA NeMo Retriever、託管 NIM、LanceDB、重新排序與基於事實生成建立多模態 RAG 管線
在本教學中,我們將使用 NVIDIA NeMo Retriever 建立一個先進的多模態檢索增強生成管線。首先設定 Python 3.12 環境、安裝必要套件,並在無需 GPU 或外部 API 金鑰的情況下進行離線 PDF 文字提取。接著,我們透過託管的 NVIDIA NIM 端點來偵測頁面元素、提取表格、圖表與資訊圖形、產生稠密向量嵌入,並將處理後的內容儲存至 LanceDB。最後,我們實作了稠密檢索、視覺語言重新排序、後設資料過濾搜尋、附行內引用的基於事實回應生成,以及輕量級的 recall-at-k 評估,以驗證跨多模態文件內容的檢索品質。
NVIDIA AI 推出 NOOA:將 AI 代理轉化為單一 Python 類別的物件導向框架
NVIDIA 實驗室開源了 NOOA(NVIDIA 物件導向代理),這是一個與模型無關的 Python 框架,用於建構 AI 代理。傳統的代理開發分散在提示模板、工具架構、回呼程式碼和工作流程圖中,而 NOOA 將所有這些整合到一個 Python 類別中:方法代表模型可採取的動作,欄位代表代理狀態,文件字串作為提示,型別註解則是執行時期強制執行的合約。主體為「...」的方法由 LLM 驅動的迴圈在執行時期完成,而具有正常主體的方法則保持確定性的 Python 程式碼。開發者與模型因此共享同一介面,使代理行為能像一般軟體一樣進行測試、追蹤、重構和版本控制。NVIDIA 報告在 SWE-bench Verified 上達到 82.2%,在 CyberGym L1 上達到 86.8%,平均 RHAE 為 85.1%。

六巨頭定AI插件新標準,撞臉Claude,Anthropic沒上桌
六大科技巨頭(AWS、Anysphere、GitHub、微軟、OpenAI、Vercel)聯合發布AI智能體插件統一開放規範Agent Plugins 1.0.0,旨在統一插件打包格式,減少開發者重複勞動。該規範的結構與Anthropic的Claude Code插件系統高度相似,但Anthropic並未參與制定,而是繼續經營自己的封閉生態。

DeepSeek重啟融資,三年市值對齊騰訊?
DeepSeek重啟第二輪融資,以5000億元人民幣估值尋求籌集80億美元,但網傳一份由小型醫藥私募發起的專項基金募資材料引發網友質疑,後經DeepSeek員工證實部分數據屬實。該公司近期宣布API大幅漲價,可能打破其以低價換規模的估值邏輯,面臨客戶流失風險。市場關注其能否從「價格屠夫」轉型為價值提供商,以及三年內市值能否對齊騰訊等巨頭。