翻篇收录说明
翻篇网页快照

How to Run NVIDIA Cosmos 3 on Local AI Devices Using Hugging Face Diffusers | NVIDIA Technical Blog

https://developer.nvidia.com/blog/how-to-run-nvidia-cosmos-3-on-local-ai-devices-using-hugging-face-diffusers/

最近抓取:2026-12-04 08:37:04(北京时间)

最近内容变化:2026-12-01 11:04:42(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Running video generation models locally can be challenging when model weights and intermediate data exceed available GPU memory. NVIDIA Cosmos 3 Nano is a world…

正文摘录

Simulation / Modeling / Design How to Run NVIDIA Cosmos 3 on Local AI Devices Using Hugging Face Diffusers Nov 24, 2026 By Atharva Joshi and Jibin Varghese Like Discuss (0) L T F R E AI-Generated Summary NVIDIA Cosmos 3 Nano is a world foundation model that generates videos from text, images, and other inputs to support physical AI development.The Cosmos-Framework offloading package enables running Cosmos 3 Nano on GPUs with as little as 12 GB of VRAM by storing model weights in system RAM and transferring them to the GPU as needed during generation.An FP8 checkpoint with native mixed precision reduces peak GPU memory usage while maintaining BF16 scaled dot-product attention for the attention layers.The adapter supports seven generation modalities including text-to-video, image-to-video, video-to-video, sound generation, action generation, and control-guided generation through the official Diffusers modular pipeline.Benchmark results across GeForce RTX 5070, 5080, 4090, and 5090 show pipeline latency and peak memory usage for each resolution and modality, with the RTX 5070 completing 720p text-to-video in 2,624.9 seconds at 9.94 GiB peak memory using BF16.Next StepsDownload the Cosmos 3 Nano checkpoint and its FP8 branch on Hugging Face.Find examples and code in the Cosmos-Framework offloading package.Review the Diffusers memory optimization guide for CPU offloading and the Cosmos 3 pipeline documentation for supported generation workflows. Powered by NVIDIA Nemotron. AI-generated content may summarize information incompletely. Verify important information. Learn more Running video generation models locally can be challenging when model weights and intermediate data exceed available GPU memory. NVIDIA Cosmos 3 Nano is a world foundation model that generates videos from text, images, and other inputs to support physical AI development. Learn more about NVIDIA Cosmos for physical AI. This tutorial walks you through how to run Cosmos 3 Nano on a GPU with as little as 12 GB of VRAM by storing most model weights in system RAM and transferring them to the GPU as needed. Using Hugging Face Diffusers, you’ll generate your first video, explore sound and additional input types, and use an FP8 checkpoint to further reduce memory requirements. This streaming adapter builds on top of the native group offloading approach from the Hugging Face library to enable generation on a smaller GPU. The tradeoff is that this requires increased system RAM use and PCIe transfers for a smaller GPU-memory requirement. Note that this approach does not provide interactive latency or stream weights directly from disk during inference. Step 1: Generate your first video Use an existing Linux environment with Python 3.12 and a CUDA-enabled PyTorch build compatible with your GPU. The tested consumer-GPU hosts had approximately 128 GB of system RAM; this is not a measured minimum. Clone Cosmos-Framework and install its standalone offloading package in your active environment. Run all examples and benchmark commands below from the package directory: git clone https://github.com/NVIDIA/cosmos-framework.git cd cosmos-framework/packages/diffusers-cpu-offloading uv pip install '.[benchmarks]' Pass the Hugging Face repository ID directly to build_pipeline. The first load downloads the checkpoint. Subsequent loads reuse cached files. Safety checking is enabled by default. import torch from cosmos3_streaming import StreamingConfig, build_pipeline device = "cuda:0" config = StreamingConfig(device=device) pipe = build_pipeline( "nvidia/Cosmos3-Nano", config=config, dtype=torch.bfloat16, ) With no revision argument, the BF16 load uses the repository’s default branch. The default configuration chooses appropriate memory-saving behavior automatically. Start with BF16 and PyTorch scaled dot-product attention (SDPA), the baseline used on all four tested GPUs. Set the video options This example generates 189 frames at 720p. For faster iteration on a 12 GB GPU, change height and width to 480 and 848, or 240 and 432. common_video_args = { "negative_prompt": "", "num_frames": 189, "height": 720, "width": 1280, "fps": 24.0, "num_inference_steps": 35, "guidance_scale": 6.0, "add_resolution_template": False, "add_duration_template": False, } Generate and save the video Next, generate and save the video using the following script: t2v = pipe( prompt='{"scene":"A robot arm working in a kitchen"}', generator=torch.Generator(device=device).manual_seed(123), output="videos", **common_video_args, ) # Save the returned video frames as an MP4 file: from diffusers.utils import export_to_video export_to_video(t2v, "cosmos3_t2v.mp4", fps=common_video_args["fps"]) Step 2: Offload weights storage The central idea is to store model weights in system RAM and use the GPU for computation. To run large models within tight VRAM limits, this execution model manages memory and compute across the CPU and GPU in four ways: Checkpoint weights that are not currently needed remain in system RAM, in BF16 or the checkpoint’s FP8 representation. The next transformer block is transferred to the GPU when required. Every matrix multiplication and attention operation runs on CUDA. The adapter manages memory for denoising, the variational autoencoder (VAE) that encodes and decodes video, and safety checking. With this approach, system RAM acts as the backing store for model weights. More demanding requests, including 720p Transfer on a 12 GB GPU, use an automatic lower-memory execution mode while keeping model computation on CUDA. Move weights from system RAM to the GPU Next, move weights from system RAM to the GPU. Figure 1 shows the path from checkpoint storage to GPU computation. Checkpoint files remain on disk between runs. During generation, system RAM is the backing store for weights that are not currently on the GPU. This is why a fast SSD helps with model loading, while sufficient system RAM and PCIe bandwidth matter during generation. Figure 1. Streaming model weights from system RAM to the GPU enables NVIDIA Cosmos 3 Nano generation without keeping the full model in GPU memory Reuse understanding context during generation Diffusers provides sequential, model-level, and group-level CPU offloading to move model components between CPU and GPU memory. The Cosmos adapter builds on those mechanisms and coordinates when the model’s understanding and generation pathways run. NVIDIA Cosmos 3, an open omnimodal world foundation model for physical AI, has two complementary pathways inside its transformer: The understanding pathway interprets the prompt and other conditioning inputs. These inputs remain fixed during generation. The generation pathway processes the evolving video, sound, or action representation at every denoising step while using the understanding result as context. The transformer contains both understanding and generation computation. With fixed conditioning and precision, the adapter prepares the understanding context once and reuses it during generation. If native FP8 precision changes during denoising, that context is refreshed to match. Video 1 shows how generation traverses the transformer blocks at each denoising step. A 35-step request runs denoising steps 1 through 35. Each step traverses 36 transformer blocks, indexed 0 through 35. After block 35, the scheduler updates the generation state and the next step starts at block 0. After the final denoising step, the pipeline decodes the output. Video 1. Learn how Cosmos 3 Nano streams weights from CPU to GPU Classifier-free guidance (CFG) in Hugging Face combines predictions with and without prompt conditioning at each denoising step. The adapter reuses each streamed block across these predictions instead of transferring its weights for each branch. Transfer can add a control branch, which the automatic low-memory mode handles through the same API. Keep the official Diffusers pipeline The adapter uses the official Diffusers modular pipeline for: Prompt processing Conditioning and latent preparation Sequence preparation The denoising loop and UniPC scheduler Masking and classifier-free guidance output handling VAE decode Safety checking Output conversion Manage memory across the complete request Block offloading alone is not enough for the complete Cosmos pipeline. The adapter applies the following behavior automatically. Reuse fixed understanding work With fixed precision, the understanding pathway runs once for fixed conditioning inputs and its context is reused during denoising. Stream generation blocks Transformer weights remain in system RAM until their block is needed. The active block moves to the GPU, performs its CUDA work for the current denoising step, and makes room for the next block. Guidance predictions share the same block placement whenever possible. Overlap transfers with computation When the GPU has enough headroom, the next block can begin moving while the current block computes. Larger workloads automatically use the safer lower-memory schedule. There is no user-facing transfer schedule to configure. Manage decoding and safety checks VAE processing and safety checking have different memory requirements from denoising. The adapter manages those phases separately and automatically uses memory-efficient VAE execution on constrained cards. Users do not choose device-specific tuning values. Handle larger Transfer requests Transfer Modality performs more guidance work than text-to-video (T2V) and image-to-video (I2V). At 720p on a 12 GB GPU, the adapter automatically selects a lower-memory execution mode. The full GeForce RTX 5070 modality results include its generation time and guardrail settings. Step 3: Generate other modalities ( sound, action, etc ) Reuse pipe, device, and common_video_args from Step 1 for the examples in this section. Replace the input image and video paths with your own files. The prompts are illustrative; use the benchmark scripts for the exact measured inputs. Video-only calls return a list