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.

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.
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 of frames. Calls requesting sound or action return a mapping of the requested outputs.
Image-to-video
Condition generation on an image with image=.
from diffusers.utils import load_image
image = load_image("/path/to/conditioning_image.jpg")
i2v = pipe(
prompt='{"scene":"A vehicle approaches a rockfall on a coastal road"}',
image=image,
generator=torch.Generator(device=device).manual_seed(1111),
output="videos",
**common_video_args,
)
Video-to-video
Pass a source video and choose the conditioning frames for video-to-video (V2V) generation.
from diffusers.utils import load_video
source_video = load_video("/path/to/source_video.mp4")
v2v = pipe(
prompt='{"scene":"A robot pours liquid into a cup"}',
video=source_video,
condition_frame_indexes_vision=[0, 1],
condition_video_keep="first",
generator=torch.Generator(device=device).manual_seed(0),
output="videos",
**common_video_args,
)
Text-to-video with sound
Set enable_sound=True and include an audio description to generate video and sound together.
t2v_sound = pipe(
prompt=(
'{"scene":"A robot arm working in a kitchen",'
'"audio_description":"Soft servo whirring and a ceramic clink."}'
),
enable_sound=True,
generator=torch.Generator(device=device).manual_seed(0),
output=["videos", "sound", "sampling_rate"],
**common_video_args,
)
Image-to-video with sound
Combine the image input with enable_sound=True to generate both outputs.
i2v_sound = pipe(
prompt=(
'{"scene":"A vehicle travels along a coastal road",'
'"audio_description":"Road noise, wind, and distant waves."}'
),
image=image,
enable_sound=True,
generator=torch.Generator(device=device).manual_seed(0),
output=["videos", "sound", "sampling_rate"],
**common_video_args,
)
Action generation
Use CosmosActionCondition to select the action domain and provide the conditioning video.
from diffusers import CosmosActionCondition
action_result = pipe(
prompt="Put the pot to the left of the purple item.",
action=CosmosActionCondition(
mode="policy",
chunk_size=16,
domain_name="bridge_orig_lerobot",
resolution_tier=480,
video=load_video("/path/to/bridge_input.mp4"),
view_point="ego_view",
),
fps=5,
num_inference_steps=30,
guidance_scale=1.0,
use_system_prompt=False,
generator=torch.Generator(device=device).manual_seed(0),
output=["videos", "action"],
)
Control-guided generation
Pass a control video with the control_videos argument. Safety checking remains enabled in this example; the benchmark’s guardrails-off exception is documented with the results.
transfer = pipe(
prompt='{"scene":"Transform the input using edge guidance"}',
negative_prompt="",
control_videos={
"edge": load_video("/path/to/control_edge.mp4"),
},
num_frames=121,
height=720,
width=1280,
fps=30.0,
num_inference_steps=35,
guidance_scale=3.0,
control_guidance=1.5,
generator=torch.Generator(device=device).manual_seed(0),
output="videos",
)
Diffusers routes each call to the appropriate workflow and loads the required components through the same pipeline.
Step 4: Use the FP8 checkpoint
Use nvidia/Cosmos3-Nano with the FP8 branch for the dedicated FP8 checkpoint. From the same package directory, install the FP8 extra, which includes NVIDIA Model Optimizer, before loading the checkpoint:
uv pip install '.[benchmarks,fp8]'
Select the FP8 branch through the same Hub API by passing revision="fp8":
pipe = build_pipeline(
"nvidia/Cosmos3-Nano",
revision="fp8",
config=StreamingConfig(device="cuda:0"),
dtype=torch.bfloat16,
checkpoint_precision="fp8",
)
The adapter uses the checkpoint’s native Diffusers precision policy. W8A8 uses 8-bit weights and 8-bit activations. W8A16 reuses the stored 8-bit weights, dequantizes them for a linear operation, and uses 16-bit activations. The tested Nano video checkpoint selects W8A16 for the first three and last three denoising steps and W8A8 for the middle steps. Note that attention remains BF16 SDPA; the entire pipeline does not run in FP8.
Step 5: Choose a GPU and resolution
Use Table 1 to choose a starting resolution. The default configuration adapts automatically to the requested resolution, modality, and available GPU memory.
| GPU class | Recommended use |
|---|---|
| 12 GB | Start at 240p or 480p for iteration. Full 720p is supported, including Transfer, but can be substantially slower. |
| 16 GB | 480p is a practical iteration mode; 720p is supported with automatic memory management. |
| 24 GB | Full-resolution generation has more working room and is materially faster in the tested configuration. |
| 32 GB | Best measured consumer-GPU latency for the 720p BF16 workload. |
These are guidance ranges rather than fixed limits. Resolution, frame count, modality, checkpoint precision, available system RAM, and PCIe bandwidth all affect fit and runtime.
Step 6: Benchmark setup and results
The presented results cover text-to-video across four GeForce RTX cards and all seven generation modalities on the GeForce RTX 5070. Use Table 4 to estimate memory requirements and wait times. Hosts, software revisions, and safety settings can affect latency, so these single-run measurements are not a controlled GPU ranking or a multiseed BF16-versus-FP8 comparison.
Reproduce the benchmarks
From the package directory used in Step 1, run the BF16 and FP8 benchmarks separately to measure your system. These commands cover all seven modalities and three resolution tiers. Install the FP8 dependency from Step 4 before running the FP8 command.
python benchmarks/benchmark_bf16.py --output-dir artifacts/benchmark-bf16
python benchmarks/benchmark_fp8.py --output-dir artifacts/benchmark-fp8
The benchmark guide in benchmarks/README.md explains the pinned inputs, per-case logs, summary tables, --resume, and --preflight-only. Safety checks are enabled by default. Reproducing the labeled Transfer timings requires an explicit Transfer-only run with --transfer-without-guardrails. The FP8 runner records the exact checkpoint revision and uses the native Diffusers policy.
Test settings
The benchmark workloads use the bundled model-card inputs. Each saved video was checked for its output dimensions, frame count, and frame rate. Sound cases also produced WAV files, and Action cases produced action JSON. Table 2 lists the generation and timing settings.
| Control | BF16 T2V | RTX 5070 modalities |
|---|---|---|
| Output | 189 frames, 24 fps | 189 frames for video/sound; 17 for Action; 121 at 30 fps for Transfer |
| Resolution tiers | 432×240, 848×480, 1280×720 | 432×240, 848×480, 1280×720; action uses corresponding tiers |
| Denoising | 35 UniPC steps, CFG 6, seed 123 | 35 steps for video/sound/Transfer; 30 for Action; fixed per-modality inputs and seeds |
| Safety | Enabled | Enabled except the explicitly labeled guardrails-off Transfer rows |
| Timing | Pipeline call through returned frames | Pipeline call through returned modality tensors |
| Excluded | Construction, checkpoint loading, MP4 encoding | Construction, checkpoint loading, file encoding |
Tested hardware
Table 3 lists the tested GPUs. Each host had approximately 128 GB of system RAM. CPU offloading exchanges GPU memory pressure for system RAM use. The measured consumer-GPU hosts had approximately 128 GB of system RAM.
| GPU | Architecture | Compute capability | VRAM | System RAM |
|---|---|---|---|---|
| GeForce RTX 5070 | Blackwell GB205 | SM120 | 12 GB | 128 GB class |
| GeForce RTX 5080 | Blackwell GB203 | SM120 | 16 GB | 128 GB class |
| GeForce RTX 4090 | Ada AD102 | SM89 | 24 GB | 128 GB class |
| GeForce RTX 5090 | Blackwell GB202 | SM120 | 32 GB | 128 GB class |
Text-to-video results across RTX GPUs
Table 4 compares text-to-video measurements across RTX cards. Pipeline time includes prompt processing, understanding, denoising, VAE decode, and safety checking, but excludes checkpoint loading and MP4 encoding. The RTX 5070 entries also appear in the full modality results in Table 5.
| GPU | VRAM | Resolution | Precision | Pipeline latency | Peak device memory |
|---|---|---|---|---|---|
| RTX 5070 | 12,227 MiB | 1280×720 | BF16 SDPA | 2,624.9 s (43.75 min) | 9.94 GiB |
| RTX 5070 | 12,227 MiB | 848×480 | BF16 SDPA | 849.5 s (14.16 min) | 6.68 GiB |
| RTX 5070 | 12,227 MiB | 432×240 | BF16 SDPA | 207.6 s (3.46 min) | 4.30 GiB |
| RTX 5070 | 12,227 MiB | 1280×720 | Native mixed FP8, BF16 SDPA | 2,235.7 s (37.26 min) | 9.16 GiB |
| RTX 5070 | 12,227 MiB | 848×480 | Native mixed FP8, BF16 SDPA | 716.2 s (11.94 min) | 6.23 GiB |
| RTX 5070 | 12,227 MiB | 432×240 | Native mixed FP8, BF16 SDPA | 170.6 s (2.84 min) | 3.95 GiB |
| RTX 5080 | 16,303 MiB | 1280×720 | BF16 SDPA | 1,594.4 s (26.57 min) | 11.92 GiB |
| RTX 5080 | 16,303 MiB | 848×480 | BF16 SDPA | 569.3 s (9.49 min) | 6.87 GiB |
| RTX 5080 | 16,303 MiB | 432×240 | BF16 SDPA | 160.6 s (2.68 min) | 4.42 GiB |
| RTX 4090 | 23,028 MiB | 1280×720 | BF16 SDPA | 1,052.2 s (17.54 min) | 16.56 GiB |
| RTX 4090 | 23,028 MiB | 848×480 | BF16 SDPA | 422.6 s (7.04 min) | 7.52 GiB |
| RTX 4090 | 23,028 MiB | 432×240 | BF16 SDPA | 195.3 s (3.26 min) | 4.47 GiB |
| RTX 5090 | 32,607 MiB | 1280×720 | BF16 SDPA | 1,016.7 s (16.94 min) | 18.22 GiB |
| RTX 5090 | 32,607 MiB | 848×480 | BF16 SDPA | 282.4 s (4.71 min) | 7.88 GiB |
| RTX 5090 | 32,607 MiB | 432×240 | BF16 SDPA | 122.9 s (2.05 min) | 4.70 GiB |
Full modality results on RTX 5070
Table 5 lists full generations on the 12 GB RTX 5070 with a 128 GB-class host. Times are pipeline calls in seconds, excluding loading and file encoding; peaks are device-used GPU memory in GiB. FP8 uses the checkpoint’s native W8A16 first/last-three schedule and W8A8 middle steps. Prompt and output safety checks are enabled for both precisions except in the labeled Transfer rows.
| Modality | Output size | BF16 time (s) | BF16 peak (GiB) | FP8 time (s) | FP8 peak (GiB) |
|---|---|---|---|---|---|
| T2V | 432×240 | 207.6 | 4.30 | 170.6 | 3.95 |
| T2V | 848×480 | 849.5 | 6.68 | 716.2 | 6.23 |
| T2V | 1280×720 | 2,624.9 | 9.94 | 2,235.7 | 9.16 |
| I2V | 432×240 | 215.0 | 4.39 | 176.1 | 4.07 |
| I2V | 848×480 | 868.6 | 6.91 | 738.2 | 6.54 |
| I2V | 1280×720 | 2,655.3 | 10.84 | 2,269.1 | 10.66 |
| T2V with sound | 432×240 | 218.1 | 4.82 | 177.6 | 4.82 |
| T2V with sound | 848×480 | 864.8 | 6.78 | 731.5 | 6.32 |
| T2V with sound | 1280×720 | 2,647.7 | 11.06 | 2,256.0 | 10.92 |
| I2V with sound | 432×240 | 222.7 | 5.18 | 182.9 | 4.84 |
| I2V with sound | 848×480 | 876.3 | 6.91 | 745.3 | 6.55 |
| I2V with sound | 1280×720 | 2,675.3 | 10.85 | 2,284.3 | 10.67 |
| V2V | 432×240 | 214.4 | 4.38 | 176.0 | 4.07 |
| V2V | 848×480 | 867.1 | 7.36 | 738.6 | 7.00 |
| V2V | 1280×720 | 2,655.8 | 11.20 | 2,267.1 | 11.20 |
| Action | 320×240 | 50.8 | 3.59 | 37.3 | 3.35 |
| Action | 640×480 (480p tier) | 63.8 | 5.51 | 51.9 | 5.15 |
| Action | 640×480 (720p tier) | 65.9 | 8.06 | 54.3 | 7.69 |
| Transfer* | 432×240 | 269.0 | 3.85 | 208.4 | 3.52 |
| Transfer* | 848×480 | 1,234.2 | 7.84 | 1,027.7 | 7.49 |
| Transfer* | 1280×720 | 4,834.9 | 9.76 | 4,279.1 | 10.87 |
*Transfer produces 121 frames at 30 fps. Other video/sound rows produce 189 frames with 35 steps; Action produces 17 frames with 30 steps. Action 720p tier outputs 640×480, not 1280×720
Get started with Cosmos 3 Nano on GeForce RTX GPUs
Weight streaming enables you to experiment with NVIDIA Cosmos 3 Nano on RTX GPUs with as little as 12 GB of VRAM by storing model weights in system RAM while keeping computation on the GPU.
To get started, install the Cosmos-Framework offloading package and run the BF16 text-to-video example at 240p or 480p. Then explore image- and video-conditioned generation, sound, actions, and control inputs through the same Diffusers API. Try the FP8 checkpoint and use the included benchmarks to compare generation time and memory use on your hardware.
- Download 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.
- Join the community, open issues, and contribute to the Cosmos ecosystem on GitHub and Discord.