Thanks to visit codestin.com
Credit goes to github.com

Skip to content

πŸš€ High-performance digital human video generation with GPU acceleration. Dual-environment system (CPU/GPU) achieving 40% performance boost on NVIDIA RTX hardware. Docker-free Linux implementation with Gradio web interface and CLI tools for AI-powered face animation from audio input.

License

Notifications You must be signed in to change notification settings

agilealpha1/AiVideo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ HeyGem Digital Human - GPU Optimization Project

A high-performance digital human video generation application with GPU acceleration support for NVIDIA RTX series graphics cards.

GPU Status CUDA PyTorch Python

🎯 Project Overview

This project transforms a CPU-only digital human application into a dual-environment system supporting both CPU and GPU processing, achieving 40% performance improvement on NVIDIA RTX hardware.

Key Features

  • πŸš€ GPU Acceleration: CUDA 11.8 + PyTorch 2.0.1 optimization
  • πŸ”„ Dual Environment: CPU (stable) + GPU (performance) options
  • 🌐 Web Interface: Gradio-based UI with real-time processing
  • πŸ“± CLI Support: Command-line tools for batch processing
  • πŸ›‘οΈ Error Recovery: Graceful fallbacks and comprehensive error handling

πŸ“Š Performance Improvements

Metric CPU Version GPU Version Improvement
Audio Processing 8.75s 1.51s 82% faster
Total Processing 18.99s 11.71s 38% faster
Model Loading 15s 5s 67% faster

πŸ”§ Hardware Requirements

Minimum Requirements

  • OS: Linux Ubuntu 18.04+
  • Python: 3.8+
  • RAM: 8GB+
  • Storage: 10GB free space

GPU Requirements (Optional)

  • GPU: NVIDIA RTX 20/30/40 series
  • VRAM: 6GB+ recommended
  • CUDA: 11.8+ compatible drivers
  • Driver: NVIDIA 450.80.02+

πŸš€ Quick Start

1. Clone Repository

git clone https://github.com/agilealpha1/AiVideo.git
cd AiVideo

2. CPU Environment Setup (Stable)

# Create CPU environment
python -m venv venv
source venv/bin/activate

# Install CPU dependencies
pip install -r requirements_updated.txt

# Run CPU web interface
python app.py
# Access at: http://localhost:7860

3. GPU Environment Setup (Performance)

# Create GPU environment
python -m venv venv_gpu
source venv_gpu/bin/activate

# Install GPU-optimized PyTorch
pip install torch==2.0.1+cu118 torchaudio==2.0.2+cu118 torchvision==0.15.2+cu118 --index-url https://download.pytorch.org/whl/cu118

# Install other dependencies
pip install -r requirements_gpu_fixed.txt

# Additional required packages
pip install einops typeguard==2.13.3

# Run GPU web interface
python app_gpu.py
# Access at: http://localhost:7861

πŸ“‹ Usage Guide

Web Interface

  1. Upload Files: Audio (.wav) + Video (.mp4)
  2. Select Code: Processing identifier (default: 1004)
  3. Choose Environment:
    • CPU: http://localhost:7860 (stable)
    • GPU: http://localhost:7861 (faster)
  4. Process: Click "Process" button
  5. Download: Get generated video/audio files

Command Line

# CPU processing
source venv/bin/activate
python run.py --audio_path audio.wav --video_path video.mp4

# GPU processing
source venv_gpu/bin/activate
python run_gpu.py --audio_path audio.wav --video_path video.mp4 --gpu

# Force CPU mode in GPU environment
python run_gpu.py --audio_path audio.wav --video_path video.mp4 --cpu

πŸ—οΈ Project Structure

HeyGem-Linux-Python-Hack/
β”œβ”€β”€ πŸ“ CPU Environment
β”‚   β”œβ”€β”€ app.py                    # CPU web interface
β”‚   β”œβ”€β”€ run.py                   # CPU command line
β”‚   └── requirements_updated.txt # CPU dependencies
β”œβ”€β”€ πŸ“ GPU Environment  
β”‚   β”œβ”€β”€ app_gpu.py              # GPU web interface
β”‚   β”œβ”€β”€ run_gpu.py              # GPU command line
β”‚   └── requirements_gpu_fixed.txt # GPU dependencies
β”œβ”€β”€ πŸ“ Core Modules
β”‚   β”œβ”€β”€ service/                # Core processing logic
β”‚   β”œβ”€β”€ face_lib/              # Face detection/processing
β”‚   β”œβ”€β”€ landmark2face_wy/      # Neural network models
β”‚   └── y_utils/               # Utility functions
β”œβ”€β”€ πŸ“ Configuration
β”‚   β”œβ”€β”€ config/                # Application settings
β”‚   └── example/               # Sample input files
└── πŸ“ Documentation
    β”œβ”€β”€ README.md              # This file
    └── .gitignore            # Git exclusions

πŸ”§ Troubleshooting

Common Issues

CUDA Compatibility Error

RuntimeError: Unexpected error from cudaGetDeviceCount()

Solution: Use CPU environment or update NVIDIA drivers

Port Already in Use

OSError: Cannot find empty port in range: 7860-7860

Solution: Check for running processes:

ps aux | grep python
kill <process_id>  # If needed

Module Not Found Errors

ModuleNotFoundError: No module named 'einops'

Solution: Install missing packages:

pip install einops typeguard==2.13.3

Queue Timeout Warnings

_queue.Empty: timeout

Status: Non-critical - processing continues, files still generated

Performance Optimization

GPU Memory Issues

# Clear GPU cache
python -c "import torch; torch.cuda.empty_cache()"

Check GPU Status

nvidia-smi

πŸ§ͺ Testing

Verify Installation

# Test CUDA availability
python -c "import torch; print(f'CUDA: {torch.cuda.is_available()}')"

# Test web interface
curl http://localhost:7860  # CPU version
curl http://localhost:7861  # GPU version

Performance Benchmark

# Compare processing times
time python run.py --audio_path example/audio.wav --video_path example/video.mp4
time python run_gpu.py --audio_path example/audio.wav --video_path example/video.mp4 --gpu

πŸ“¦ Dependencies

Core Dependencies

  • torch>=2.0.1 - Deep learning framework
  • gradio>=4.44.1 - Web interface
  • opencv-python>=4.7.0 - Computer vision
  • numpy>=1.21.6,<1.23.0 - Numerical computing
  • scipy>=1.7.1,<1.8.0 - Scientific computing

GPU-Specific

  • torch==2.0.1+cu118 - CUDA-enabled PyTorch
  • onnxruntime-gpu==1.19.2 - GPU inference runtime
  • einops==0.8.1 - Tensor operations
  • typeguard==2.13.3 - Type checking

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push branch (git push origin feature/amazing-feature)
  5. Open Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Original HeyGem Digital Human team for the base application
  • @Holasyb918/HeyGem-Linux-Python-Hack - Docker-free Linux Python implementation
  • @duixcom/Duix.Heygem - Enhanced HeyGem implementation
  • NVIDIA for CUDA toolkit and GPU optimization guides
  • PyTorch team for GPU acceleration framework
  • Gradio team for the excellent web interface framework

πŸ“ž Support


⭐ Star this repository if it helped you optimize your digital human processing!

GPU Acceleration Demo

About

πŸš€ High-performance digital human video generation with GPU acceleration. Dual-environment system (CPU/GPU) achieving 40% performance boost on NVIDIA RTX hardware. Docker-free Linux implementation with Gradio web interface and CLI tools for AI-powered face animation from audio input.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •