Generate videos with identity reenactment (X-Nemo) and voice conversion (Seed-VC).
- User selects an identity (face + voice)
- User uploads their video (provides motion + speech content)
- System runs X-Nemo (face reenactment) + Seed-VC (voice conversion)
- Output: Video with the identity's face animated by user's motion, speaking with identity's voice
- Conda (Miniconda or Anaconda)
- CUDA-capable GPU (16GB+ VRAM recommended)
- Git for cloning repositories
# Clone main repository
git clone <this-repo-url> fred
cd fred
# Clone ML tool repositories
mkdir -p tools
git clone https://github.com/samarrik/x-nemo-inference tools/x-nemo-inference
git clone https://github.com/samarrik/seed-vc tools/seed-vc# Create conda environment with Python 3.10
conda create -n fred python=3.10 -y
conda activate fred
# Install PyTorch with CUDA (adjust CUDA version as needed)
# For CUDA 12.1:
conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=12.1 -c pytorch -c nvidia -y
# For CUDA 11.8:
# conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=11.8 -c pytorch -c nvidia -y
# Install all Python dependencies (includes ML packages)
pip install -r requirements-ml.txt
# Install Fred package
pip install -e .On cluster (module system):
module load FFmpegLocal installation:
# Ubuntu/Debian
sudo apt install ffmpeg
# macOS
brew install ffmpeg
# Conda (if not using system FFmpeg)
conda install ffmpeg -c conda-forge# Download HuggingFace models (SD Image Variations + Stable Video Diffusion)
python scripts/download_weights.pyThis downloads ~20GB of model weights to tools/x-nemo-inference/pretrained_weights/.
The X-NeMo specific weights (xnemo_*.pth) must be downloaded separately from the X-NeMo release:
- Visit the X-NeMo repository
- Download the following files to
tools/x-nemo-inference/pretrained_weights/:xnemo_denoising_unet.pthxnemo_reference_unet.pthxnemo_motion_encoder.pthxnemo_temporal_module.pth
tools/x-nemo-inference/pretrained_weights/
├── sd-image-variations-diffusers/ # Downloaded automatically
├── stable-video-diffusion-img2vid-xt/ # Downloaded automatically
│ └── vae/
├── xnemo_denoising_unet.pth # Manual download
├── xnemo_reference_unet.pth # Manual download
├── xnemo_motion_encoder.pth # Manual download
└── xnemo_temporal_module.pth # Manual download
Seed-VC weights are downloaded automatically from HuggingFace on first run.
Create folders in identities/ with face images and a voice sample:
identities/
├── Person One/
│ ├── photo1.jpg # Face images (.jpg, .png, .webp)
│ ├── photo2.jpg
│ └── voice.wav # Voice sample (.wav, .mp3, .flac) - 5-25 seconds
└── Person Two/
├── headshot.png
└── speaking.mp3
Requirements:
- Face images: Clear frontal face, good lighting, 512x512+ resolution
- Voice audio: 5-25 seconds of clear speech, minimal background noise
Verify identities are discovered:
python -c "from app.core.identities import list_identity_status; list_identity_status()"If you placed the tools in a different location, set environment variables:
export XNEMO_REPO_PATH=/path/to/x-nemo-inference
export SEEDVC_REPO_PATH=/path/to/seed-vc
export XNEMO_WEIGHTS_PATH=/path/to/x-nemo-inference/pretrained_weightsOr create a .env file in the fred directory.
python scripts/verify_setup.py# Activate environment
conda activate fred
# Load FFmpeg module (if on cluster)
module load FFmpeg # Skip if running locally with system FFmpeg
# Run GUI
python app/gui.pyOpen http://localhost:7860 in your browser.
# Terminal 1: API server
conda activate fred
module load FFmpeg # Skip if running locally
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000
# Terminal 2: Background worker
conda activate fred
module load FFmpeg # Skip if running locally
python -m app.workers.job_workerAPI available at http://localhost:8000
Complete setup script:
# 1. Clone repositories
git clone <this-repo> fred && cd fred
mkdir -p tools
git clone https://github.com/samarrik/x-nemo-inference tools/x-nemo-inference
git clone https://github.com/samarrik/seed-vc tools/seed-vc
# 2. Setup Python environment
conda create -n fred python=3.10 -y
conda activate fred
conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=12.1 -c pytorch -c nvidia -y
pip install -r requirements-ml.txt
pip install -e .
# 3. Install FFmpeg
# On cluster:
module load FFmpeg
# Or locally:
# sudo apt install ffmpeg # Ubuntu/Debian
# brew install ffmpeg # macOS
# 4. Download weights
python scripts/download_weights.py
# 5. Add identities to identities/ folder (see Step 5 above)
# 6. Run
python app/gui.py- Select Identity: Choose from discovered identities
- Select Face Image: Pick which face image to animate
- Upload Video: Your video provides motion + speech content
- Generate: Click to process (2-5 minutes typical)
- Download: Save the generated video
| Endpoint | Method | Description |
|---|---|---|
/api/identities |
GET | List available identities |
/api/identities/{id} |
GET | Get identity details |
/api/upload |
POST | Upload user video |
/api/jobs |
POST | Create processing job |
/api/jobs/{id}/progress |
GET | Poll job progress |
/api/jobs/{id} |
GET | Get job details |
/api/library |
GET | List completed jobs |
/health |
GET | Health check |
| Variable | Default | Description |
|---|---|---|
XNEMO_REPO_PATH |
./tools/x-nemo-inference |
Path to X-Nemo repo |
XNEMO_WEIGHTS_PATH |
{XNEMO_REPO_PATH}/pretrained_weights |
X-Nemo weights |
SEEDVC_REPO_PATH |
./tools/seed-vc |
Path to Seed-VC repo |
IDENTITIES_PATH |
./identities |
Identity assets folder |
SHARED_DATA_PATH |
./shared_data |
Uploads, temp, output |
DEVICE |
cuda |
cuda or cpu |
EXECUTION_MODE |
sequential |
sequential or parallel |
fred/
├── app/
│ ├── api/routes.py # REST API endpoints
│ ├── core/identities.py # Identity management (auto-discovery)
│ ├── db/ # Database models
│ ├── workers/
│ │ ├── job_worker.py # Background job processor
│ │ ├── xnemo_runner.py # X-Nemo subprocess wrapper
│ │ └── seedvc_runner.py # Seed-VC subprocess wrapper
│ ├── gui.py # Gradio GUI
│ └── main.py # FastAPI app
├── tools/ # ML tool repos (you clone these)
│ ├── x-nemo-inference/
│ └── seed-vc/
├── identities/ # Your identity assets
│ └── {Name}/
│ ├── *.jpg/png # Face images
│ └── *.wav/mp3 # Voice sample
├── shared_data/
│ ├── uploads/ # User uploaded videos
│ ├── temp/ # Processing temp files
│ └── output/ # Generated videos
├── scripts/
│ ├── verify_setup.py # Check your setup
│ └── run_gui.sh
└── pyproject.toml
┌─────────────────────────────────────────────────────────────┐
│ User Interface │
│ (Gradio GUI or REST API) │
└─────────────────────┬───────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Processing │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ X-Nemo │ │ Seed-VC │ │
│ │ (subprocess) │ │ (subprocess) │ │
│ │ │ │ │ │
│ │ User Video ──► │ │ User Audio ──► │ │
│ │ + Identity Face │ │ + Identity Voice│ │
│ │ ▼ │ │ ▼ │ │
│ │ Reenacted Video │ │ Converted Audio │ │
│ └────────┬────────┘ └────────┬────────┘ │
│ │ │ │
│ └───────────┬───────────────┘ │
│ ▼ │
│ FFmpeg Combine │
│ ▼ │
│ Final Output Video │
└─────────────────────────────────────────────────────────────┘
Activate the conda environment:
conda activate fredCheck PyTorch CUDA:
python -c "import torch; print(f'CUDA: {torch.cuda.is_available()}')"Reinstall PyTorch with correct CUDA version if needed.
Check that repos are cloned and paths are correct:
ls tools/x-nemo-inference/run_xnemo.py
ls tools/seed-vc/run_seedvc.pyIf in different location, set XNEMO_REPO_PATH and SEEDVC_REPO_PATH.
Each identity folder needs BOTH images AND audio:
python -c "from app.core.identities import list_identity_status; list_identity_status()"- Default
EXECUTION_MODE=sequentialruns models one at a time - Reduce video length or use
--max-frames - Need 16GB+ VRAM for comfortable processing
On cluster:
module load FFmpegLocal installation:
# Ubuntu/Debian
sudo apt install ffmpeg
# macOS
brew install ffmpeg
# Conda
conda install ffmpeg -c conda-forgeVerify FFmpeg is working:
ffmpeg -versionApache 2.0 for code. Model weights have their own licenses - check X-NeMo and Seed-VC repos.