How to Set Up Open-Sora: Generate AI Videos on Your Own GPU
Step-by-step tutorial to install and run Open-Sora on your own hardware. From environment setup to generating your first AI video with the open-source text-to-video model.
Getting Started with Open-Sora: A Hands-On Tutorial
Ready to generate AI videos on your own hardware? This guide walks you through setting up Open-Sora from scratch. Whether you're a researcher experimenting with video diffusion or a developer building a video generation pipeline, you'll be creating clips in no time.
π Explore Open-Sora on Run This Ai
Docker Compose configs, system requirements, installation guides, and more β all in one place.
View Open-Sora Tool Page βPrerequisites
Before diving in, make sure your system meets these minimum requirements:
- GPU: NVIDIA GPU with at least 24GB VRAM (A100 40GB or H100 recommended for best performance; consumer cards like RTX 4090 work for shorter clips)
- RAM: 32GB+ system memory
- Storage: 100GB+ free disk space for model weights and output videos
- OS: Linux (Ubuntu 22.04 recommended) with CUDA 11.8+
- Python: 3.10 or later
Step 1: Clone the Repository
git clone https://github.com/hpcaitech/Open-Sora.git
cd Open-Sora
Step 2: Set Up the Environment
Create a Python virtual environment and install dependencies:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Step 3: Download Model Weights
Open-Sora provides pre-trained checkpoints on Hugging Face. Download the latest version:
# Download Open-Sora v2.0 weights
wget https://huggingface.co/hpcai-tech/Open-Sora/resolve/main/opensora-v2.0.pth
# Or use huggingface-cli
pip install huggingface_hub
huggingface-cli download hpcai-tech/Open-Sora opensora-v2.0.pth --local-dir ./checkpoints
Step 4: Generate Your First Video
With everything set up, you can now generate a video. The basic command takes a text prompt and produces an MP4:
python scripts/inference.py \
--prompt "A serene lake at sunset with mountains in the background, cinematic quality" \
--resolution 512x512 \
--num_frames 64 \
--output output/sunset_lake.mp4
Key parameters you can tune:
--resolution: Output dimensions (e.g., 512Γ512, 1024Γ576)--num_frames: Video length in frames. 64 frames β 2.6 seconds at 24fps--cfg_scale: Guidance scale β higher values follow the prompt more strictly--seed: Fixed seed for reproducible results
Tips for Better Results
Prompt engineering matters. Be descriptive and specific. Instead of "a dog running," try "a golden retriever sprinting across a grassy field on a sunny afternoon, shallow depth of field, 4K cinematic." The model responds remarkably well to cinematic terminology and detailed scene descriptions.
Start small, then scale up. Begin with lower resolutions (256Γ256) and fewer frames to iterate quickly on your prompts. Once you have a prompt you like, bump up the quality settings for the final render.
Batch generation. Generate multiple variations with different seeds to find the best output. Video generation is stochastic, and sometimes the 3rd or 5th attempt produces the magic.
π¬ Ready to Create with Open-Sora?
Get the complete setup guide, hardware requirements, and deployment instructions.
View Open-Sora Tool Page β