A speech recognition model trained in 24 hours on a single GPU for ~$12. Built with
Tiny Audio—a minimal, hackable ASR framework.
1from transformers import pipeline
2
3pipe = pipeline("automatic-speech-recognition", model="mazesmazes/tiny-audio", trust_remote_code=True)
4result = pipe("audio.wav")
5print(result["text"])
1from transformers import pipeline
2
3pipe = pipeline("automatic-speech-recognition", model="mazesmazes/tiny-audio", trust_remote_code=True)
4
5# From file
6result = pipe("audio.wav")
7print(result["text"])
8
9# From URL
10result = pipe("https://example.com/audio.mp3")
11
12# From numpy array (must be 16kHz)
13import numpy as np
14audio = np.random.randn(16000).astype(np.float32) # 1 second
15result = pipe(audio)
1# Process multiple files
2files = ["audio1.wav", "audio2.wav", "audio3.wav"]
3results = pipe(files, batch_size=4)
4for r in results:
5 print(r["text"])
1result = pipe("audio.wav", return_timestamps="word")
2# Returns:
3# {
4# "text": "hello world",
5# "chunks": [
6# {"text": "hello", "timestamp": (0.0, 0.5)},
7# {"text": "world", "timestamp": (0.6, 1.0)}
8# ]
9# }
1from tiny_audio import ASRModel, ASRProcessor
2import torch
3
4model = ASRModel.from_pretrained("mazesmazes/tiny-audio")
5processor = ASRProcessor.from_pretrained("mazesmazes/tiny-audio")
6
7# Load and process audio
8import librosa
9audio, sr = librosa.load("audio.wav", sr=16000)
10inputs = processor(audio, sampling_rate=16000, return_tensors="pt")
11
12# Stream tokens
13for token in model.generate_streaming(inputs["input_features"]):
14 print(token, end="", flush=True)
1from tiny_audio import ASRModel, ASRProcessor
2import torch
3import librosa
4
5# Load model and processor
6model = ASRModel.from_pretrained("mazesmazes/tiny-audio")
7processor = ASRProcessor.from_pretrained("mazesmazes/tiny-audio")
8
9# Load audio (16kHz)
10audio, sr = librosa.load("audio.wav", sr=16000)
11
12# Process
13inputs = processor(audio, sampling_rate=16000, return_tensors="pt")
14
15# Generate
16with torch.no_grad():
17 output = model.generate(
18 input_features=inputs["input_features"],
19 attention_mask=inputs["attention_mask"],
20 max_new_tokens=256
21 )
22
23# Decode
24text = processor.batch_decode(output, skip_special_tokens=True)[0]
25print(text)
1import torch
2
3pipe = pipeline(
4 "automatic-speech-recognition",
5 model="mazesmazes/tiny-audio",
6 trust_remote_code=True,
7 device="cuda" # or device=0
8)
1pipe = pipeline(
2 "automatic-speech-recognition",
3 model="mazesmazes/tiny-audio",
4 trust_remote_code=True,
5 torch_dtype=torch.float16,
6 device="cuda"
7)
Only the projector is trained (~12M params). The encoder and decoder remain frozen, leveraging their pretrained knowledge.
transformers>=4.40.0
torch>=2.0.0
torchaudio>=2.0.0
Note: Only the projector weights are stored. The encoder (GLM-ASR) and decoder (Qwen3) are loaded from their respective HuggingFace repos.
1@misc{tinyaudio2024,
2 author = {Alex Kroman},
3 title = {Tiny Audio: Minimal ASR Training},
4 year = {2024},
5 publisher = {GitHub},
6 url = {https://github.com/alexkroman/tiny-audio}
7}