reposekdz/veo5

0

stars

2

commits

Python

primary language

Dec 16, 2025

updated

README

Advanced Multimodal AI System

A powerful, comprehensive multimodal AI system that provides state-of-the-art capabilities for text-to-image, text-to-video, image-to-video generation, and advanced enhancement features. Built with cutting-edge models and optimized for production use.

πŸš€ Features

Core Capabilities

  • Text-to-Image Generation: SDXL, SD3, Flux, Playground V2.5, Kandinsky 3
  • Text-to-Video Generation: ZeroScope, ModelScope, AnimateDiff, CogVideoX, LaVie
  • Image-to-Video Generation: Stable Video Diffusion, I2VGen-XL, DynamiCrafter, ConsistI2V
  • Image Enhancement: RealESRGAN, GFPGAN, SwinIR, CodeFormer, BSRGAN
  • Video Enhancement: BasicVSR++, RealBasicVSR, EDVR, TDAN

Advanced Features

  • ControlNet Integration: Canny, Depth, Pose, Scribble, Segmentation, Normal, MLSD, HED
  • Face Enhancement: Specialized face restoration and enhancement
  • Temporal Consistency: Advanced video processing with frame coherence
  • Motion Control: Sophisticated motion generation and interpolation
  • Batch Processing: Parallel processing of multiple tasks
  • Workflow System: Multi-step automated pipelines
  • Memory Optimization: Intelligent model loading and GPU memory management
  • Async Processing: Non-blocking API with task queues

πŸ› οΈ Installation

Prerequisites

  • Python 3.8+
  • CUDA 11.8+ (for GPU acceleration)
  • 16GB+ RAM (32GB+ recommended)
  • 50GB+ free disk space

Quick Install

git clone <repository-url>
cd veo5
pip install -r requirements.txt

Docker Installation

docker build -t multimodal-ai .
docker run --gpus all -p 8000:8000 multimodal-ai

🎯 Quick Start

Command Line Interface

# Run full demonstration
python main.py --demo

# Create training datasets
python main.py --create-datasets

# Start API server
python main.py --api

# Setup directories only
python main.py --setup

Python API

from core.multimodal_ai import MultimodalAI

# Initialize system
ai = MultimodalAI(device="cuda")

# Generate image
result = ai.text_to_image(
    prompt="a majestic dragon flying over a cyberpunk city",
    model="sdxl",
    width=1024,
    height=1024,
    enhance=True
)

# Generate video
result = ai.text_to_video(
    prompt="waves crashing on a rocky shore at sunset",
    model="zeroscope",
    num_frames=24,
    fps=8
)

# Image to video
result = ai.image_to_video(
    image="path/to/image.jpg",
    model="stable_video",
    num_frames=25
)

# Enhance image
result = ai.enhance_image(
    image="path/to/image.jpg",
    model="realesrgan",
    scale=4,
    face_enhance=True
)

REST API

# Start server
python main.py --api

# Generate image
curl -X POST "http://localhost:8000/generate/text-to-image" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a beautiful landscape",
    "model": "sdxl",
    "width": 1024,
    "height": 1024
  }'

# Check task status
curl "http://localhost:8000/task/{task_id}"

πŸ“Š Model Performance

Text-to-Image Models

ModelResolutionSpeedQualityMemory
SDXL1024x1024~30s⭐⭐⭐⭐⭐6GB
SD31024x1024~25s⭐⭐⭐⭐⭐8GB
Flux1024x1024~40s⭐⭐⭐⭐⭐12GB

Text-to-Video Models

ModelResolutionFramesSpeedQuality
ZeroScope576x32024~2min⭐⭐⭐⭐
ModelScope256x25616~1min⭐⭐⭐
CogVideoX720x48048~5min⭐⭐⭐⭐⭐

πŸ”§ Configuration

Model Configuration

# config.py
@dataclass
class ModelConfig:
    device: str = "cuda"
    mixed_precision: bool = True
    compile_models: bool = True
    enable_xformers: bool = True
    max_batch_size: int = 4
    # ... more options

