| --- |
| 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)* |
|
|