--- license: other license_name: stability-ai-community-license license_link: LICENSE.md tags: - audio - text-to-audio - music-generation - allegretto-mini - onnx - onnxruntime - local-ai - generative-ai library_name: onnxruntime pipeline_tag: text-to-audio --- # Allegretto Mini **Allegretto Mini** is a lightweight, local-first AI music generation model developed by **OSAMA INC** (India). It synthesizes stereo audio at 44.1 kHz directly from text prompts — no cloud API, no server-side GPU required. Run it entirely on your own machine. > 🤖 **HuggingFace Model**: [https://huggingface.co/Dev4285/Allegretto-Mini](https://huggingface.co/Dev4285/Allegretto-Mini) > 💻 **GitHub**: [https://github.com/aryanisproinroblox-source/Allegretto-Mini](https://github.com/aryanisproinroblox-source/Allegretto-Mini) > 🎧 **Live Demo**: [https://huggingface.co/spaces/Dev4285/Allegretto-Mini-Demo](https://huggingface.co/spaces/Dev4285/Allegretto-Mini-Demo) — try it right now in your browser! ## About OSAMA INC **OSAMA INC** is an Indian AI research company building next-generation audio synthesis tools for creators, musicians, and developers. Allegretto Mini is our flagship release — a production-grade text-to-music model designed to run locally on consumer hardware, giving users full ownership of their creative workflow without dependency on external services. | | | |---|---| | 🏢 **Company** | OSAMA INC (India) | | 🎵 **Model** | Allegretto Mini | | 🎧 **Output** | Stereo audio, 44.1 kHz | | 💾 **Size** | ~640 MB (int4 quantized) | | ⚡ **Default** | 10 seconds, 8 diffusion steps | | 🔒 **License** | Stability AI Community License | ## Quick Start — Local Inference Allegretto Mini uses ONNX Runtime so you can run inference locally on any machine — CPU or GPU — without Python or PyTorch dependencies. Just download the weights and go. ### Python (ONNX Runtime) ```python import onnxruntime as ort import numpy as np from tokenizers import Tokenizer # Load tokenizer and config tokenizer = Tokenizer.from_file("tokenizer/tokenizer.json") config = json.load(open("config.json")) # Encode your text prompt encoding = tokenizer.encode("upbeat electronic dance track with synth pads") tokens = np.array([encoding.ids], dtype=np.int32) # Create sessions text_encoder = ort.InferenceSession("onnx/text_encoder_q4.onnx") dit = ort.InferenceSession("onnx/dit_q4.onnx") decoder = ort.InferenceSession("onnx/decoder_q4.onnx") # Generate latent, run diffusion loop, decode to audio # See the full pipeline in the examples directory ``` ### JavaScript / Node.js ```js const ort = require("onnxruntime-node"); const tokenizer = await Tokenizer.fromFile("tokenizer/tokenizer.json"); // Same pipeline — encode → condition → diffuse → decode // Works in Node.js, Electron, or bundled for the web ``` ## Model Architecture Allegretto Mini is built on a three-stage generative pipeline: 1. **Text Encoder** — T5Gemma-based encoder processes your text prompt into rich conditioning embeddings (768-dim, 256 tokens + 1 duration embedding). 2. **DiT (Diffusion Transformer)** — A 20-layer transformer with cross-attention generates latent audio representations through an 8-step rectified-flow sampling loop. 3. **SAME-S Decoder** — Converts latents to stereo waveforms at 44.1 kHz with 2-channel output. A lightweight **Number Conditioner** embeds the desired duration (in seconds) so you can control clip length at inference time. While the underlying architecture draws from the same family as Stability AI's stable-audio-3-small, Allegretto Mini has been independently optimized, quantized, and packaged by OSAMA INC for efficient local deployment. ## Model Files ``` config.json Runtime configuration number_conditioner.npz Duration embedder weights tokenizer/ tokenizer.json T5Gemma tokenizer tokenizer_config.json Tokenizer settings onnx/ text_encoder_q4.onnx Text encoder graph (~213 MB weights) dit_q4.onnx Diffusion transformer graph (~380 MB weights) decoder_q4.onnx Audio decoder graph (~45 MB weights) number_conditioner.onnx Duration embedder graph (~0.8 MB) *_chunks.json Weight manifest per graph *_chunk_*.data Quantized weight data (split ≤100 MB each) ``` Total download size: **~640 MB** of int4 quantized weights across 9 external data chunks. ## Inference Specs - **Latent shape**: `(1, 256, T_lat)` where `T_lat = ceil((seconds + 6) * 44100 / 8192) * 2` - **Cross-attention conditioning**: `(1, 257, 768)` — 256 text tokens + 1 duration embedding - **Global conditioning (adaLN)**: `(1, 768)` — duration embedding - **Output**: `(1, 2, T_lat * 4096)` — stereo audio at 44.1 kHz, values clamped to [-1, 1] - **Default generation**: 10 seconds, 8 steps - **CFG**: Disabled at inference time (`cfg_scale = 1.0`) ## Sampling Allegretto Mini uses a rectified-flow denoiser with the **pingpong** sampler: ``` denoised = x - t_curr * dit(x, t_curr, conditioning) x = (1 - t_next) * denoised + t_next * randn_like(x) ``` The schedule uses `LogSNRShift(rate=0, anchor_logsnr=-6.2, logsnr_end=2.0)` — a closed-form formula that works for any duration without recomputing the schedule. Fast, deterministic, and sequence-length-invariant. ## Performance | Metric | Value | |---|---| | DiT q4 vs fp32 SNR | ~10 dB | | Decoder q4 vs fp32 SNR | ~15 dB | | Text encoder q4 vs fp32 SNR | ~13 dB | | End-to-end envelope correlation | ≈ 0.88 | | Local CPU (single thread) | ~60–120s per 10s clip | | With GPU acceleration | Significantly faster | Quantization uses **int4 MatMulNBits** (`block_size=16`) for weight-bearing nodes, **GatherBlockQuantized** for embedding tables, and fp32 for LayerNorm scales, biases, and Conv1d kernels — keeping quality high while slashing size to ~640 MB. ## License This model is released under the **Stability AI Community License**. The T5Gemma encoder components additionally fall under Google's **Gemma Terms of Use**. Both license files are included in this repository; see `NOTICE` for combined attribution. --- *Allegretto Mini — developed and released by OSAMA INC (India)*