Views
No views yet
| Input dimension | 768 (Majestrino 1.00 embedding) |
| Dictionary size | 12,288 features (16x expansion) |
| Active features per input | 5 (top-k) |
| Parameters | 18.9M |
| Training data | 7.6M embeddings from majestrino-data |
| Training epochs | 30 |
| Best validation MSE | 0.000116 |
| Annotated features | 9,575 / 12,288 (77.9%) |
| Semantic groups | 14 |
| # | Group | Features | Description |
|---|---|---|---|
| 1 | Sound Effects | 98 | Non-speech sounds: impacts, clicks, mechanical noises, foley |
| 2 | Music & Singing | 216 | Singing, instruments, rap, humming, melodies |
| 3 | Recording / Technical | 26 | Microphone type, reverb, compression, audio quality |
| 4 | Environmental / Ambient | 194 | Background noise, crowd, traffic, weather, room tone |
| 5 | Vocal Bursts | 998 | Laughter, crying, gasping, sighing, coughing, screaming |
| 6 | Cognitive States | 369 | Hesitation, filler words, confusion, uncertainty |
| 7 | Speed / Tempo | 80 | Speech rate, pacing, cadence, rhythm |
| 8 | Vocal Register | 154 | Falsetto, vocal fry, pitch range, chest/head voice |
| 9 | Languages | 1,533 | Language identity (French, Arabic, Japanese, etc.) |
| 10 | Accents / Slang | 228 | Regional pronunciation, dialect, AAVE, code-switching |
| 11 | Emotions (EmoNet 40) | 1,760 | 40 emotion categories: joy, anger, fear, sadness, etc. |
| 12 | Talking Styles | 3,452 | Narration, broadcast, whisper, theatrical, casual, didactic |
| 13 | Character Archetypes | 303 | Villain, mentor, child, gamer, military commander |
| 14 | Timbre & Speaker Qualities | 347 | Raspy, nasal, smooth, breathy, warm, deep, bright |
pip install torch huggingface_hub transformers torchaudio safetensors1from sae import SparseAutoencoder
2
3# Download from HuggingFace and load
4sae = SparseAutoencoder.from_pretrained("laion/majestrino-1.00-16xk5-sae")
5sae.eval()1import torch
2import torch.nn as nn
3import torch.nn.functional as F
4import torchaudio
5from transformers import WhisperModel, WhisperFeatureExtractor
6from safetensors.torch import load_file
7from huggingface_hub import hf_hub_download
8from sae import SparseAutoencoder
9import json
10
11DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
12
13# ── Step 1: Load Majestrino 1.00 base model ──
14
15class MajestrinoCLAP(nn.Module):
16 def __init__(self):
17 super().__init__()
18 self.whisper = WhisperModel.from_pretrained("openai/whisper-small")
19 self.audio_encoder = self.whisper.encoder
20 input_dim = self.whisper.config.d_model # 768
21 self.projector = nn.Sequential(
22 nn.Linear(input_dim, 2048),
23 nn.GELU(),
24 nn.Linear(2048, 768),
25 )
26
27 def encode_audio(self, features):
28 out = self.audio_encoder(features).last_hidden_state
29 out = out.mean(dim=1)
30 return F.normalize(self.projector(out), p=2, dim=1)
31
32majestrino = MajestrinoCLAP().to(DEVICE).eval()
33
34# Load weights (note: key remapping audio_proj -> projector)
35weights_path = hf_hub_download("laion/Majestrino-1.00", "model.safetensors")
36state_dict = load_file(weights_path)
37remapped = {k.replace("audio_proj.", "projector."): v for k, v in state_dict.items()}
38majestrino.load_state_dict(remapped, strict=False)
39
40# ── Step 2: Load SAE ──
41
42sae = SparseAutoencoder.from_pretrained("laion/majestrino-1.00-16xk5-sae", device=DEVICE)
43
44# ── Step 3: Load annotations ──
45
46annotations_path = hf_hub_download("laion/majestrino-1.00-16xk5-sae", "annotations.json")
47with open(annotations_path) as f:
48 annotations = json.load(f) # dict: feature_id_str -> {title, description, ...}
49
50# ── Step 4: Process audio ──
51
52feature_extractor = WhisperFeatureExtractor.from_pretrained("openai/whisper-small")
53
54waveform, sr = torchaudio.load("your_audio.wav")
55if sr != 16000:
56 waveform = torchaudio.functional.resample(waveform, sr, 16000)
57waveform = waveform.mean(dim=0) # mono
58
59inputs = feature_extractor(waveform.numpy(), sampling_rate=16000, return_tensors="pt")
60mel = inputs.input_features.to(DEVICE)
61
62with torch.no_grad():
63 embedding = majestrino.encode_audio(mel) # (1, 768)
64 recons, info = sae(embedding) # top-k decomposition
65 top_indices = info["inds"][0].cpu().tolist() # 5 feature indices
66 top_values = info["vals"][0].cpu().tolist() # 5 activation values
67
68print("Active features:")
69for idx, val in zip(top_indices, top_values):
70 ann = annotations.get(str(idx), {})
71 title = ann.get("title", "Unknown")
72 print(f" Feature {idx}: {title} (activation={val:.4f})")Active features:
Feature 4821: Casual American Male Speech (activation=0.3142)
Feature 7203: Conversational Narration (activation=0.2891)
Feature 1156: Standard American English (activation=0.2453)
Feature 9834: Clear Articulate Delivery (activation=0.1987)
Feature 3291: Warm Baritone Timbre (activation=0.1654)├── sae.py # Standalone SAE class (copy to your project)
├── model/
│ ├── config.json # Model hyperparameters
│ └── state_dict.pth # PyTorch weights (73 MB)
├── annotations.json # 9,575 feature annotations
├── group_assignments.json # Feature → group mapping
└── reports/
├── index.html # Main feature index (browseable)
├── index_groups.html # Grouped feature view
└── feature_reports.tar # 10,684 individual feature pages with audio1# Download and extract the interactive HTML reports
2cd reports/
3tar xf feature_reports.tar
4# Open index.html in a browser to explore all featuresInput (768-d Majestrino embedding)
│
├─ subtract pre_bias
│
├─ encoder: Linear(768 → 12288, no bias)
│
├─ add latent_bias
│
├─ top-k (k=5): keep 5 largest activations
│
├─ ReLU
│
├─ decoder: Linear(12288 → 768, no bias)
│
└─ add pre_bias → reconstruction (768-d)embedding_0_11 column from majestrino-data)annotations.json has:1{
2 "3400": {
3 "bin": 18,
4 "bin_name": "Angry & Hostile State",
5 "title": "Intense Anger and Frustration",
6 "description": "The primary commonality across all positive samples is ...",
7 "consistency": "high",
8 "reasoning": "..."
9 }
10}group_assignments.json:1{
2 "3400": [11],
3 "5234": [12, 14]
4}1@misc{majestrino-sae-2025,
2 title={Sparse Autoencoder for Majestrino 1.00 Voice Embeddings},
3 author={LAION},
4 year={2025},
5 url={https://huggingface.co/laion/majestrino-1.00-16xk5-sae}
6}