Memory Optimization

# Enable memory optimizations
config.enable_cpu_offload = True
config.enable_attention_slicing = True
config.enable_vae_slicing = True

🎨 Advanced Usage

Workflow System

# Multi-step workflow
workflow = [
    {
        "type": "text_to_image",
        "args": {"prompt": "a portrait", "model": "sdxl"}
    },
    {
        "type": "enhance_image",
        "args": {"model": "gfpgan", "scale": 4},
        "input_from": 0
    },
    {
        "type": "image_to_video",
        "args": {"model": "stable_video", "num_frames": 25},
        "input_from": 1
    }
]

result = ai.create_workflow(workflow)

Batch Processing

# Process multiple tasks in parallel
tasks = [
    {"type": "text_to_image", "args": {"prompt": "landscape 1"}},
    {"type": "text_to_image", "args": {"prompt": "landscape 2"}},
    {"type": "text_to_video", "args": {"prompt": "ocean waves"}}
]

results = ai.batch_process(tasks, max_concurrent=2)

ControlNet Integration

# Use ControlNet for precise control
result = ai.text_to_image(
    prompt="a futuristic building",
    control_image=edge_image,
    control_type="canny",
    controlnet_conditioning_scale=1.0
)

πŸ“š Dataset Generation

Synthetic Dataset Creation

from datasets.dataset_generator import MultimodalDatasetGenerator

generator = MultimodalDatasetGenerator()

# Generate text-image pairs
samples = generator.generate_text_image_pairs(num_samples=10000)

# Generate text-video pairs
video_samples = generator.generate_text_video_pairs(num_samples=5000)

# Create training splits
generator.create_training_splits(dataset_path)

Dataset Categories

  • Portrait: Professional headshots, artistic portraits
  • Landscape: Natural scenes, cityscapes, environments
  • Object: Product photography, still life, detailed objects
  • Abstract: Artistic compositions, geometric patterns
  • Action: Dynamic scenes, motion capture, sports

🌐 API Documentation

Endpoints

  • POST /generate/text-to-image - Generate images from text
  • POST /generate/text-to-video - Generate videos from text
  • POST /generate/image-to-video - Generate videos from images
  • POST /enhance/image - Enhance image quality
  • POST /enhance/video - Enhance video quality
  • POST /workflow - Execute multi-step workflows
  • POST /batch - Process multiple tasks
  • GET /task/{task_id} - Get task status
  • GET /models - List available models
  • GET /stats - System statistics

Authentication

# API key authentication (if enabled)
curl -H "X-API-Key: your-api-key" \
  "http://localhost:8000/generate/text-to-image"

πŸ” Monitoring & Analytics

Performance Metrics

# Get system statistics
stats = ai.get_stats()
print(f"Total generations: {stats['total_generations']}")
print(f"Average time: {stats['average_time']:.2f}s")
print(f"Memory usage: {stats['memory']}")

Logging

import logging
logging.basicConfig(level=logging.INFO)

# Logs include:
# - Generation times
# - Memory usage
# - Model loading/unloading
# - Error tracking

πŸš€ Production Deployment

Docker Compose

version: '3.8'
services:
  multimodal-ai:
    build: .
    ports:
      - "8000:8000"
    environment:
      - CUDA_VISIBLE_DEVICES=0
    volumes:
      - ./models:/app/models
      - ./outputs:/app/outputs
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

Kubernetes

apiVersion: apps/v1
kind: Deployment
metadata:
  name: multimodal-ai
spec:
  replicas: 2
  selector:
    matchLabels:
      app: multimodal-ai
  template:
    spec:
      containers:
      - name: multimodal-ai
        image: multimodal-ai:latest
        resources:
          limits:
            nvidia.com/gpu: 1
            memory: 32Gi
          requests:
            memory: 16Gi

Load Balancing

upstream multimodal_ai {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
}

