|
Download code/models/tt_dit/README.md from sunandbean/diffrhythm-1.2-p100a: direct link, hf CLI and curl.
- Browser
- Download file 6.46 kB
-
https://huggingface.co/sunandbean/diffrhythm-1.2-p100a/resolve/main/code/models/tt_dit/README.md
- Command line
-
hf download hf://sunandbean/diffrhythm-1.2-p100a/code/models/tt_dit/README.md
-
curl -L -o README.md https://huggingface.co/sunandbean/diffrhythm-1.2-p100a/resolve/main/code/models/tt_dit/README.md
6.46 kB
TT-DiT: Tenstorrent Diffusion Transformers
This directory contains the implementation of the Tenstorrent Diffusion Transformer (TT-DiT) architecture, designed for optimized parallelism of DiTs for image and video generation.
Supported Models
For detailed information about each model including performance metrics, usage instructions, and specific requirements, see:
- Stable Diffusion 3.5 Large - Text-to-image generation
- Flux 1 - Text-to-image generation (schnell & dev variants)
- Motif - Text-to-image generation model
- Qwen-Image - Text-to-image generation model
- Ideogram 4.0 - Text-to-image generation model (best-in-class typography; Blackhole)
- Mochi-1 - Video generation model
- Wan2.2-T2V-A14B - Text-to-video generation model
- See experimental/ for in-progress model variants (AniSora, Wan2.2-Distill, LoRA adapters)
- LTX-2.3 - Joint audio-video generation model (Pro and Fast variants)
Directory Structure
tt_dit/
βββ layers/ # Core neural network layers
βββ models/ # Model architectures and documentation
β βββ transformers/ # Transformer implementations (SD35, Mochi, Wan, LTX, Flux1, Motif, QwenImage)
β βββ vae/ # VAE/Autoencoder implementations
β βββ StableDiffusion35.md # SD3.5 model documentation
β βββ Flux1.md # Flux 1 model documentation
β βββ Motif.md # Motif model documentation
β βββ QwenImage.md # Qwen-Image model documentation
β βββ Mochi_1.md # Mochi-1 model documentation
β βββ Wan2_2.md # Wan2.2 model documentation
β βββ LTX2.md # LTX-2.3 model documentation
βββ encoders/ # Text encoder implementations
β βββ clip/ # CLIP encoder
β βββ gemma/ # Gemma encoder
β βββ t5/ # T5 encoder
βββ parallel/ # Parallelization utilities
β βββ config.py # Parallel configuration
β βββ manager.py # Parallel execution management
βββ pipelines/ # End-to-end model pipelines
β βββ stable_diffusion_35_large/
β βββ mochi/
β βββ wan/
β βββ ltx/
β βββ flux1/
β βββ motif/
β βββ qwenimage/
βββ tests/ # Test suite
β βββ models/ # Model-level tests (sd35, mochi, wan2_2, ltx, flux1, motif, qwenimage)
β βββ encoders/ # Encoder tests
β βββ blocks/ # Block-level tests
β βββ unit/ # Unit tests for layers
βββ utils/ # Utility functions
βββ check.py # Validation utilities
βββ padding.py # Padding operations
βββ substate.py # State management
βββ tensor.py # Tensor operations
Core Components
Layers
- Embeddings: Position and token embedding implementations
- Feedforward: MLP and feed-forward network components
- Linear: Optimized linear transformation layers
- Normalization: Layer normalization implementations
Models
- Transformers: DiT transformer implementations for various generative models
- Support for multiple architectures including SD3.5, Mochi, Wan2.2, LTX-2, Flux1, Motif, and Qwen-Image
- Model-specific attention mechanisms and transformer architectures
- Autoencoders: VAE implementations for different models
Parallel Processing
- Config: Parallel configuration management with
DiTParallelConfig - Manager: Parallel execution and device management
Pipelines
End-to-end pipeline implementations for multiple generative models:
- Stable Diffusion 3.5 Large: Text-to-image generation (1024x1024px)
- Flux 1: Text-to-image generation (schnell & dev variants, 1024x1024px)
- Motif: Text-to-image generation (6B model, 1024x1024px)
- Qwen-Image: Text-to-image generation (1024x1024px)
- Mochi-1: Video generation model (824x480px, 168 frames)
- Wan2.2-T2V-A14B: Text-to-video generation
- LTX-2.3: Joint audio-video generation (Pro one-stage and Fast distilled two-stage)
Each pipeline includes:
- Automatic parallel configuration for different device meshes
- Optimized execution on Wormhole systems
- Comprehensive timing collection and profiling
Testing
The test suite is organized into three main categories:
Unit Tests (
tests/unit/):- Layer-level testing
- Individual component validation
- Coverage for embeddings, feedforward, linear, and normalization layers
Model Tests (
tests/models/):- Smoke tests for model components
- Performance testing
- Pipeline validation
Running tests:
# Run tests from tt-metal/
# Run unit tests
python -m pytest models/tt_dit/tests/unit/
# Run all model tests
python -m pytest models/tt_dit/tests/models/
# Run specific model pipeline tests
python -m pytest models/tt_dit/tests/models/sd35/test_pipeline_sd35.py -v
python -m pytest models/tt_dit/tests/models/flux1/test_pipeline_flux1.py -v
python -m pytest models/tt_dit/tests/models/motif/test_pipeline_motif.py -v
python -m pytest models/tt_dit/tests/models/qwenimage/test_pipeline_qwenimage.py -v
python -m pytest models/tt_dit/tests/models/mochi/test_pipeline_mochi.py -v
python -m pytest models/tt_dit/tests/models/wan2_2/test_pipeline_wan.py -v
python -m pytest models/tt_dit/tests/models/ltx/test_pipeline_ltx_distilled.py -v
python -m pytest models/tt_dit/tests/models/ltx/test_pipeline_ltx_two_stages.py -v
Key Features
- Modular Architecture: Clean separation between layers, models, and parallel processing
- Optimized Parallelism:
- Automatic configuration of tensor and sequence parallelism
- Efficient device mesh management
- Dedicated parallel managers for different model components
- Performance Monitoring:
- Built-in timing collection
- Performance profiling support
- Tracing capabilities for optimization
Contributing
When adding new components:
- Place implementation in appropriate subdirectory
- Add corresponding unit tests
- Update model tests if necessary
- Ensure parallel processing compatibility