# Repository Briefing: Tencent-Hunyuan/Prism
> Source: https://repoforai.com/repo/Tencent-Hunyuan/Prism (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/Tencent-Hunyuan/Prism
- **Official Docs / Website**: https://francis-rings.github.io/Prism
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: Python
- **License**: See repository
- **Engineering Health**: C (44/100 · Maintenance 26/35 · Adoption 6/25 · Releases 6/20 · License 6/20)
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: GPU, CLI
- **Momentum**: 1,488 ★ total (+0 24h / +100 7d) · 13 forks
- **Topics**: `diffusion-models`, `high-resolution`, `sparse-attention`, `video-generation`
- **When to Use**: Best for: Multimodal diffusion research teams with an 80 GB GPU cluster that want to train natively at high resolution and compare content-adaptive sparsity against full attention. Skip if: You need single-GPU 2K generation, a turnkey hosted API, acceleration for an unrelated pretrained model, or commercial terms you can rely on without further review.

## Overview
```text
### Architecture & Core Mechanics
Prism is a Python/PyTorch diffusion research stack for native high-resolution video–audio training. It partitions tokens into spatiotemporal macro-zones, then uses directional video feature variance and feature norms from audio-to-video cross-attention to choose a block shape for each zone. Partitioning is finer along axes with rapid visual change or strong audio–visual coupling. A hybrid block selector then decides how sparsely each query attends, so both block geometry and routing adapt to the input.

For training, `pdsh_train.sh` dispatches `train_wan_ti2va.sh` across nodes, and `torchrun` starts `hymm/train_t2va_wan.py`. FSDP shards parameters, while sequence parallelism distributes one sample’s tokens across GPUs. The stack pins `diffusers==0.33.0` and `transformers==4.57.1` and includes FlashAttention, Triton, and `yunchang`. Experiment settings and resolution-specific model and data settings live in separate YAML files.

### Key Capabilities & Differentiators
Prism supports native joint training and preview inference at 720p, 1080p, and 2K. Inference loads a MOVA-360p base and a Prism preview checkpoint separately. It accepts separate text prompts for video and audio, an optional reference image for image-to-video generation, and writes MP4 output. Recommended height × width settings are 720 × 1280, 1072 × 1920, and 1440 × 2560. The default is 205 frames; a requested count that does not satisfy `(n − 1) % 4 == 0` is adjusted automatically.

Training consumes CSV manifests with one row per clip, linking cached WAN VAE `.npy` latents in `[C, T, H, W]` order to the source video, audio, and caption. Source video supplies the reference frame, and frame rate is used for audio–video alignment. `tools/build_dataset_csv.py` can scan latent headers and print bucket occupancy before launch. The distributed batch sampler draws each mini-batch from one bucket to keep tensor shapes consistent across data-parallel ranks.

### Trade-offs & Limitations
Full attention is the natural experimental control: it preserves all token interactions but has quadratic cost as sequence length grows. Prism uses video and cross-modal signals to decide which interactions to keep, making sparsity part of training rather than just an inference optimization. Experiments report a 2.5× training speedup over full attention and better generation quality in that comparison. That result is not a basis for predicting inference speed or assuming the same gain on a different cluster.

An inference-only sparse approach is a better first comparison if you already have a checkpoint and only want cheaper serving. Prism adds offline latent extraction, CSV bucketing, and coordination across FSDP and sequence-parallel workers. Even preview inference at higher resolutions requires multiple large-memory GPUs. The root contains a `LICENSE` file, but the terms are unspecified here; verify code and weight permissions separately before commercial deployment or redistribution.

### Hardware & Deployment Guide
This is a self-hosted GPU CLI workflow. The setup requires Python 3.10 or later, CUDA 12.4 or later, and system `ffmpeg`; the installation uses PyTorch 2.7.1 with matching CUDA 12.4 wheels and a CUDA-capable FlashAttention build. Download and arrange the MOVA and Prism weights locally, then set their paths in the launcher. `prism_infer.sh` supports single-GPU and DeepSpeed multi-GPU inference; `prism_infer_fsdp.sh` is recommended for 1080p and 2K.

Budget one NVIDIA 80 GB GPU for 720p inference and at least four for 1080p or 2K. Native training raises that to at least 32 such GPUs at 720p and 64 at either higher resolution. For multi-node training, verify the `pdsh` node list and ensure checkpoint, latent, and media paths resolve on the workers. Preview alpha targets stability and beta targets motion; Prism-pro remains pending, and there is no tagged GitHub release.
```

## Key Capabilities
```text
- Attention layout: Spatiotemporal macro-zones adapt block shape using directional visual variation and audio-to-video cross-attention feature norms.
- Attention routing: Hybrid block selection determines sparsity per query rather than imposing one fixed sparse pattern.
- Generation: MOVA-360p base plus Prism preview weights supports joint generation up to 1440 × 2560, with separate video and audio prompts and optional image conditioning.
- Data pipeline: Cached WAN VAE `.npy` latents and a CSV manifest feed shape bucketing and distributed single-bucket batches.
- Distributed runtime: FSDP shards parameters; sequence parallelism shards a sample’s token sequence, with training degrees of 4 at 720p and 8 at 1080p/2K.
- Training entrypoint: `pdsh` and `torchrun` launch `hymm/train_t2va_wan.py` using a top-level experiment YAML and a resolution-specific inject YAML.
```

## Quick Start / Clone
```bash
# 1 — Install PyTorch (CUDA 12.4)
pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cu124
# 2 — Install core dependencies
pip install -r requirements.txt
# 3 — Install FlashAttention (requires CUDA)
pip install flash-attn --no-build-isolation
# 4 — Install `ffmpeg` (system-level)
sudo apt-get install ffmpeg
# 5 — Verify the installation
python -c "
import torch, diffusers, transformers, flash_attn, triton
from audiotools import AudioSignal
from decord import VideoReader
print(f'torch          {torch.__version__}')
print(f'diffusers      {diffusers.__version__}')
print(f'transformers   {transformers.__version__}')
print(f'flash_attn     {flash_attn.__version__}')
print(f'triton         {triton.__version__}')
print('All imports OK ✅')"
```