server {
    listen 80;
    location / {
        proxy_pass http://multimodal_ai;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

πŸ”§ Troubleshooting

Common Issues

CUDA Out of Memory

# Reduce batch size
config.max_batch_size = 1

# Enable CPU offloading
config.enable_cpu_offload = True

# Use smaller models
ai.text_to_image(model="sd15", width=512, height=512)

Slow Generation

# Enable model compilation
config.compile_models = True

# Use mixed precision
config.mixed_precision = True

# Enable XFormers
config.enable_xformers = True

Model Loading Errors

# Clear cache
rm -rf ~/.cache/huggingface/

# Reinstall dependencies
pip install --upgrade diffusers transformers

# Check disk space
df -h

πŸ“ˆ Performance Optimization

GPU Optimization

  • Use multiple GPUs with model parallelism
  • Enable tensor compilation with torch.compile
  • Optimize VRAM usage with attention slicing
  • Use mixed precision training (FP16/BF16)

CPU Optimization

  • Utilize multiple CPU cores for preprocessing
  • Enable CPU offloading for large models
  • Optimize data loading with multiple workers

Memory Management

  • Automatic model unloading when not in use
  • Intelligent caching of frequently used models
  • Progressive loading for large video generation

🀝 Contributing

Development Setup

git clone <repository-url>
cd veo5
pip install -e .
pip install -r requirements-dev.txt
pre-commit install

Code Style

# Format code
black .
isort .

# Lint code
flake8 .
mypy .

# Run tests
pytest tests/

Adding New Models

  1. Create model class inheriting from BaseMultimodalModel
  2. Implement required methods: load_model, unload_model, generate
  3. Add model configuration to config.py
  4. Update model registry in MultimodalAI
  5. Add tests and documentation

πŸ“„ License

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

πŸ™ Acknowledgments

  • Stability AI for Stable Diffusion models
  • Hugging Face for the Diffusers library
  • OpenAI for CLIP models
  • All the researchers and developers who made this possible

πŸ“ž Support


Built with ❀️ for the AI community

Contributors

reposekdz

2 commits

reposekdz/veo5

0

stars

2

commits

Python

primary language

Dec 16, 2025

updated

README

Advanced Multimodal AI System

A powerful, comprehensive multimodal AI system that provides state-of-the-art capabilities for text-to-image, text-to-video, image-to-video generation, and advanced enhancement features. Built with cutting-edge models and optimized for production use.

πŸš€ Features

Core Capabilities

  • Text-to-Image Generation: SDXL, SD3, Flux, Playground V2.5, Kandinsky 3
  • Text-to-Video Generation: ZeroScope, ModelScope, AnimateDiff, CogVideoX, LaVie
  • Image-to-Video Generation: Stable Video Diffusion, I2VGen-XL, DynamiCrafter, ConsistI2V
  • Image Enhancement: RealESRGAN, GFPGAN, SwinIR, CodeFormer, BSRGAN
  • Video Enhancement: BasicVSR++, RealBasicVSR, EDVR, TDAN

Advanced Features

  • ControlNet Integration: Canny, Depth, Pose, Scribble, Segmentation, Normal, MLSD, HED
  • Face Enhancement: Specialized face restoration and enhancement
  • Temporal Consistency: Advanced video processing with frame coherence
  • Motion Control: Sophisticated motion generation and interpolation
  • Batch Processing: Parallel processing of multiple tasks
  • Workflow System: Multi-step automated pipelines
  • Memory Optimization: Intelligent model loading and GPU memory management
  • Async Processing: Non-blocking API with task queues

πŸ› οΈ Installation

Prerequisites

  • Python 3.8+
  • CUDA 11.8+ (for GPU acceleration)
  • 16GB+ RAM (32GB+ recommended)
  • 50GB+ free disk space

Quick Install

git clone <repository-url>
cd veo5
pip install -r requirements.txt

Docker Installation

docker build -t multimodal-ai .
docker run --gpus all -p 8000:8000 multimodal-ai

🎯 Quick Start

Command Line Interface

# Run full demonstration
python main.py --demo

# Create training datasets
python main.py --create-datasets

# Start API server
python main.py --api

# Setup directories only
python main.py --setup

Python API

from core.multimodal_ai import MultimodalAI

# Initialize system
ai = MultimodalAI(device="cuda")

# Generate image
result = ai.text_to_image(
    prompt="a majestic dragon flying over a cyberpunk city",
    model="sdxl",
    width=1024,
    height=1024,
    enhance=True
)

# Generate video
result = ai.text_to_video(
    prompt="waves crashing on a rocky shore at sunset",
    model="zeroscope",
    num_frames=24,
    fps=8
)

# Image to video
result = ai.image_to_video(
    image="path/to/image.jpg",
    model="stable_video",
    num_frames=25
)

# Enhance image
result = ai.enhance_image(
    image="path/to/image.jpg",
    model="realesrgan",
    scale=4,
    face_enhance=True
)

REST API

# Start server
python main.py --api

# Generate image
curl -X POST "http://localhost:8000/generate/text-to-image" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a beautiful landscape",
    "model": "sdxl",
    "width": 1024,
    "height": 1024
  }'

# Check task status
curl "http://localhost:8000/task/{task_id}"

πŸ“Š Model Performance

Text-to-Image Models

ModelResolutionSpeedQualityMemory
SDXL1024x1024~30s⭐⭐⭐⭐⭐6GB
SD31024x1024~25s⭐⭐⭐⭐⭐8GB
Flux1024x1024~40s⭐⭐⭐⭐⭐12GB

Text-to-Video Models

ModelResolutionFramesSpeedQuality
ZeroScope576x32024~2min⭐⭐⭐⭐
ModelScope256x25616~1min⭐⭐⭐
CogVideoX720x48048~5min⭐⭐⭐⭐⭐

πŸ”§ Configuration

Model Configuration

# config.py
@dataclass
class ModelConfig:
    device: str = "cuda"
    mixed_precision: bool = True
    compile_models: bool = True
    enable_xformers: bool = True
    max_batch_size: int = 4
    # ... more options

Memory Optimization

# Enable memory optimizations
config.enable_cpu_offload = True
config.enable_attention_slicing = True
config.enable_vae_slicing = True

🎨 Advanced Usage

Workflow System

# Multi-step workflow
workflow = [
    {
        "type": "text_to_image",
        "args": {"prompt": "a portrait", "model": "sdxl"}
    },
    {
        "type": "enhance_image",
        "args": {"model": "gfpgan", "scale": 4},
        "input_from": 0
    },
    {
        "type": "image_to_video",
        "args": {"model": "stable_video", "num_frames": 25},
        "input_from": 1
    }
]

result = ai.create_workflow(workflow)

Batch Processing

# Process multiple tasks in parallel
tasks = [
    {"type": "text_to_image", "args": {"prompt": "landscape 1"}},
    {"type": "text_to_image", "args": {"prompt": "landscape 2"}},
    {"type": "text_to_video", "args": {"prompt": "ocean waves"}}
]

results = ai.batch_process(tasks, max_concurrent=2)

ControlNet Integration

# Use ControlNet for precise control
result = ai.text_to_image(
    prompt="a futuristic building",
    control_image=edge_image,
    control_type="canny",
    controlnet_conditioning_scale=1.0
)

πŸ“š Dataset Generation

Synthetic Dataset Creation

from datasets.dataset_generator import MultimodalDatasetGenerator

generator = MultimodalDatasetGenerator()

# Generate text-image pairs
samples = generator.generate_text_image_pairs(num_samples=10000)

# Generate text-video pairs
video_samples = generator.generate_text_video_pairs(num_samples=5000)

# Create training splits
generator.create_training_splits(dataset_path)

Dataset Categories

  • Portrait: Professional headshots, artistic portraits
  • Landscape: Natural scenes, cityscapes, environments
  • Object: Product photography, still life, detailed objects
  • Abstract: Artistic compositions, geometric patterns
  • Action: Dynamic scenes, motion capture, sports

🌐 API Documentation

Endpoints

  • POST /generate/text-to-image - Generate images from text
  • POST /generate/text-to-video - Generate videos from text
  • POST /generate/image-to-video - Generate videos from images
  • POST /enhance/image - Enhance image quality
  • POST /enhance/video - Enhance video quality
  • POST /workflow - Execute multi-step workflows
  • POST /batch - Process multiple tasks
  • GET /task/{task_id} - Get task status
  • GET /models - List available models
  • GET /stats - System statistics

Authentication

# API key authentication (if enabled)
curl -H "X-API-Key: your-api-key" \
  "http://localhost:8000/generate/text-to-image"

πŸ” Monitoring & Analytics

Performance Metrics

# Get system statistics
stats = ai.get_stats()
print(f"Total generations: {stats['total_generations']}")
print(f"Average time: {stats['average_time']:.2f}s")
print(f"Memory usage: {stats['memory']}")

Logging

import logging
logging.basicConfig(level=logging.INFO)

# Logs include:
# - Generation times
# - Memory usage
# - Model loading/unloading
# - Error tracking

πŸš€ Production Deployment

Docker Compose

version: '3.8'
services:
  multimodal-ai:
    build: .
    ports:
      - "8000:8000"
    environment:
      - CUDA_VISIBLE_DEVICES=0
    volumes:
      - ./models:/app/models
      - ./outputs:/app/outputs
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

Kubernetes

apiVersion: apps/v1
kind: Deployment
metadata:
  name: multimodal-ai
spec:
  replicas: 2
  selector:
    matchLabels:
      app: multimodal-ai
  template:
    spec:
      containers:
      - name: multimodal-ai
        image: multimodal-ai:latest
        resources:
          limits:
            nvidia.com/gpu: 1
            memory: 32Gi
          requests:
            memory: 16Gi

Load Balancing

upstream multimodal_ai {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
}

server {
    listen 80;
    location / {
        proxy_pass http://multimodal_ai;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

πŸ”§ Troubleshooting

Common Issues

CUDA Out of Memory

# Reduce batch size
config.max_batch_size = 1

# Enable CPU offloading
config.enable_cpu_offload = True

# Use smaller models
ai.text_to_image(model="sd15", width=512, height=512)

Slow Generation

# Enable model compilation
config.compile_models = True

# Use mixed precision
config.mixed_precision = True

# Enable XFormers
config.enable_xformers = True

Model Loading Errors

# Clear cache
rm -rf ~/.cache/huggingface/

# Reinstall dependencies
pip install --upgrade diffusers transformers

# Check disk space
df -h

πŸ“ˆ Performance Optimization

GPU Optimization

  • Use multiple GPUs with model parallelism
  • Enable tensor compilation with torch.compile
  • Optimize VRAM usage with attention slicing
  • Use mixed precision training (FP16/BF16)

CPU Optimization

  • Utilize multiple CPU cores for preprocessing
  • Enable CPU offloading for large models
  • Optimize data loading with multiple workers

Memory Management

  • Automatic model unloading when not in use
  • Intelligent caching of frequently used models
  • Progressive loading for large video generation

🀝 Contributing

Development Setup

git clone <repository-url>
cd veo5
pip install -e .
pip install -r requirements-dev.txt
pre-commit install

Code Style

# Format code
black .
isort .

# Lint code
flake8 .
mypy .

# Run tests
pytest tests/

Adding New Models

  1. Create model class inheriting from BaseMultimodalModel
  2. Implement required methods: load_model, unload_model, generate
  3. Add model configuration to config.py
  4. Update model registry in MultimodalAI
  5. Add tests and documentation

πŸ“„ License

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

πŸ™ Acknowledgments

  • Stability AI for Stable Diffusion models
  • Hugging Face for the Diffusers library
  • OpenAI for CLIP models
  • All the researchers and developers who made this possible

πŸ“ž Support


Built with ❀️ for the AI community

Contributors

reposekdz

2 commits

Languages

Python

100.0%