Initial release: DramaBox DiT INT8 selective quantization
Browse files- README.md +157 -0
- config.json +586 -0
- dramabox-dit-int8-selective.safetensors +3 -0
- inference_optimized.py +142 -0
- load_int8.py +109 -0
README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: ltx-2-community
|
| 4 |
+
license_link: https://huggingface.co/ResembleAI/Dramabox/blob/main/LICENSE
|
| 5 |
+
base_model: ResembleAI/Dramabox
|
| 6 |
+
tags:
|
| 7 |
+
- tts
|
| 8 |
+
- text-to-speech
|
| 9 |
+
- audio
|
| 10 |
+
- quantized
|
| 11 |
+
- int8
|
| 12 |
+
- dramabox
|
| 13 |
+
- torchao
|
| 14 |
+
- diffusion-transformer
|
| 15 |
+
- flow-matching
|
| 16 |
+
library_name: pytorch
|
| 17 |
+
pipeline_tag: text-to-speech
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# DramaBox DiT INT8 — Selective Weight-Only Quantization
|
| 21 |
+
|
| 22 |
+
A selectively quantized version of the [DramaBox TTS](https://huggingface.co/ResembleAI/Dramabox) 3.3B DiT (Diffusion Transformer) model from [Resemble AI](https://huggingface.co/ResembleAI). Reduces VRAM by 20% and checkpoint size by 45% while preserving audio quality.
|
| 23 |
+
|
| 24 |
+
> **Base model:** [ResembleAI/Dramabox](https://huggingface.co/ResembleAI/Dramabox) | **Code:** [resemble-ai/DramaBox](https://github.com/resemble-ai/DramaBox) | **Architecture:** LTX-2.3 DiT + Gemma 3 12B
|
| 25 |
+
|
| 26 |
+
## What's included
|
| 27 |
+
|
| 28 |
+
| File | Size | Description |
|
| 29 |
+
|------|------|-------------|
|
| 30 |
+
| `dramabox-dit-int8-selective.safetensors` | 3.37 GB | Quantized DiT weights (INT8 data + BF16 scales) |
|
| 31 |
+
| `config.json` | 28 KB | Layer map: which 562 layers are quantized |
|
| 32 |
+
| `load_int8.py` | 3.6 KB | Loader script (works with or without torchao) |
|
| 33 |
+
| `inference_optimized.py` | 4.3 KB | Full pipeline with INT8 + Gemma CPU offload |
|
| 34 |
+
|
| 35 |
+
You still need the other components from [ResembleAI/Dramabox](https://huggingface.co/ResembleAI/Dramabox):
|
| 36 |
+
- `dramabox-audio-components.safetensors` (1.9 GB) — VAE + vocoder
|
| 37 |
+
- [unsloth/gemma-3-12b-it-bnb-4bit](https://huggingface.co/unsloth/gemma-3-12b-it-bnb-4bit) (~8 GB) — text encoder
|
| 38 |
+
|
| 39 |
+
## Results
|
| 40 |
+
|
| 41 |
+
| Metric | Baseline (BF16) | This model (INT8) | Change |
|
| 42 |
+
|--------|-----------------|-------------------|--------|
|
| 43 |
+
| DiT checkpoint size | 6.1 GB | 3.37 GB | **-45%** |
|
| 44 |
+
| Peak VRAM | 17.39 GB | 13.8 GB | **-20.6%** |
|
| 45 |
+
| VRAM during denoising | 17.39 GB | 5.93 GB | **-65.9%** |
|
| 46 |
+
| Audio quality (MCD) | 0.0 dB | 4.98 dB | Within threshold |
|
| 47 |
+
| Generation time | 2.62s | 3.22s | +23% |
|
| 48 |
+
|
| 49 |
+
MCD (Mel-Cepstral Distortion) measures spectral distance from the BF16 baseline. Lower is better. Scores below 5.0 dB are perceptually near-identical for speech.
|
| 50 |
+
|
| 51 |
+
## Quantization details
|
| 52 |
+
|
| 53 |
+
**Method:** Selective INT8 weight-only quantization via [torchao](https://github.com/pytorch/ao) `Int8WeightOnlyConfig`. Weights are stored as INT8 with per-channel BF16 scales and dequantized at runtime during matrix multiplication.
|
| 54 |
+
|
| 55 |
+
**What's quantized (562 layers, ~81.5% of DiT parameters):**
|
| 56 |
+
- All attention projections (`to_q`, `to_k`, `to_v`, `to_out`) across all 48 transformer blocks
|
| 57 |
+
- All `gate_logits` layers
|
| 58 |
+
- All FFN GELU projections (`audio_ff.net.0.proj`) across all 48 blocks
|
| 59 |
+
- FFN output projections (`audio_ff.net.2`) in blocks 15–47, excluding block 17
|
| 60 |
+
- Input/output projections (`audio_patchify_proj`, `audio_proj_out`)
|
| 61 |
+
|
| 62 |
+
**What's NOT quantized (kept in BF16):**
|
| 63 |
+
- All normalization layers — extremely sensitive to precision changes
|
| 64 |
+
- AdaLN conditioning layers — controls the diffusion process globally
|
| 65 |
+
- Timestep embedder — conditioning pathway, highly sensitive
|
| 66 |
+
- FFN output projections in blocks 0–14 — early blocks are most sensitive to quantization
|
| 67 |
+
- FFN output projection in block 17 — anomalously sensitive individual block
|
| 68 |
+
|
| 69 |
+
This layer map was discovered through 80+ automated experiments using [Andrej Karpathy's auto-research methodology](https://github.com/karpathy/autoresearch), systematically testing each layer type and block index.
|
| 70 |
+
|
| 71 |
+
## Usage
|
| 72 |
+
|
| 73 |
+
### Option 1: Runtime quantization (simplest, no extra downloads)
|
| 74 |
+
|
| 75 |
+
If you just want VRAM savings without downloading this checkpoint, you can apply quantization at load time to the original DramaBox model:
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
import torch, re
|
| 79 |
+
from torchao.quantization import quantize_, Int8WeightOnlyConfig
|
| 80 |
+
|
| 81 |
+
# After loading the standard DramaBox TTSServer:
|
| 82 |
+
attn_proj_keys = ("to_q", "to_k", "to_v", "to_out")
|
| 83 |
+
|
| 84 |
+
def dit_filter(mod, fqn):
|
| 85 |
+
if not isinstance(mod, torch.nn.Linear): return False
|
| 86 |
+
if "norm" in fqn: return False
|
| 87 |
+
if "gate_logits" in fqn: return True
|
| 88 |
+
if any(k in fqn for k in attn_proj_keys): return True
|
| 89 |
+
if "audio_ff" in fqn:
|
| 90 |
+
m = re.search(r'transformer_blocks\.(\d+)\.', fqn)
|
| 91 |
+
if m:
|
| 92 |
+
idx = int(m.group(1))
|
| 93 |
+
if "net.2" in fqn and idx >= 15 and idx != 17: return True
|
| 94 |
+
if "net.0.proj" in fqn: return True
|
| 95 |
+
return False
|
| 96 |
+
|
| 97 |
+
def io_filter(mod, fqn):
|
| 98 |
+
return fqn in ("audio_patchify_proj", "audio_proj_out") and isinstance(mod, torch.nn.Linear)
|
| 99 |
+
|
| 100 |
+
quantize_(tts._velocity_model, Int8WeightOnlyConfig(), filter_fn=dit_filter)
|
| 101 |
+
quantize_(tts._velocity_model, Int8WeightOnlyConfig(), filter_fn=io_filter)
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
### Option 2: Load pre-quantized weights (faster startup)
|
| 105 |
+
|
| 106 |
+
```python
|
| 107 |
+
from load_int8 import load_int8_dit
|
| 108 |
+
|
| 109 |
+
# Loads the INT8 safetensors and reconstructs quantized Linear layers
|
| 110 |
+
load_int8_dit(tts._velocity_model, "dramabox-dit-int8-selective.safetensors")
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
### Option 3: Full optimized pipeline with Gemma offload
|
| 114 |
+
|
| 115 |
+
For maximum VRAM savings (5.93 GB during denoising), use the included `inference_optimized.py` which also offloads Gemma 12B to CPU between text encoding and audio generation.
|
| 116 |
+
|
| 117 |
+
## Requirements
|
| 118 |
+
|
| 119 |
+
- PyTorch >= 2.4
|
| 120 |
+
- torchao >= 0.15.0
|
| 121 |
+
- CUDA GPU with >= 16 GB VRAM (14 GB with Gemma offload)
|
| 122 |
+
- The original DramaBox model and its dependencies
|
| 123 |
+
|
| 124 |
+
## How this was made
|
| 125 |
+
|
| 126 |
+
We ran 80+ experiments using an automated loop inspired by Karpathy's auto-research methodology:
|
| 127 |
+
|
| 128 |
+
1. Start from the BF16 baseline
|
| 129 |
+
2. Modify quantization config (which layers, which precision, which blocks)
|
| 130 |
+
3. Generate 3 evaluation audio samples with fixed prompts/seeds
|
| 131 |
+
4. Measure peak VRAM, generation time, and MCD vs baseline
|
| 132 |
+
5. Keep the change if MCD < 5.0 dB, discard otherwise
|
| 133 |
+
6. Repeat
|
| 134 |
+
|
| 135 |
+
Key findings from the search:
|
| 136 |
+
- **Flow-matching diffusion models are far more precision-sensitive than autoregressive LLMs.** All 4-bit approaches (NF4, NVFP4, FP4, Int4) produced unacceptable quality (MCD 17–32 dB).
|
| 137 |
+
- **FP8 is worse than INT8** for weight representation in this model (MCD 11.8 vs 4.35).
|
| 138 |
+
- **`torch.compile` breaks audio output** even on the unquantized baseline (MCD 24–32 dB). The iterative denoising loop is numerically sensitive to graph optimizations.
|
| 139 |
+
- **Early transformer blocks (0–14) are most sensitive** in their FFN output projections. Block 17 is an outlier.
|
| 140 |
+
- **Attention projections and GELU gates are universally robust** to INT8 across all 48 blocks.
|
| 141 |
+
|
| 142 |
+
## Citation
|
| 143 |
+
|
| 144 |
+
If you use this work, please cite the original DramaBox model:
|
| 145 |
+
|
| 146 |
+
```bibtex
|
| 147 |
+
@misc{dramabox2025,
|
| 148 |
+
title={DramaBox: Expressive Text to Speech Model},
|
| 149 |
+
author={Resemble AI},
|
| 150 |
+
year={2025},
|
| 151 |
+
url={https://github.com/resemble-ai/DramaBox}
|
| 152 |
+
}
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
## License
|
| 156 |
+
|
| 157 |
+
Same as the base DramaBox model — [LTX-2 Community License](https://huggingface.co/ResembleAI/Dramabox/blob/main/LICENSE).
|
config.json
ADDED
|
@@ -0,0 +1,586 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"format": "int8_weight_only_selective",
|
| 3 |
+
"description": "DramaBox DiT 3.3B with selective INT8 weight-only quantization",
|
| 4 |
+
"quantized_layers": [
|
| 5 |
+
"audio_patchify_proj",
|
| 6 |
+
"audio_proj_out",
|
| 7 |
+
"transformer_blocks.0.audio_attn1.to_q",
|
| 8 |
+
"transformer_blocks.0.audio_attn1.to_k",
|
| 9 |
+
"transformer_blocks.0.audio_attn1.to_v",
|
| 10 |
+
"transformer_blocks.0.audio_attn1.to_gate_logits",
|
| 11 |
+
"transformer_blocks.0.audio_attn1.to_out.0",
|
| 12 |
+
"transformer_blocks.0.audio_attn2.to_q",
|
| 13 |
+
"transformer_blocks.0.audio_attn2.to_k",
|
| 14 |
+
"transformer_blocks.0.audio_attn2.to_v",
|
| 15 |
+
"transformer_blocks.0.audio_attn2.to_gate_logits",
|
| 16 |
+
"transformer_blocks.0.audio_attn2.to_out.0",
|
| 17 |
+
"transformer_blocks.0.audio_ff.net.0.proj",
|
| 18 |
+
"transformer_blocks.1.audio_attn1.to_q",
|
| 19 |
+
"transformer_blocks.1.audio_attn1.to_k",
|
| 20 |
+
"transformer_blocks.1.audio_attn1.to_v",
|
| 21 |
+
"transformer_blocks.1.audio_attn1.to_gate_logits",
|
| 22 |
+
"transformer_blocks.1.audio_attn1.to_out.0",
|
| 23 |
+
"transformer_blocks.1.audio_attn2.to_q",
|
| 24 |
+
"transformer_blocks.1.audio_attn2.to_k",
|
| 25 |
+
"transformer_blocks.1.audio_attn2.to_v",
|
| 26 |
+
"transformer_blocks.1.audio_attn2.to_gate_logits",
|
| 27 |
+
"transformer_blocks.1.audio_attn2.to_out.0",
|
| 28 |
+
"transformer_blocks.1.audio_ff.net.0.proj",
|
| 29 |
+
"transformer_blocks.2.audio_attn1.to_q",
|
| 30 |
+
"transformer_blocks.2.audio_attn1.to_k",
|
| 31 |
+
"transformer_blocks.2.audio_attn1.to_v",
|
| 32 |
+
"transformer_blocks.2.audio_attn1.to_gate_logits",
|
| 33 |
+
"transformer_blocks.2.audio_attn1.to_out.0",
|
| 34 |
+
"transformer_blocks.2.audio_attn2.to_q",
|
| 35 |
+
"transformer_blocks.2.audio_attn2.to_k",
|
| 36 |
+
"transformer_blocks.2.audio_attn2.to_v",
|
| 37 |
+
"transformer_blocks.2.audio_attn2.to_gate_logits",
|
| 38 |
+
"transformer_blocks.2.audio_attn2.to_out.0",
|
| 39 |
+
"transformer_blocks.2.audio_ff.net.0.proj",
|
| 40 |
+
"transformer_blocks.3.audio_attn1.to_q",
|
| 41 |
+
"transformer_blocks.3.audio_attn1.to_k",
|
| 42 |
+
"transformer_blocks.3.audio_attn1.to_v",
|
| 43 |
+
"transformer_blocks.3.audio_attn1.to_gate_logits",
|
| 44 |
+
"transformer_blocks.3.audio_attn1.to_out.0",
|
| 45 |
+
"transformer_blocks.3.audio_attn2.to_q",
|
| 46 |
+
"transformer_blocks.3.audio_attn2.to_k",
|
| 47 |
+
"transformer_blocks.3.audio_attn2.to_v",
|
| 48 |
+
"transformer_blocks.3.audio_attn2.to_gate_logits",
|
| 49 |
+
"transformer_blocks.3.audio_attn2.to_out.0",
|
| 50 |
+
"transformer_blocks.3.audio_ff.net.0.proj",
|
| 51 |
+
"transformer_blocks.4.audio_attn1.to_q",
|
| 52 |
+
"transformer_blocks.4.audio_attn1.to_k",
|
| 53 |
+
"transformer_blocks.4.audio_attn1.to_v",
|
| 54 |
+
"transformer_blocks.4.audio_attn1.to_gate_logits",
|
| 55 |
+
"transformer_blocks.4.audio_attn1.to_out.0",
|
| 56 |
+
"transformer_blocks.4.audio_attn2.to_q",
|
| 57 |
+
"transformer_blocks.4.audio_attn2.to_k",
|
| 58 |
+
"transformer_blocks.4.audio_attn2.to_v",
|
| 59 |
+
"transformer_blocks.4.audio_attn2.to_gate_logits",
|
| 60 |
+
"transformer_blocks.4.audio_attn2.to_out.0",
|
| 61 |
+
"transformer_blocks.4.audio_ff.net.0.proj",
|
| 62 |
+
"transformer_blocks.5.audio_attn1.to_q",
|
| 63 |
+
"transformer_blocks.5.audio_attn1.to_k",
|
| 64 |
+
"transformer_blocks.5.audio_attn1.to_v",
|
| 65 |
+
"transformer_blocks.5.audio_attn1.to_gate_logits",
|
| 66 |
+
"transformer_blocks.5.audio_attn1.to_out.0",
|
| 67 |
+
"transformer_blocks.5.audio_attn2.to_q",
|
| 68 |
+
"transformer_blocks.5.audio_attn2.to_k",
|
| 69 |
+
"transformer_blocks.5.audio_attn2.to_v",
|
| 70 |
+
"transformer_blocks.5.audio_attn2.to_gate_logits",
|
| 71 |
+
"transformer_blocks.5.audio_attn2.to_out.0",
|
| 72 |
+
"transformer_blocks.5.audio_ff.net.0.proj",
|
| 73 |
+
"transformer_blocks.6.audio_attn1.to_q",
|
| 74 |
+
"transformer_blocks.6.audio_attn1.to_k",
|
| 75 |
+
"transformer_blocks.6.audio_attn1.to_v",
|
| 76 |
+
"transformer_blocks.6.audio_attn1.to_gate_logits",
|
| 77 |
+
"transformer_blocks.6.audio_attn1.to_out.0",
|
| 78 |
+
"transformer_blocks.6.audio_attn2.to_q",
|
| 79 |
+
"transformer_blocks.6.audio_attn2.to_k",
|
| 80 |
+
"transformer_blocks.6.audio_attn2.to_v",
|
| 81 |
+
"transformer_blocks.6.audio_attn2.to_gate_logits",
|
| 82 |
+
"transformer_blocks.6.audio_attn2.to_out.0",
|
| 83 |
+
"transformer_blocks.6.audio_ff.net.0.proj",
|
| 84 |
+
"transformer_blocks.7.audio_attn1.to_q",
|
| 85 |
+
"transformer_blocks.7.audio_attn1.to_k",
|
| 86 |
+
"transformer_blocks.7.audio_attn1.to_v",
|
| 87 |
+
"transformer_blocks.7.audio_attn1.to_gate_logits",
|
| 88 |
+
"transformer_blocks.7.audio_attn1.to_out.0",
|
| 89 |
+
"transformer_blocks.7.audio_attn2.to_q",
|
| 90 |
+
"transformer_blocks.7.audio_attn2.to_k",
|
| 91 |
+
"transformer_blocks.7.audio_attn2.to_v",
|
| 92 |
+
"transformer_blocks.7.audio_attn2.to_gate_logits",
|
| 93 |
+
"transformer_blocks.7.audio_attn2.to_out.0",
|
| 94 |
+
"transformer_blocks.7.audio_ff.net.0.proj",
|
| 95 |
+
"transformer_blocks.8.audio_attn1.to_q",
|
| 96 |
+
"transformer_blocks.8.audio_attn1.to_k",
|
| 97 |
+
"transformer_blocks.8.audio_attn1.to_v",
|
| 98 |
+
"transformer_blocks.8.audio_attn1.to_gate_logits",
|
| 99 |
+
"transformer_blocks.8.audio_attn1.to_out.0",
|
| 100 |
+
"transformer_blocks.8.audio_attn2.to_q",
|
| 101 |
+
"transformer_blocks.8.audio_attn2.to_k",
|
| 102 |
+
"transformer_blocks.8.audio_attn2.to_v",
|
| 103 |
+
"transformer_blocks.8.audio_attn2.to_gate_logits",
|
| 104 |
+
"transformer_blocks.8.audio_attn2.to_out.0",
|
| 105 |
+
"transformer_blocks.8.audio_ff.net.0.proj",
|
| 106 |
+
"transformer_blocks.9.audio_attn1.to_q",
|
| 107 |
+
"transformer_blocks.9.audio_attn1.to_k",
|
| 108 |
+
"transformer_blocks.9.audio_attn1.to_v",
|
| 109 |
+
"transformer_blocks.9.audio_attn1.to_gate_logits",
|
| 110 |
+
"transformer_blocks.9.audio_attn1.to_out.0",
|
| 111 |
+
"transformer_blocks.9.audio_attn2.to_q",
|
| 112 |
+
"transformer_blocks.9.audio_attn2.to_k",
|
| 113 |
+
"transformer_blocks.9.audio_attn2.to_v",
|
| 114 |
+
"transformer_blocks.9.audio_attn2.to_gate_logits",
|
| 115 |
+
"transformer_blocks.9.audio_attn2.to_out.0",
|
| 116 |
+
"transformer_blocks.9.audio_ff.net.0.proj",
|
| 117 |
+
"transformer_blocks.10.audio_attn1.to_q",
|
| 118 |
+
"transformer_blocks.10.audio_attn1.to_k",
|
| 119 |
+
"transformer_blocks.10.audio_attn1.to_v",
|
| 120 |
+
"transformer_blocks.10.audio_attn1.to_gate_logits",
|
| 121 |
+
"transformer_blocks.10.audio_attn1.to_out.0",
|
| 122 |
+
"transformer_blocks.10.audio_attn2.to_q",
|
| 123 |
+
"transformer_blocks.10.audio_attn2.to_k",
|
| 124 |
+
"transformer_blocks.10.audio_attn2.to_v",
|
| 125 |
+
"transformer_blocks.10.audio_attn2.to_gate_logits",
|
| 126 |
+
"transformer_blocks.10.audio_attn2.to_out.0",
|
| 127 |
+
"transformer_blocks.10.audio_ff.net.0.proj",
|
| 128 |
+
"transformer_blocks.11.audio_attn1.to_q",
|
| 129 |
+
"transformer_blocks.11.audio_attn1.to_k",
|
| 130 |
+
"transformer_blocks.11.audio_attn1.to_v",
|
| 131 |
+
"transformer_blocks.11.audio_attn1.to_gate_logits",
|
| 132 |
+
"transformer_blocks.11.audio_attn1.to_out.0",
|
| 133 |
+
"transformer_blocks.11.audio_attn2.to_q",
|
| 134 |
+
"transformer_blocks.11.audio_attn2.to_k",
|
| 135 |
+
"transformer_blocks.11.audio_attn2.to_v",
|
| 136 |
+
"transformer_blocks.11.audio_attn2.to_gate_logits",
|
| 137 |
+
"transformer_blocks.11.audio_attn2.to_out.0",
|
| 138 |
+
"transformer_blocks.11.audio_ff.net.0.proj",
|
| 139 |
+
"transformer_blocks.12.audio_attn1.to_q",
|
| 140 |
+
"transformer_blocks.12.audio_attn1.to_k",
|
| 141 |
+
"transformer_blocks.12.audio_attn1.to_v",
|
| 142 |
+
"transformer_blocks.12.audio_attn1.to_gate_logits",
|
| 143 |
+
"transformer_blocks.12.audio_attn1.to_out.0",
|
| 144 |
+
"transformer_blocks.12.audio_attn2.to_q",
|
| 145 |
+
"transformer_blocks.12.audio_attn2.to_k",
|
| 146 |
+
"transformer_blocks.12.audio_attn2.to_v",
|
| 147 |
+
"transformer_blocks.12.audio_attn2.to_gate_logits",
|
| 148 |
+
"transformer_blocks.12.audio_attn2.to_out.0",
|
| 149 |
+
"transformer_blocks.12.audio_ff.net.0.proj",
|
| 150 |
+
"transformer_blocks.13.audio_attn1.to_q",
|
| 151 |
+
"transformer_blocks.13.audio_attn1.to_k",
|
| 152 |
+
"transformer_blocks.13.audio_attn1.to_v",
|
| 153 |
+
"transformer_blocks.13.audio_attn1.to_gate_logits",
|
| 154 |
+
"transformer_blocks.13.audio_attn1.to_out.0",
|
| 155 |
+
"transformer_blocks.13.audio_attn2.to_q",
|
| 156 |
+
"transformer_blocks.13.audio_attn2.to_k",
|
| 157 |
+
"transformer_blocks.13.audio_attn2.to_v",
|
| 158 |
+
"transformer_blocks.13.audio_attn2.to_gate_logits",
|
| 159 |
+
"transformer_blocks.13.audio_attn2.to_out.0",
|
| 160 |
+
"transformer_blocks.13.audio_ff.net.0.proj",
|
| 161 |
+
"transformer_blocks.14.audio_attn1.to_q",
|
| 162 |
+
"transformer_blocks.14.audio_attn1.to_k",
|
| 163 |
+
"transformer_blocks.14.audio_attn1.to_v",
|
| 164 |
+
"transformer_blocks.14.audio_attn1.to_gate_logits",
|
| 165 |
+
"transformer_blocks.14.audio_attn1.to_out.0",
|
| 166 |
+
"transformer_blocks.14.audio_attn2.to_q",
|
| 167 |
+
"transformer_blocks.14.audio_attn2.to_k",
|
| 168 |
+
"transformer_blocks.14.audio_attn2.to_v",
|
| 169 |
+
"transformer_blocks.14.audio_attn2.to_gate_logits",
|
| 170 |
+
"transformer_blocks.14.audio_attn2.to_out.0",
|
| 171 |
+
"transformer_blocks.14.audio_ff.net.0.proj",
|
| 172 |
+
"transformer_blocks.15.audio_attn1.to_q",
|
| 173 |
+
"transformer_blocks.15.audio_attn1.to_k",
|
| 174 |
+
"transformer_blocks.15.audio_attn1.to_v",
|
| 175 |
+
"transformer_blocks.15.audio_attn1.to_gate_logits",
|
| 176 |
+
"transformer_blocks.15.audio_attn1.to_out.0",
|
| 177 |
+
"transformer_blocks.15.audio_attn2.to_q",
|
| 178 |
+
"transformer_blocks.15.audio_attn2.to_k",
|
| 179 |
+
"transformer_blocks.15.audio_attn2.to_v",
|
| 180 |
+
"transformer_blocks.15.audio_attn2.to_gate_logits",
|
| 181 |
+
"transformer_blocks.15.audio_attn2.to_out.0",
|
| 182 |
+
"transformer_blocks.15.audio_ff.net.0.proj",
|
| 183 |
+
"transformer_blocks.15.audio_ff.net.2",
|
| 184 |
+
"transformer_blocks.16.audio_attn1.to_q",
|
| 185 |
+
"transformer_blocks.16.audio_attn1.to_k",
|
| 186 |
+
"transformer_blocks.16.audio_attn1.to_v",
|
| 187 |
+
"transformer_blocks.16.audio_attn1.to_gate_logits",
|
| 188 |
+
"transformer_blocks.16.audio_attn1.to_out.0",
|
| 189 |
+
"transformer_blocks.16.audio_attn2.to_q",
|
| 190 |
+
"transformer_blocks.16.audio_attn2.to_k",
|
| 191 |
+
"transformer_blocks.16.audio_attn2.to_v",
|
| 192 |
+
"transformer_blocks.16.audio_attn2.to_gate_logits",
|
| 193 |
+
"transformer_blocks.16.audio_attn2.to_out.0",
|
| 194 |
+
"transformer_blocks.16.audio_ff.net.0.proj",
|
| 195 |
+
"transformer_blocks.16.audio_ff.net.2",
|
| 196 |
+
"transformer_blocks.17.audio_attn1.to_q",
|
| 197 |
+
"transformer_blocks.17.audio_attn1.to_k",
|
| 198 |
+
"transformer_blocks.17.audio_attn1.to_v",
|
| 199 |
+
"transformer_blocks.17.audio_attn1.to_gate_logits",
|
| 200 |
+
"transformer_blocks.17.audio_attn1.to_out.0",
|
| 201 |
+
"transformer_blocks.17.audio_attn2.to_q",
|
| 202 |
+
"transformer_blocks.17.audio_attn2.to_k",
|
| 203 |
+
"transformer_blocks.17.audio_attn2.to_v",
|
| 204 |
+
"transformer_blocks.17.audio_attn2.to_gate_logits",
|
| 205 |
+
"transformer_blocks.17.audio_attn2.to_out.0",
|
| 206 |
+
"transformer_blocks.17.audio_ff.net.0.proj",
|
| 207 |
+
"transformer_blocks.18.audio_attn1.to_q",
|
| 208 |
+
"transformer_blocks.18.audio_attn1.to_k",
|
| 209 |
+
"transformer_blocks.18.audio_attn1.to_v",
|
| 210 |
+
"transformer_blocks.18.audio_attn1.to_gate_logits",
|
| 211 |
+
"transformer_blocks.18.audio_attn1.to_out.0",
|
| 212 |
+
"transformer_blocks.18.audio_attn2.to_q",
|
| 213 |
+
"transformer_blocks.18.audio_attn2.to_k",
|
| 214 |
+
"transformer_blocks.18.audio_attn2.to_v",
|
| 215 |
+
"transformer_blocks.18.audio_attn2.to_gate_logits",
|
| 216 |
+
"transformer_blocks.18.audio_attn2.to_out.0",
|
| 217 |
+
"transformer_blocks.18.audio_ff.net.0.proj",
|
| 218 |
+
"transformer_blocks.18.audio_ff.net.2",
|
| 219 |
+
"transformer_blocks.19.audio_attn1.to_q",
|
| 220 |
+
"transformer_blocks.19.audio_attn1.to_k",
|
| 221 |
+
"transformer_blocks.19.audio_attn1.to_v",
|
| 222 |
+
"transformer_blocks.19.audio_attn1.to_gate_logits",
|
| 223 |
+
"transformer_blocks.19.audio_attn1.to_out.0",
|
| 224 |
+
"transformer_blocks.19.audio_attn2.to_q",
|
| 225 |
+
"transformer_blocks.19.audio_attn2.to_k",
|
| 226 |
+
"transformer_blocks.19.audio_attn2.to_v",
|
| 227 |
+
"transformer_blocks.19.audio_attn2.to_gate_logits",
|
| 228 |
+
"transformer_blocks.19.audio_attn2.to_out.0",
|
| 229 |
+
"transformer_blocks.19.audio_ff.net.0.proj",
|
| 230 |
+
"transformer_blocks.19.audio_ff.net.2",
|
| 231 |
+
"transformer_blocks.20.audio_attn1.to_q",
|
| 232 |
+
"transformer_blocks.20.audio_attn1.to_k",
|
| 233 |
+
"transformer_blocks.20.audio_attn1.to_v",
|
| 234 |
+
"transformer_blocks.20.audio_attn1.to_gate_logits",
|
| 235 |
+
"transformer_blocks.20.audio_attn1.to_out.0",
|
| 236 |
+
"transformer_blocks.20.audio_attn2.to_q",
|
| 237 |
+
"transformer_blocks.20.audio_attn2.to_k",
|
| 238 |
+
"transformer_blocks.20.audio_attn2.to_v",
|
| 239 |
+
"transformer_blocks.20.audio_attn2.to_gate_logits",
|
| 240 |
+
"transformer_blocks.20.audio_attn2.to_out.0",
|
| 241 |
+
"transformer_blocks.20.audio_ff.net.0.proj",
|
| 242 |
+
"transformer_blocks.20.audio_ff.net.2",
|
| 243 |
+
"transformer_blocks.21.audio_attn1.to_q",
|
| 244 |
+
"transformer_blocks.21.audio_attn1.to_k",
|
| 245 |
+
"transformer_blocks.21.audio_attn1.to_v",
|
| 246 |
+
"transformer_blocks.21.audio_attn1.to_gate_logits",
|
| 247 |
+
"transformer_blocks.21.audio_attn1.to_out.0",
|
| 248 |
+
"transformer_blocks.21.audio_attn2.to_q",
|
| 249 |
+
"transformer_blocks.21.audio_attn2.to_k",
|
| 250 |
+
"transformer_blocks.21.audio_attn2.to_v",
|
| 251 |
+
"transformer_blocks.21.audio_attn2.to_gate_logits",
|
| 252 |
+
"transformer_blocks.21.audio_attn2.to_out.0",
|
| 253 |
+
"transformer_blocks.21.audio_ff.net.0.proj",
|
| 254 |
+
"transformer_blocks.21.audio_ff.net.2",
|
| 255 |
+
"transformer_blocks.22.audio_attn1.to_q",
|
| 256 |
+
"transformer_blocks.22.audio_attn1.to_k",
|
| 257 |
+
"transformer_blocks.22.audio_attn1.to_v",
|
| 258 |
+
"transformer_blocks.22.audio_attn1.to_gate_logits",
|
| 259 |
+
"transformer_blocks.22.audio_attn1.to_out.0",
|
| 260 |
+
"transformer_blocks.22.audio_attn2.to_q",
|
| 261 |
+
"transformer_blocks.22.audio_attn2.to_k",
|
| 262 |
+
"transformer_blocks.22.audio_attn2.to_v",
|
| 263 |
+
"transformer_blocks.22.audio_attn2.to_gate_logits",
|
| 264 |
+
"transformer_blocks.22.audio_attn2.to_out.0",
|
| 265 |
+
"transformer_blocks.22.audio_ff.net.0.proj",
|
| 266 |
+
"transformer_blocks.22.audio_ff.net.2",
|
| 267 |
+
"transformer_blocks.23.audio_attn1.to_q",
|
| 268 |
+
"transformer_blocks.23.audio_attn1.to_k",
|
| 269 |
+
"transformer_blocks.23.audio_attn1.to_v",
|
| 270 |
+
"transformer_blocks.23.audio_attn1.to_gate_logits",
|
| 271 |
+
"transformer_blocks.23.audio_attn1.to_out.0",
|
| 272 |
+
"transformer_blocks.23.audio_attn2.to_q",
|
| 273 |
+
"transformer_blocks.23.audio_attn2.to_k",
|
| 274 |
+
"transformer_blocks.23.audio_attn2.to_v",
|
| 275 |
+
"transformer_blocks.23.audio_attn2.to_gate_logits",
|
| 276 |
+
"transformer_blocks.23.audio_attn2.to_out.0",
|
| 277 |
+
"transformer_blocks.23.audio_ff.net.0.proj",
|
| 278 |
+
"transformer_blocks.23.audio_ff.net.2",
|
| 279 |
+
"transformer_blocks.24.audio_attn1.to_q",
|
| 280 |
+
"transformer_blocks.24.audio_attn1.to_k",
|
| 281 |
+
"transformer_blocks.24.audio_attn1.to_v",
|
| 282 |
+
"transformer_blocks.24.audio_attn1.to_gate_logits",
|
| 283 |
+
"transformer_blocks.24.audio_attn1.to_out.0",
|
| 284 |
+
"transformer_blocks.24.audio_attn2.to_q",
|
| 285 |
+
"transformer_blocks.24.audio_attn2.to_k",
|
| 286 |
+
"transformer_blocks.24.audio_attn2.to_v",
|
| 287 |
+
"transformer_blocks.24.audio_attn2.to_gate_logits",
|
| 288 |
+
"transformer_blocks.24.audio_attn2.to_out.0",
|
| 289 |
+
"transformer_blocks.24.audio_ff.net.0.proj",
|
| 290 |
+
"transformer_blocks.24.audio_ff.net.2",
|
| 291 |
+
"transformer_blocks.25.audio_attn1.to_q",
|
| 292 |
+
"transformer_blocks.25.audio_attn1.to_k",
|
| 293 |
+
"transformer_blocks.25.audio_attn1.to_v",
|
| 294 |
+
"transformer_blocks.25.audio_attn1.to_gate_logits",
|
| 295 |
+
"transformer_blocks.25.audio_attn1.to_out.0",
|
| 296 |
+
"transformer_blocks.25.audio_attn2.to_q",
|
| 297 |
+
"transformer_blocks.25.audio_attn2.to_k",
|
| 298 |
+
"transformer_blocks.25.audio_attn2.to_v",
|
| 299 |
+
"transformer_blocks.25.audio_attn2.to_gate_logits",
|
| 300 |
+
"transformer_blocks.25.audio_attn2.to_out.0",
|
| 301 |
+
"transformer_blocks.25.audio_ff.net.0.proj",
|
| 302 |
+
"transformer_blocks.25.audio_ff.net.2",
|
| 303 |
+
"transformer_blocks.26.audio_attn1.to_q",
|
| 304 |
+
"transformer_blocks.26.audio_attn1.to_k",
|
| 305 |
+
"transformer_blocks.26.audio_attn1.to_v",
|
| 306 |
+
"transformer_blocks.26.audio_attn1.to_gate_logits",
|
| 307 |
+
"transformer_blocks.26.audio_attn1.to_out.0",
|
| 308 |
+
"transformer_blocks.26.audio_attn2.to_q",
|
| 309 |
+
"transformer_blocks.26.audio_attn2.to_k",
|
| 310 |
+
"transformer_blocks.26.audio_attn2.to_v",
|
| 311 |
+
"transformer_blocks.26.audio_attn2.to_gate_logits",
|
| 312 |
+
"transformer_blocks.26.audio_attn2.to_out.0",
|
| 313 |
+
"transformer_blocks.26.audio_ff.net.0.proj",
|
| 314 |
+
"transformer_blocks.26.audio_ff.net.2",
|
| 315 |
+
"transformer_blocks.27.audio_attn1.to_q",
|
| 316 |
+
"transformer_blocks.27.audio_attn1.to_k",
|
| 317 |
+
"transformer_blocks.27.audio_attn1.to_v",
|
| 318 |
+
"transformer_blocks.27.audio_attn1.to_gate_logits",
|
| 319 |
+
"transformer_blocks.27.audio_attn1.to_out.0",
|
| 320 |
+
"transformer_blocks.27.audio_attn2.to_q",
|
| 321 |
+
"transformer_blocks.27.audio_attn2.to_k",
|
| 322 |
+
"transformer_blocks.27.audio_attn2.to_v",
|
| 323 |
+
"transformer_blocks.27.audio_attn2.to_gate_logits",
|
| 324 |
+
"transformer_blocks.27.audio_attn2.to_out.0",
|
| 325 |
+
"transformer_blocks.27.audio_ff.net.0.proj",
|
| 326 |
+
"transformer_blocks.27.audio_ff.net.2",
|
| 327 |
+
"transformer_blocks.28.audio_attn1.to_q",
|
| 328 |
+
"transformer_blocks.28.audio_attn1.to_k",
|
| 329 |
+
"transformer_blocks.28.audio_attn1.to_v",
|
| 330 |
+
"transformer_blocks.28.audio_attn1.to_gate_logits",
|
| 331 |
+
"transformer_blocks.28.audio_attn1.to_out.0",
|
| 332 |
+
"transformer_blocks.28.audio_attn2.to_q",
|
| 333 |
+
"transformer_blocks.28.audio_attn2.to_k",
|
| 334 |
+
"transformer_blocks.28.audio_attn2.to_v",
|
| 335 |
+
"transformer_blocks.28.audio_attn2.to_gate_logits",
|
| 336 |
+
"transformer_blocks.28.audio_attn2.to_out.0",
|
| 337 |
+
"transformer_blocks.28.audio_ff.net.0.proj",
|
| 338 |
+
"transformer_blocks.28.audio_ff.net.2",
|
| 339 |
+
"transformer_blocks.29.audio_attn1.to_q",
|
| 340 |
+
"transformer_blocks.29.audio_attn1.to_k",
|
| 341 |
+
"transformer_blocks.29.audio_attn1.to_v",
|
| 342 |
+
"transformer_blocks.29.audio_attn1.to_gate_logits",
|
| 343 |
+
"transformer_blocks.29.audio_attn1.to_out.0",
|
| 344 |
+
"transformer_blocks.29.audio_attn2.to_q",
|
| 345 |
+
"transformer_blocks.29.audio_attn2.to_k",
|
| 346 |
+
"transformer_blocks.29.audio_attn2.to_v",
|
| 347 |
+
"transformer_blocks.29.audio_attn2.to_gate_logits",
|
| 348 |
+
"transformer_blocks.29.audio_attn2.to_out.0",
|
| 349 |
+
"transformer_blocks.29.audio_ff.net.0.proj",
|
| 350 |
+
"transformer_blocks.29.audio_ff.net.2",
|
| 351 |
+
"transformer_blocks.30.audio_attn1.to_q",
|
| 352 |
+
"transformer_blocks.30.audio_attn1.to_k",
|
| 353 |
+
"transformer_blocks.30.audio_attn1.to_v",
|
| 354 |
+
"transformer_blocks.30.audio_attn1.to_gate_logits",
|
| 355 |
+
"transformer_blocks.30.audio_attn1.to_out.0",
|
| 356 |
+
"transformer_blocks.30.audio_attn2.to_q",
|
| 357 |
+
"transformer_blocks.30.audio_attn2.to_k",
|
| 358 |
+
"transformer_blocks.30.audio_attn2.to_v",
|
| 359 |
+
"transformer_blocks.30.audio_attn2.to_gate_logits",
|
| 360 |
+
"transformer_blocks.30.audio_attn2.to_out.0",
|
| 361 |
+
"transformer_blocks.30.audio_ff.net.0.proj",
|
| 362 |
+
"transformer_blocks.30.audio_ff.net.2",
|
| 363 |
+
"transformer_blocks.31.audio_attn1.to_q",
|
| 364 |
+
"transformer_blocks.31.audio_attn1.to_k",
|
| 365 |
+
"transformer_blocks.31.audio_attn1.to_v",
|
| 366 |
+
"transformer_blocks.31.audio_attn1.to_gate_logits",
|
| 367 |
+
"transformer_blocks.31.audio_attn1.to_out.0",
|
| 368 |
+
"transformer_blocks.31.audio_attn2.to_q",
|
| 369 |
+
"transformer_blocks.31.audio_attn2.to_k",
|
| 370 |
+
"transformer_blocks.31.audio_attn2.to_v",
|
| 371 |
+
"transformer_blocks.31.audio_attn2.to_gate_logits",
|
| 372 |
+
"transformer_blocks.31.audio_attn2.to_out.0",
|
| 373 |
+
"transformer_blocks.31.audio_ff.net.0.proj",
|
| 374 |
+
"transformer_blocks.31.audio_ff.net.2",
|
| 375 |
+
"transformer_blocks.32.audio_attn1.to_q",
|
| 376 |
+
"transformer_blocks.32.audio_attn1.to_k",
|
| 377 |
+
"transformer_blocks.32.audio_attn1.to_v",
|
| 378 |
+
"transformer_blocks.32.audio_attn1.to_gate_logits",
|
| 379 |
+
"transformer_blocks.32.audio_attn1.to_out.0",
|
| 380 |
+
"transformer_blocks.32.audio_attn2.to_q",
|
| 381 |
+
"transformer_blocks.32.audio_attn2.to_k",
|
| 382 |
+
"transformer_blocks.32.audio_attn2.to_v",
|
| 383 |
+
"transformer_blocks.32.audio_attn2.to_gate_logits",
|
| 384 |
+
"transformer_blocks.32.audio_attn2.to_out.0",
|
| 385 |
+
"transformer_blocks.32.audio_ff.net.0.proj",
|
| 386 |
+
"transformer_blocks.32.audio_ff.net.2",
|
| 387 |
+
"transformer_blocks.33.audio_attn1.to_q",
|
| 388 |
+
"transformer_blocks.33.audio_attn1.to_k",
|
| 389 |
+
"transformer_blocks.33.audio_attn1.to_v",
|
| 390 |
+
"transformer_blocks.33.audio_attn1.to_gate_logits",
|
| 391 |
+
"transformer_blocks.33.audio_attn1.to_out.0",
|
| 392 |
+
"transformer_blocks.33.audio_attn2.to_q",
|
| 393 |
+
"transformer_blocks.33.audio_attn2.to_k",
|
| 394 |
+
"transformer_blocks.33.audio_attn2.to_v",
|
| 395 |
+
"transformer_blocks.33.audio_attn2.to_gate_logits",
|
| 396 |
+
"transformer_blocks.33.audio_attn2.to_out.0",
|
| 397 |
+
"transformer_blocks.33.audio_ff.net.0.proj",
|
| 398 |
+
"transformer_blocks.33.audio_ff.net.2",
|
| 399 |
+
"transformer_blocks.34.audio_attn1.to_q",
|
| 400 |
+
"transformer_blocks.34.audio_attn1.to_k",
|
| 401 |
+
"transformer_blocks.34.audio_attn1.to_v",
|
| 402 |
+
"transformer_blocks.34.audio_attn1.to_gate_logits",
|
| 403 |
+
"transformer_blocks.34.audio_attn1.to_out.0",
|
| 404 |
+
"transformer_blocks.34.audio_attn2.to_q",
|
| 405 |
+
"transformer_blocks.34.audio_attn2.to_k",
|
| 406 |
+
"transformer_blocks.34.audio_attn2.to_v",
|
| 407 |
+
"transformer_blocks.34.audio_attn2.to_gate_logits",
|
| 408 |
+
"transformer_blocks.34.audio_attn2.to_out.0",
|
| 409 |
+
"transformer_blocks.34.audio_ff.net.0.proj",
|
| 410 |
+
"transformer_blocks.34.audio_ff.net.2",
|
| 411 |
+
"transformer_blocks.35.audio_attn1.to_q",
|
| 412 |
+
"transformer_blocks.35.audio_attn1.to_k",
|
| 413 |
+
"transformer_blocks.35.audio_attn1.to_v",
|
| 414 |
+
"transformer_blocks.35.audio_attn1.to_gate_logits",
|
| 415 |
+
"transformer_blocks.35.audio_attn1.to_out.0",
|
| 416 |
+
"transformer_blocks.35.audio_attn2.to_q",
|
| 417 |
+
"transformer_blocks.35.audio_attn2.to_k",
|
| 418 |
+
"transformer_blocks.35.audio_attn2.to_v",
|
| 419 |
+
"transformer_blocks.35.audio_attn2.to_gate_logits",
|
| 420 |
+
"transformer_blocks.35.audio_attn2.to_out.0",
|
| 421 |
+
"transformer_blocks.35.audio_ff.net.0.proj",
|
| 422 |
+
"transformer_blocks.35.audio_ff.net.2",
|
| 423 |
+
"transformer_blocks.36.audio_attn1.to_q",
|
| 424 |
+
"transformer_blocks.36.audio_attn1.to_k",
|
| 425 |
+
"transformer_blocks.36.audio_attn1.to_v",
|
| 426 |
+
"transformer_blocks.36.audio_attn1.to_gate_logits",
|
| 427 |
+
"transformer_blocks.36.audio_attn1.to_out.0",
|
| 428 |
+
"transformer_blocks.36.audio_attn2.to_q",
|
| 429 |
+
"transformer_blocks.36.audio_attn2.to_k",
|
| 430 |
+
"transformer_blocks.36.audio_attn2.to_v",
|
| 431 |
+
"transformer_blocks.36.audio_attn2.to_gate_logits",
|
| 432 |
+
"transformer_blocks.36.audio_attn2.to_out.0",
|
| 433 |
+
"transformer_blocks.36.audio_ff.net.0.proj",
|
| 434 |
+
"transformer_blocks.36.audio_ff.net.2",
|
| 435 |
+
"transformer_blocks.37.audio_attn1.to_q",
|
| 436 |
+
"transformer_blocks.37.audio_attn1.to_k",
|
| 437 |
+
"transformer_blocks.37.audio_attn1.to_v",
|
| 438 |
+
"transformer_blocks.37.audio_attn1.to_gate_logits",
|
| 439 |
+
"transformer_blocks.37.audio_attn1.to_out.0",
|
| 440 |
+
"transformer_blocks.37.audio_attn2.to_q",
|
| 441 |
+
"transformer_blocks.37.audio_attn2.to_k",
|
| 442 |
+
"transformer_blocks.37.audio_attn2.to_v",
|
| 443 |
+
"transformer_blocks.37.audio_attn2.to_gate_logits",
|
| 444 |
+
"transformer_blocks.37.audio_attn2.to_out.0",
|
| 445 |
+
"transformer_blocks.37.audio_ff.net.0.proj",
|
| 446 |
+
"transformer_blocks.37.audio_ff.net.2",
|
| 447 |
+
"transformer_blocks.38.audio_attn1.to_q",
|
| 448 |
+
"transformer_blocks.38.audio_attn1.to_k",
|
| 449 |
+
"transformer_blocks.38.audio_attn1.to_v",
|
| 450 |
+
"transformer_blocks.38.audio_attn1.to_gate_logits",
|
| 451 |
+
"transformer_blocks.38.audio_attn1.to_out.0",
|
| 452 |
+
"transformer_blocks.38.audio_attn2.to_q",
|
| 453 |
+
"transformer_blocks.38.audio_attn2.to_k",
|
| 454 |
+
"transformer_blocks.38.audio_attn2.to_v",
|
| 455 |
+
"transformer_blocks.38.audio_attn2.to_gate_logits",
|
| 456 |
+
"transformer_blocks.38.audio_attn2.to_out.0",
|
| 457 |
+
"transformer_blocks.38.audio_ff.net.0.proj",
|
| 458 |
+
"transformer_blocks.38.audio_ff.net.2",
|
| 459 |
+
"transformer_blocks.39.audio_attn1.to_q",
|
| 460 |
+
"transformer_blocks.39.audio_attn1.to_k",
|
| 461 |
+
"transformer_blocks.39.audio_attn1.to_v",
|
| 462 |
+
"transformer_blocks.39.audio_attn1.to_gate_logits",
|
| 463 |
+
"transformer_blocks.39.audio_attn1.to_out.0",
|
| 464 |
+
"transformer_blocks.39.audio_attn2.to_q",
|
| 465 |
+
"transformer_blocks.39.audio_attn2.to_k",
|
| 466 |
+
"transformer_blocks.39.audio_attn2.to_v",
|
| 467 |
+
"transformer_blocks.39.audio_attn2.to_gate_logits",
|
| 468 |
+
"transformer_blocks.39.audio_attn2.to_out.0",
|
| 469 |
+
"transformer_blocks.39.audio_ff.net.0.proj",
|
| 470 |
+
"transformer_blocks.39.audio_ff.net.2",
|
| 471 |
+
"transformer_blocks.40.audio_attn1.to_q",
|
| 472 |
+
"transformer_blocks.40.audio_attn1.to_k",
|
| 473 |
+
"transformer_blocks.40.audio_attn1.to_v",
|
| 474 |
+
"transformer_blocks.40.audio_attn1.to_gate_logits",
|
| 475 |
+
"transformer_blocks.40.audio_attn1.to_out.0",
|
| 476 |
+
"transformer_blocks.40.audio_attn2.to_q",
|
| 477 |
+
"transformer_blocks.40.audio_attn2.to_k",
|
| 478 |
+
"transformer_blocks.40.audio_attn2.to_v",
|
| 479 |
+
"transformer_blocks.40.audio_attn2.to_gate_logits",
|
| 480 |
+
"transformer_blocks.40.audio_attn2.to_out.0",
|
| 481 |
+
"transformer_blocks.40.audio_ff.net.0.proj",
|
| 482 |
+
"transformer_blocks.40.audio_ff.net.2",
|
| 483 |
+
"transformer_blocks.41.audio_attn1.to_q",
|
| 484 |
+
"transformer_blocks.41.audio_attn1.to_k",
|
| 485 |
+
"transformer_blocks.41.audio_attn1.to_v",
|
| 486 |
+
"transformer_blocks.41.audio_attn1.to_gate_logits",
|
| 487 |
+
"transformer_blocks.41.audio_attn1.to_out.0",
|
| 488 |
+
"transformer_blocks.41.audio_attn2.to_q",
|
| 489 |
+
"transformer_blocks.41.audio_attn2.to_k",
|
| 490 |
+
"transformer_blocks.41.audio_attn2.to_v",
|
| 491 |
+
"transformer_blocks.41.audio_attn2.to_gate_logits",
|
| 492 |
+
"transformer_blocks.41.audio_attn2.to_out.0",
|
| 493 |
+
"transformer_blocks.41.audio_ff.net.0.proj",
|
| 494 |
+
"transformer_blocks.41.audio_ff.net.2",
|
| 495 |
+
"transformer_blocks.42.audio_attn1.to_q",
|
| 496 |
+
"transformer_blocks.42.audio_attn1.to_k",
|
| 497 |
+
"transformer_blocks.42.audio_attn1.to_v",
|
| 498 |
+
"transformer_blocks.42.audio_attn1.to_gate_logits",
|
| 499 |
+
"transformer_blocks.42.audio_attn1.to_out.0",
|
| 500 |
+
"transformer_blocks.42.audio_attn2.to_q",
|
| 501 |
+
"transformer_blocks.42.audio_attn2.to_k",
|
| 502 |
+
"transformer_blocks.42.audio_attn2.to_v",
|
| 503 |
+
"transformer_blocks.42.audio_attn2.to_gate_logits",
|
| 504 |
+
"transformer_blocks.42.audio_attn2.to_out.0",
|
| 505 |
+
"transformer_blocks.42.audio_ff.net.0.proj",
|
| 506 |
+
"transformer_blocks.42.audio_ff.net.2",
|
| 507 |
+
"transformer_blocks.43.audio_attn1.to_q",
|
| 508 |
+
"transformer_blocks.43.audio_attn1.to_k",
|
| 509 |
+
"transformer_blocks.43.audio_attn1.to_v",
|
| 510 |
+
"transformer_blocks.43.audio_attn1.to_gate_logits",
|
| 511 |
+
"transformer_blocks.43.audio_attn1.to_out.0",
|
| 512 |
+
"transformer_blocks.43.audio_attn2.to_q",
|
| 513 |
+
"transformer_blocks.43.audio_attn2.to_k",
|
| 514 |
+
"transformer_blocks.43.audio_attn2.to_v",
|
| 515 |
+
"transformer_blocks.43.audio_attn2.to_gate_logits",
|
| 516 |
+
"transformer_blocks.43.audio_attn2.to_out.0",
|
| 517 |
+
"transformer_blocks.43.audio_ff.net.0.proj",
|
| 518 |
+
"transformer_blocks.43.audio_ff.net.2",
|
| 519 |
+
"transformer_blocks.44.audio_attn1.to_q",
|
| 520 |
+
"transformer_blocks.44.audio_attn1.to_k",
|
| 521 |
+
"transformer_blocks.44.audio_attn1.to_v",
|
| 522 |
+
"transformer_blocks.44.audio_attn1.to_gate_logits",
|
| 523 |
+
"transformer_blocks.44.audio_attn1.to_out.0",
|
| 524 |
+
"transformer_blocks.44.audio_attn2.to_q",
|
| 525 |
+
"transformer_blocks.44.audio_attn2.to_k",
|
| 526 |
+
"transformer_blocks.44.audio_attn2.to_v",
|
| 527 |
+
"transformer_blocks.44.audio_attn2.to_gate_logits",
|
| 528 |
+
"transformer_blocks.44.audio_attn2.to_out.0",
|
| 529 |
+
"transformer_blocks.44.audio_ff.net.0.proj",
|
| 530 |
+
"transformer_blocks.44.audio_ff.net.2",
|
| 531 |
+
"transformer_blocks.45.audio_attn1.to_q",
|
| 532 |
+
"transformer_blocks.45.audio_attn1.to_k",
|
| 533 |
+
"transformer_blocks.45.audio_attn1.to_v",
|
| 534 |
+
"transformer_blocks.45.audio_attn1.to_gate_logits",
|
| 535 |
+
"transformer_blocks.45.audio_attn1.to_out.0",
|
| 536 |
+
"transformer_blocks.45.audio_attn2.to_q",
|
| 537 |
+
"transformer_blocks.45.audio_attn2.to_k",
|
| 538 |
+
"transformer_blocks.45.audio_attn2.to_v",
|
| 539 |
+
"transformer_blocks.45.audio_attn2.to_gate_logits",
|
| 540 |
+
"transformer_blocks.45.audio_attn2.to_out.0",
|
| 541 |
+
"transformer_blocks.45.audio_ff.net.0.proj",
|
| 542 |
+
"transformer_blocks.45.audio_ff.net.2",
|
| 543 |
+
"transformer_blocks.46.audio_attn1.to_q",
|
| 544 |
+
"transformer_blocks.46.audio_attn1.to_k",
|
| 545 |
+
"transformer_blocks.46.audio_attn1.to_v",
|
| 546 |
+
"transformer_blocks.46.audio_attn1.to_gate_logits",
|
| 547 |
+
"transformer_blocks.46.audio_attn1.to_out.0",
|
| 548 |
+
"transformer_blocks.46.audio_attn2.to_q",
|
| 549 |
+
"transformer_blocks.46.audio_attn2.to_k",
|
| 550 |
+
"transformer_blocks.46.audio_attn2.to_v",
|
| 551 |
+
"transformer_blocks.46.audio_attn2.to_gate_logits",
|
| 552 |
+
"transformer_blocks.46.audio_attn2.to_out.0",
|
| 553 |
+
"transformer_blocks.46.audio_ff.net.0.proj",
|
| 554 |
+
"transformer_blocks.46.audio_ff.net.2",
|
| 555 |
+
"transformer_blocks.47.audio_attn1.to_q",
|
| 556 |
+
"transformer_blocks.47.audio_attn1.to_k",
|
| 557 |
+
"transformer_blocks.47.audio_attn1.to_v",
|
| 558 |
+
"transformer_blocks.47.audio_attn1.to_gate_logits",
|
| 559 |
+
"transformer_blocks.47.audio_attn1.to_out.0",
|
| 560 |
+
"transformer_blocks.47.audio_attn2.to_q",
|
| 561 |
+
"transformer_blocks.47.audio_attn2.to_k",
|
| 562 |
+
"transformer_blocks.47.audio_attn2.to_v",
|
| 563 |
+
"transformer_blocks.47.audio_attn2.to_gate_logits",
|
| 564 |
+
"transformer_blocks.47.audio_attn2.to_out.0",
|
| 565 |
+
"transformer_blocks.47.audio_ff.net.0.proj",
|
| 566 |
+
"transformer_blocks.47.audio_ff.net.2"
|
| 567 |
+
],
|
| 568 |
+
"non_quantized_types": [
|
| 569 |
+
"norm",
|
| 570 |
+
"adaln",
|
| 571 |
+
"timestep_embedder",
|
| 572 |
+
"early_ffn_output"
|
| 573 |
+
],
|
| 574 |
+
"ffn_output_start_block": 15,
|
| 575 |
+
"ffn_output_skip_blocks": [
|
| 576 |
+
17
|
| 577 |
+
],
|
| 578 |
+
"base_model": "resemble-ai/DramaBox",
|
| 579 |
+
"quantization_method": "torchao Int8WeightOnlyConfig",
|
| 580 |
+
"metrics": {
|
| 581 |
+
"peak_vram_gb": 13.8,
|
| 582 |
+
"vram_during_denoise_gb": 5.93,
|
| 583 |
+
"quality_mcd_db": 4.98,
|
| 584 |
+
"baseline_peak_vram_gb": 17.39
|
| 585 |
+
}
|
| 586 |
+
}
|
dramabox-dit-int8-selective.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d4daf0e54f5f850c9bfe9dab555fd5a9b51603bcf26a0bd3b526712ec14b553e
|
| 3 |
+
size 3615964256
|
inference_optimized.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Optimized DramaBox inference: INT8 DiT + Gemma CPU offload.
|
| 2 |
+
|
| 3 |
+
Drops denoising-phase VRAM from 17.4 GB to 5.9 GB, making DramaBox usable
|
| 4 |
+
on 16 GB GPUs. Quality is preserved (MCD < 5.0 dB vs BF16 baseline).
|
| 5 |
+
|
| 6 |
+
Usage:
|
| 7 |
+
python inference_optimized.py --text "Hello world!" --output output.wav
|
| 8 |
+
|
| 9 |
+
Requires the standard DramaBox installation plus `torchao`.
|
| 10 |
+
"""
|
| 11 |
+
import argparse
|
| 12 |
+
import logging
|
| 13 |
+
import re
|
| 14 |
+
import sys
|
| 15 |
+
import time
|
| 16 |
+
|
| 17 |
+
import torch
|
| 18 |
+
|
| 19 |
+
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def apply_int8_quantization(tts):
|
| 23 |
+
"""Apply selective INT8 weight-only quantization to the DiT."""
|
| 24 |
+
from torchao.quantization import quantize_, Int8WeightOnlyConfig
|
| 25 |
+
|
| 26 |
+
attn_proj_keys = ("to_q", "to_k", "to_v", "to_out")
|
| 27 |
+
FFN_START = 15
|
| 28 |
+
FFN_SKIP = {17}
|
| 29 |
+
|
| 30 |
+
def dit_filter(mod, fqn):
|
| 31 |
+
if not isinstance(mod, torch.nn.Linear):
|
| 32 |
+
return False
|
| 33 |
+
if "norm" in fqn:
|
| 34 |
+
return False
|
| 35 |
+
if "gate_logits" in fqn:
|
| 36 |
+
return True
|
| 37 |
+
if any(k in fqn for k in attn_proj_keys):
|
| 38 |
+
return True
|
| 39 |
+
if "audio_ff" in fqn:
|
| 40 |
+
m = re.search(r"transformer_blocks\.(\d+)\.", fqn)
|
| 41 |
+
if m:
|
| 42 |
+
idx = int(m.group(1))
|
| 43 |
+
if "net.2" in fqn and idx >= FFN_START and idx not in FFN_SKIP:
|
| 44 |
+
return True
|
| 45 |
+
if "net.0.proj" in fqn:
|
| 46 |
+
return True
|
| 47 |
+
return False
|
| 48 |
+
|
| 49 |
+
def io_filter(mod, fqn):
|
| 50 |
+
return fqn in ("audio_patchify_proj", "audio_proj_out") and isinstance(
|
| 51 |
+
mod, torch.nn.Linear
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
logging.info("Applying INT8 quantization to DiT...")
|
| 55 |
+
quantize_(tts._velocity_model, Int8WeightOnlyConfig(), filter_fn=dit_filter)
|
| 56 |
+
quantize_(tts._velocity_model, Int8WeightOnlyConfig(), filter_fn=io_filter)
|
| 57 |
+
|
| 58 |
+
vram = torch.cuda.memory_allocated(0) / (1024**3)
|
| 59 |
+
logging.info(f"INT8 applied. VRAM: {vram:.2f} GB")
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def apply_gemma_offload(tts):
|
| 63 |
+
"""Patch PromptEncoder to offload Gemma 12B to CPU between uses."""
|
| 64 |
+
pe = tts._prompt_encoder
|
| 65 |
+
pe_cls = type(pe)
|
| 66 |
+
orig_call = pe_cls.__call__
|
| 67 |
+
|
| 68 |
+
def _offload_call(self, prompts, **kwargs):
|
| 69 |
+
if not (self._warm and self._warm_text_encoder is not None):
|
| 70 |
+
return orig_call(self, prompts, **kwargs)
|
| 71 |
+
|
| 72 |
+
te = self._warm_text_encoder
|
| 73 |
+
is_on_cpu = next(te.parameters()).device.type == "cpu"
|
| 74 |
+
|
| 75 |
+
if is_on_cpu:
|
| 76 |
+
logging.info("Moving Gemma to GPU...")
|
| 77 |
+
te.to(tts.device)
|
| 78 |
+
|
| 79 |
+
raw_outputs = [te.encode(p) for p in prompts]
|
| 80 |
+
|
| 81 |
+
logging.info("Offloading Gemma to CPU...")
|
| 82 |
+
te.to("cpu")
|
| 83 |
+
torch.cuda.empty_cache()
|
| 84 |
+
|
| 85 |
+
ep = self._warm_embeddings_processor
|
| 86 |
+
return [ep.process_hidden_states(hs, mask) for hs, mask in raw_outputs]
|
| 87 |
+
|
| 88 |
+
pe_cls.__call__ = _offload_call
|
| 89 |
+
logging.info("Gemma CPU offload enabled")
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def main():
|
| 93 |
+
parser = argparse.ArgumentParser(description="DramaBox INT8 optimized inference")
|
| 94 |
+
parser.add_argument("--text", required=True, help="Text to synthesize")
|
| 95 |
+
parser.add_argument("--output", default="output.wav", help="Output WAV path")
|
| 96 |
+
parser.add_argument(
|
| 97 |
+
"--no-offload", action="store_true", help="Disable Gemma CPU offload"
|
| 98 |
+
)
|
| 99 |
+
parser.add_argument(
|
| 100 |
+
"--no-quantize", action="store_true", help="Disable INT8 quantization"
|
| 101 |
+
)
|
| 102 |
+
args = parser.parse_args()
|
| 103 |
+
|
| 104 |
+
sys.path.insert(0, "/app/dramabox/src")
|
| 105 |
+
from model_downloader import get_all_paths
|
| 106 |
+
from inference_server import TTSServer
|
| 107 |
+
|
| 108 |
+
paths = get_all_paths()
|
| 109 |
+
logging.info("Loading DramaBox...")
|
| 110 |
+
tts = TTSServer(
|
| 111 |
+
checkpoint=paths["transformer"],
|
| 112 |
+
full_checkpoint=paths["audio_components"],
|
| 113 |
+
gemma_root=paths["gemma_root"],
|
| 114 |
+
device="cuda",
|
| 115 |
+
dtype="bf16",
|
| 116 |
+
compile_model=False,
|
| 117 |
+
bnb_4bit=True,
|
| 118 |
+
)
|
| 119 |
+
|
| 120 |
+
if not args.no_quantize:
|
| 121 |
+
apply_int8_quantization(tts)
|
| 122 |
+
|
| 123 |
+
if not args.no_offload:
|
| 124 |
+
apply_gemma_offload(tts)
|
| 125 |
+
|
| 126 |
+
logging.info(f"Generating: {args.text[:80]}...")
|
| 127 |
+
t0 = time.time()
|
| 128 |
+
result = tts.generate(
|
| 129 |
+
prompts=[{"text": args.text}],
|
| 130 |
+
return_type="file",
|
| 131 |
+
output_path=args.output,
|
| 132 |
+
)
|
| 133 |
+
elapsed = time.time() - t0
|
| 134 |
+
|
| 135 |
+
peak_vram = torch.cuda.max_memory_allocated(0) / (1024**3)
|
| 136 |
+
logging.info(
|
| 137 |
+
f"Done in {elapsed:.2f}s | Peak VRAM: {peak_vram:.2f} GB | Saved: {args.output}"
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
if __name__ == "__main__":
|
| 142 |
+
main()
|
load_int8.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Load pre-quantized INT8 DramaBox DiT weights from safetensors.
|
| 2 |
+
|
| 3 |
+
Quantized layers are stored as:
|
| 4 |
+
{layer_name}.weight.__int_data (INT8 tensor)
|
| 5 |
+
{layer_name}.weight.__scale (BF16 per-channel scale)
|
| 6 |
+
|
| 7 |
+
Non-quantized layers are stored as plain BF16 tensors.
|
| 8 |
+
|
| 9 |
+
Usage:
|
| 10 |
+
from load_int8 import load_int8_dit
|
| 11 |
+
load_int8_dit(tts._velocity_model, "dramabox-dit-int8-selective.safetensors")
|
| 12 |
+
"""
|
| 13 |
+
import json
|
| 14 |
+
import logging
|
| 15 |
+
import os
|
| 16 |
+
|
| 17 |
+
import torch
|
| 18 |
+
from safetensors.torch import load_file
|
| 19 |
+
|
| 20 |
+
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def load_int8_dit(
|
| 24 |
+
model: torch.nn.Module,
|
| 25 |
+
safetensors_path: str,
|
| 26 |
+
config_path: str | None = None,
|
| 27 |
+
device: str = "cuda",
|
| 28 |
+
) -> torch.nn.Module:
|
| 29 |
+
"""Replace model weights with pre-quantized INT8 weights from safetensors.
|
| 30 |
+
|
| 31 |
+
For quantized layers, reconstructs the dequantized BF16 weight from
|
| 32 |
+
int_data * scale (equivalent to what torchao does at runtime, but without
|
| 33 |
+
needing torchao installed for loading).
|
| 34 |
+
|
| 35 |
+
For runtime INT8 inference (keeping weights in INT8 and dequantizing during
|
| 36 |
+
matmul), use the torchao approach instead — see README.md Option 1.
|
| 37 |
+
"""
|
| 38 |
+
if config_path is None:
|
| 39 |
+
config_path = os.path.join(os.path.dirname(safetensors_path), "config.json")
|
| 40 |
+
|
| 41 |
+
tensors = load_file(safetensors_path, device=device)
|
| 42 |
+
logging.info(f"Loaded {len(tensors)} tensors from {safetensors_path}")
|
| 43 |
+
|
| 44 |
+
int_data_suffix = ".weight.__int_data"
|
| 45 |
+
scale_suffix = ".weight.__scale"
|
| 46 |
+
|
| 47 |
+
quantized_names = set()
|
| 48 |
+
for key in tensors:
|
| 49 |
+
if key.endswith(int_data_suffix):
|
| 50 |
+
name = key[: -len(int_data_suffix)]
|
| 51 |
+
quantized_names.add(name)
|
| 52 |
+
|
| 53 |
+
sd = model.state_dict()
|
| 54 |
+
loaded, skipped = 0, 0
|
| 55 |
+
|
| 56 |
+
for key in list(sd.keys()):
|
| 57 |
+
parts = key.rsplit(".", 1)
|
| 58 |
+
if len(parts) == 2:
|
| 59 |
+
layer_name, param_name = parts
|
| 60 |
+
else:
|
| 61 |
+
layer_name, param_name = "", parts[0]
|
| 62 |
+
|
| 63 |
+
if layer_name in quantized_names and param_name == "weight":
|
| 64 |
+
int_data = tensors[f"{layer_name}{int_data_suffix}"]
|
| 65 |
+
scale = tensors[f"{layer_name}{scale_suffix}"]
|
| 66 |
+
sd[key] = (int_data.float() * scale.unsqueeze(1)).to(torch.bfloat16)
|
| 67 |
+
loaded += 1
|
| 68 |
+
elif key in tensors:
|
| 69 |
+
sd[key] = tensors[key]
|
| 70 |
+
loaded += 1
|
| 71 |
+
elif f"{layer_name}.{param_name}" in tensors:
|
| 72 |
+
sd[key] = tensors[f"{layer_name}.{param_name}"]
|
| 73 |
+
loaded += 1
|
| 74 |
+
else:
|
| 75 |
+
skipped += 1
|
| 76 |
+
|
| 77 |
+
model.load_state_dict(sd, strict=False)
|
| 78 |
+
logging.info(
|
| 79 |
+
f"Loaded {loaded} params ({len(quantized_names)} dequantized from INT8), "
|
| 80 |
+
f"skipped {skipped}"
|
| 81 |
+
)
|
| 82 |
+
return model
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def load_int8_dit_torchao(
|
| 86 |
+
model: torch.nn.Module,
|
| 87 |
+
safetensors_path: str,
|
| 88 |
+
device: str = "cuda",
|
| 89 |
+
) -> torch.nn.Module:
|
| 90 |
+
"""Load INT8 weights and apply torchao quantization for runtime INT8 matmul.
|
| 91 |
+
|
| 92 |
+
This keeps weights in INT8 during inference (lower VRAM) but requires torchao.
|
| 93 |
+
"""
|
| 94 |
+
from torchao.quantization import quantize_, Int8WeightOnlyConfig
|
| 95 |
+
|
| 96 |
+
load_int8_dit(model, safetensors_path, device=device)
|
| 97 |
+
|
| 98 |
+
config_path = os.path.join(os.path.dirname(safetensors_path), "config.json")
|
| 99 |
+
with open(config_path) as f:
|
| 100 |
+
config = json.load(f)
|
| 101 |
+
|
| 102 |
+
quantized_set = set(config["quantized_layers"])
|
| 103 |
+
|
| 104 |
+
def filter_fn(mod, fqn):
|
| 105 |
+
return isinstance(mod, torch.nn.Linear) and fqn in quantized_set
|
| 106 |
+
|
| 107 |
+
quantize_(model, Int8WeightOnlyConfig(), filter_fn=filter_fn)
|
| 108 |
+
logging.info(f"Applied torchao INT8 to {len(quantized_set)} layers")
|
| 109 |
+
return model
|