Text-to-Audio
Transformers
Safetensors
qadit
feature-extraction
diffusion
dit
audio
educational
research
custom_code
Instructions to use QuarkML/QaDiT-160 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuarkML/QaDiT-160 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-audio", model="QuarkML/QaDiT-160", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuarkML/QaDiT-160", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 8,724 Bytes
28a1a6d 60c2ee0 3e0b0bf 60c2ee0 261df1e ac841dc 3e0b0bf 28a1a6d 3e0b0bf 6329c21 6960906 6329c21 60c2ee0 3e0b0bf ac841dc 3e0b0bf 5c9dc48 619bb88 0523915 5c9dc48 261df1e 5c9dc48 261df1e ac841dc 261df1e ac841dc 261df1e ac841dc 261df1e ac841dc 261df1e 6585902 261df1e ac841dc 261df1e ac841dc 6585902 261df1e ac841dc 6585902 ac841dc 6585902 ac841dc 6585902 ac841dc 6585902 ac841dc 261df1e ac841dc 261df1e 5b34539 261df1e ac841dc 261df1e 5b34539 261df1e d39cb31 492ce3b 261df1e ac841dc 261df1e ac841dc 261df1e ac841dc 261df1e ac841dc 261df1e 6585902 261df1e 6585902 261df1e 6585902 261df1e 3e0b0bf 60c2ee0 3e0b0bf 261df1e 3e0b0bf 60c2ee0 3e0b0bf ac841dc 60c2ee0 3e0b0bf df78669 6615bae df78669 6615bae ac841dc 261df1e 60c2ee0 3e0b0bf 261df1e 60c2ee0 261df1e ac841dc 3e0b0bf 261df1e 6615bae 60c2ee0 261df1e 60c2ee0 3e0b0bf 60c2ee0 6615bae 60c2ee0 6615bae 261df1e 60c2ee0 3e0b0bf 261df1e 3e0b0bf 60c2ee0 3e0b0bf 261df1e ac841dc 261df1e ac841dc 261df1e 3e0b0bf 261df1e ac841dc 261df1e ac841dc 261df1e ac841dc 261df1e ac841dc 261df1e ac841dc 261df1e ac841dc 261df1e ac841dc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | ---
license: apache-2.0
library_name: transformers
tags:
- text-to-audio
- diffusion
- dit
- audio
- educational
- research
pipeline_tag: text-to-audio
---
<p align="center">
<a href="https://github.com/sidharth72/QaDiT">
<img src="https://img.shields.io/badge/GitHub-Repository-181717?logo=github&logoColor=white" alt="GitHub">
</a>
<a href="https://www.quarkml.com">
<img src="https://img.shields.io/badge/Website-QuarkML-blue?logo=googlechrome&logoColor=white" alt="Website">
</a>
<a href="https://huggingface.co/QuarkML">
<img src="https://img.shields.io/badge/Hugging%20Face-Models-yellow?logo=huggingface&logoColor=black" alt="Hugging Face">
</a>
</p>
# QaDiT β text-to-audio latent Diffusion Transformer
A ~159M-parameter latent Diffusion Transformer that turns a text caption into
**10.24 s of 16 kHz mono audio**: FLAN-T5 conditioning β DiT denoising of
AudioLDM KL-VAE latents β VAE decode β HiFi-GAN vocoder.
> Example:
> Prompt: `A small waterfall flows through a forest while insects buzz and birds sing.`
>
> Output:
>
> <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/64054e5e0ab5e22719fc179f/_RGLUAPxdImTitbAAD0g6.wav"></audio>
---
| Piece | Choice |
| --- | --- |
| Backbone | DiT-B β depth 12, width 768, 12 heads, MLP ratio 4.0 (~159M) |
| Latent grid | `[8, 256, 16]` (channels Γ time Γ freq) |
| Patchify | 2Γ2 β **1024** tokens, fixed 2-D sincos positions |
| Text | FLAN-T5-large cross-attention every block + pooled text in adaLN-Zero |
| Train target | **v-prediction** |
| Noise schedule | **cosine** αΎ±, T = 1000 |
| Timestep sampling (train) | logit-normal |
| CFG | p_uncond = 0.1 train; default guidance **4.0** at sample |
| Sampler | **DDIM**, default **50** steps, Ξ· = 0 |
| Aux loss | REPA vs frozen AST features (train only) |
| Decode stack | `cvssp/audioldm-s-full-v2` VAE + HiFi-GAN |
---
## 1. Big picture β three pipelines

---
## 2. Offline pre-compute (frozen models, run once)
Heavy frozen models run **once**; the training loop never loads T5, the VAE,
or the REPA encoder.

---
## 3. Training step (what is actually optimized)
Only the **DiT** and its small glue layers receive gradients.

---
## 4. Inside one DiT block

---
## 5. Inference / sampling (caption β waveform)

---
## 6. Component ownership

