Fix VideoCraft “CUDA Out of Memory” (OOM) Errors
Encountering RuntimeError: CUDA out of memory. Tried to allocate 2.40 GiB while rendering AI video? Follow this step-by-step optimization blueprint to run VideoCraft smoothly on consumer GPUs with 8GB or 12GB VRAM.
Why Does VideoCraft Run Out of VRAM?
Unlike single-image diffusion models, video diffusion models must load spatial-temporal UNet attention weights, text encoders, and sequential video frame latents into GPU memory simultaneously. Without memory-saving flags, a standard 720p 24-frame generation requires over 14.2 GB of raw VRAM.
4 Proven Fixes for Low-VRAM VideoCraft Rendering
Enable Low VRAM Sequential Model Offloading
Add memory offloading arguments to your launch_args.json inside the ArtCraft root folder:
// config/launch_args.json
“enable_cpu_offload”: true,
“vae_slicing”: true,
“vae_tiling”: true,
“attention_mechanism”: “xformers”
Switch to FP8 (8-Bit Floating Point) Checkpoints
Standard FP16 model weights consume roughly 8.5 GB alone before processing frames. FP8 quantization reduces model size by 50% with near-zero visual degradation:
Render at 576p / 720p and Upscale with PhotoCraft
Directly rendering native 1080p video causes exponential quadratic scaling in attention memory. The recommended professional workflow is:
- Set VideoCraft native generation canvas to 768 × 432 or 848 × 480.
- Generate your motion sequence at 24 FPS.
- Send the exported video through ArtCraft's built-in Real-ESRGAN video upscaler to output crisp 1080p or 4K with minimal VRAM overhead.
VideoCraft Recommended Settings by GPU Hardware
| GPU Model | VRAM | Recommended Resolution | Required Flags |
|---|---|---|---|
| RTX 3060 Laptop / 4050 | 6 GB | 576p @ 16-24 frames | --lowvram --fp8 --cpu-offload |
| RTX 3070 / 4060 / 4060 Ti | 8 GB | 720p @ 24-32 frames | --medvram --xformers |
| RTX 3060 12GB / RTX 4070 | 12 GB | 720p / 1080p @ 32 frames | --xformers (Optimal) |
| RTX 3090 / 4090 / Cloud A10G | 24 GB | Full 1080p native @ 60 frames | Standard FP16 (No offloading) |
Frequently Asked Questions (FAQ)
What is the absolute minimum VRAM required to generate VideoCraft clips?
With FP8 quantization and model CPU offloading enabled, VideoCraft can render 720p 4-second video clips on 6GB VRAM (e.g., RTX 2060 / RTX 3060 Mobile). For comfortable 1080p generation without offloading penalties, 12GB+ VRAM (RTX 3060 12GB or RTX 4070) is recommended.
Why does VideoCraft crash right after generating the first 5 frames?
VideoCraft allocates temporal cross-attention layers after initial spatial frames are processed. If your GPU runs out of free memory during temporal stitching, the CUDA driver crashes with an unhandled OOM error. Enabling --medvram or --lowvram prevents this peak allocation.
Does CPU offloading significantly slow down video generation speeds?
Sequential CPU offload transfers weights across the PCIe bus between generation steps, introducing roughly a 15% to 25% render time penalty. However, it completely prevents out-of-memory crashes on 8GB VRAM cards.
How do I enable xFormers or FlashAttention on Windows?
Ensure PyTorch matches your CUDA version, then install xFormers via "pip install xformers" inside your ArtCraft Python virtual environment. Launch VideoCraft with the flag "--enable-xformers" in launch_args.json.