GGUF format conversion of
AudioX-Turbo, a text-to-audio diffusion model using MMDiT (Multi-Modal Diffusion Transformer) architecture with DMD 4-step distilled sampling.
1pip install torch numpy scipy gguf
2pip install transformers # for T5 text encoder
1import torch
2import numpy as np
3import scipy.io.wavfile as wavfile
4import gguf
5
6# Load T5 text encoder for conditioning
7from transformers import T5EncoderModel, T5Tokenizer
8
9device = "cpu"
10model_name = "t5-base" # Must match training config
11tokenizer = T5Tokenizer.from_pretrained(model_name)
12t5 = T5EncoderModel.from_pretrained(model_name).eval()
13
14# Load GGUF model
15import gguf
16reader = gguf.GGUFReader("mmdit-f16.gguf")
17# Note: Full C++ inference pipeline is in audiox.cpp
18
19# For Python inference, use the original checkpoint directly:
20# python3 scripts/reference_inference.py --ckpt audiox_turbo.ckpt ...
1from transformers import T5EncoderModel, T5Tokenizer
2
3tokenizer = T5Tokenizer.from_pretrained("t5-base")
4encoder = T5EncoderModel.from_pretrained("t5-base")
5
6prompt = "A woman speaking clearly and slowly"
7inputs = tokenizer(prompt, return_tensors="pt", padding=True, truncation=True, max_length=512)
8
9with torch.no_grad():
10 embeddings = encoder(**inputs).last_hidden_state # [1, seq_len, 768]
11
12np.save("text_embedding.npy", embeddings.numpy())
This reordering is applied to all 24 layers and verified to match the original weights after transformation.
1python3 convert/convert_mmdit.py audiox_turbo.ckpt mmdit-f16.gguf --dtype f16
2python3 convert/convert_vae.py vae.ckpt vae-f16.gguf --dtype f16
1python3 convert/convert_mmdit.py audiox_turbo.ckpt mmdit-q8.gguf --dtype q8_0
2python3 convert/convert_mmdit.py audiox_turbo.ckpt mmdit-q4.gguf --dtype q4_0