---
## Training objective (DDIM + v-prediction)
**Forward process**
$$
z_t = \sqrt{\bar{\alpha}_t}\,z_0
+ \sqrt{1-\bar{\alpha}_t}\,\varepsilon
$$
**Network target**
$$
v = \sqrt{\bar{\alpha}_t}\,\varepsilon
- \sqrt{1-\bar{\alpha}_t}\,z_0
$$
At sample time the DiT predicts `v`; we recover `\hat{z}_0` and `\hat{\varepsilon}`,
then step with **DDIM** (`\eta = 0`). CFG is applied in `v`-space with default
scale (`s = 4.0`). After DDIM, latents are divided by `latent_scale` β **0.95035**
before VAE decode β that whole chain is what `model.generate()` runs.
---
## Dataset
| | |
| --- | --- |
| Source | [OpenSound/AudioCaps](https://huggingface.co/datasets/OpenSound/AudioCaps) |
| Split | `train` Β· **45,178** clips after precompute |
| Clip length | 10.24 s @ 16 kHz |
| Cached fields | VAE latents, FLAN-T5 embeddings + mask, AST REPA targets |
| `latent_scale` | `0.9503493000009796` (baked into `config.json`) |
AudioCaps is captioned environmental / everyday sound β not speech or music.
Those domains are out of distribution for this checkpoint.
---
## Training run (this checkpoint)
| | |
| --- | --- |
| Optimizer | AdamW, lr 1e-4, weight decay 0 |
| Steps | **23,999** (EMA exported) |
| Global batch | 256 (2 GPUs Γ microbatch 16 Γ grad accum 8) |
| EMA decay | 0.9999 |
| REPA | weight 0.5, decayed over 15k steps |
| AMP | yes |
---
## Training curves
Put W&B / TensorBoard screenshots (or exports) under [`assets/`](assets/) using
the filenames below. Until then the images show as broken links on the Hub β
that is intentional so the slots are obvious.
### Diffusion / total loss

### REPA loss

---
## Usage
```bash
pip install transformers diffusers soundfile sentencepiece
```
```python
import soundfile as sf
import torch
from transformers import AutoModel
model = AutoModel.from_pretrained("QuarkML/QaDiT", trust_remote_code=True)
model = model.to("cuda" if torch.cuda.is_available() else "cpu").eval()
out = model.generate(
"A small waterfall flows through a forest while insects buzz and birds sing.",
num_inference_steps=200,
guidance_scale=16.0,
seed=0,
)
sf.write("sample.wav", out.audios[0], out.sampling_rate)
```
First `generate` downloads the frozen helpers this run was trained with:
`google/flan-t5-large` and the VAE + vocoder from `cvssp/audioldm-s-full-v2`.
### Output types
| `output_type` | Field | Content |
| --- | --- | --- |
| `"np"` (default) | `audios` | list of float32 numpy waveforms in `[-1, 1]` |
| `"pt"` | `audio_values` | `[B, num_samples]` tensor |
| `"latent"` | `latents` | `[B, 8, 256, 16]` scaled latents (skips VAE/vocoder) |
### Precomputed T5 states
```python
out = model.generate(
encoder_hidden_states=text_emb, # [B, 64, 1024]
encoder_attention_mask=text_mask, # [B, 64]
)
```
### Single denoising step
```python
v = model(latents, timesteps, encoder_hidden_states, encoder_attention_mask).sample
```
---
## Precision and devices
Runs on **CPU and CUDA**. With `dtype=torch.float16` or `torch.bfloat16` the
DiT backbone runs in half precision; DDIM schedule math stays in float32.
Keep T5 / VAE / vocoder in float32 (FLAN-T5 overflows easily in fp16).
---
## Important details
- `config.latent_scale` (**0.9503493**) must match training precompute.
`generate` divides by it before VAE decode.
- Every sample is fixed length: **10.24 s @ 16 kHz**.
- `repa_layer` exists for REPA fine-tuning; inference ignores it.
- Sampling always uses the **EMA** weights packaged here.
---
## Limitations and intended use
**Intended use:** education, reproduction of a small latent DiT audio stack,
ablations, and a starting checkpoint for longer / wider training.
**Not intended for:** production SFX libraries, speech synthesis, music
generation, or safety-critical audio.
**Known limits of this checkpoint**
- ~24k steps on ~45k AudioCaps clips β undertrained vs public SOTA systems
- Weak on speech, music, and densely described scenes
- Inherits caption biases and coverage holes of AudioCaps
- Prefer the default **50** DDIM steps for demos; low step counts sound coarse
---
## Research artifact β how to improve this
This release is a **research artifact**, not a production host model. The
architecture and sampling path are solid enough to build on; the ceiling is
mostly data and compute:
1. **Train longer** β continue past 24k steps with the same recipe (or lower LR).
2. **Scale the dataset** β mix in larger captioned audio corpora beyond AudioCaps.
3. **Retune sampling** β CFG scale, DDIM step count, and prompt formatting.
4. **Keep measuring** β log diffusion loss, REPA loss, and listening tests.
Those levers will move quality more than inventing a new backbone for this size
of model. Contributions and longer runs are welcome; treat this Hub page as a
reproducible baseline, not a finished product.
---
## Citation
```bibtex
@misc{qadit2026,
title = {QaDiT: A Text-to-Audio Latent Diffusion Transformer},
author = {Sidharth GN},
year = {2026},
note = {Research artifact. Weights and transformers remote-code loading.}
}
```
| Resource | |
| --- | --- |
| Dataset | [OpenSound/AudioCaps](https://huggingface.co/datasets/OpenSound/AudioCaps) |
| VAE / vocoder | [cvssp/audioldm-s-full-v2](https://huggingface.co/cvssp/audioldm-s-full-v2) |
| Text encoder | [google/flan-t5-large](https://huggingface.co/google/flan-t5-large) |
|