ChristophSchuhmann commited on
Commit
7a55d08
·
verified ·
1 Parent(s): 28a6ed0

Upload batch: migrate_add_language.py, search_index/build_manifest.json, update_indices.py, README.md, search_index/build_stdout.log...

Browse files
README.md ADDED
@@ -0,0 +1,412 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ size_categories:
6
+ - 100K<n<1M
7
+ task_categories:
8
+ - audio-classification
9
+ - text-to-audio
10
+ - feature-extraction
11
+ tags:
12
+ - music
13
+ - ai-generated-music
14
+ - audio
15
+ - embeddings
16
+ - search
17
+ - faiss
18
+ - bm25
19
+ - nsfw-detection
20
+ - transcription
21
+ - captioning
22
+ pretty_name: LAION-Tunes
23
+ dataset_info:
24
+ features:
25
+ - name: row_id
26
+ dtype: int64
27
+ - name: audio_url
28
+ dtype: string
29
+ - name: filename
30
+ dtype: string
31
+ - name: tar_url
32
+ dtype: string
33
+ - name: subset
34
+ dtype: string
35
+ - name: title
36
+ dtype: string
37
+ - name: tags_text
38
+ dtype: string
39
+ - name: mood_text
40
+ dtype: string
41
+ - name: has_lyrics
42
+ dtype: bool
43
+ - name: genre_tags
44
+ dtype: string
45
+ - name: scene_tags
46
+ dtype: string
47
+ - name: emotion_tags
48
+ dtype: string
49
+ - name: score_coherence
50
+ dtype: float64
51
+ - name: score_musicality
52
+ dtype: float64
53
+ - name: score_memorability
54
+ dtype: float64
55
+ - name: score_clarity
56
+ dtype: float64
57
+ - name: score_naturalness
58
+ dtype: float64
59
+ - name: score_average
60
+ dtype: float64
61
+ - name: play_count
62
+ dtype: int64
63
+ - name: upvote_count
64
+ dtype: int64
65
+ - name: duration_seconds
66
+ dtype: float64
67
+ - name: music_whisper_caption
68
+ dtype: string
69
+ - name: parakeet_transcription
70
+ dtype: string
71
+ - name: has_caption
72
+ dtype: bool
73
+ - name: has_transcription
74
+ dtype: bool
75
+ - name: language
76
+ dtype: string
77
+ - name: is_instrumental
78
+ dtype: bool
79
+ - name: nsfw_gore_sim
80
+ dtype: float64
81
+ - name: nsfw_sexual_sim
82
+ dtype: float64
83
+ - name: nsfw_hate_sim
84
+ dtype: float64
85
+ - name: nsfw_gore_label
86
+ dtype: string
87
+ - name: nsfw_sexual_label
88
+ dtype: string
89
+ - name: nsfw_hate_label
90
+ dtype: string
91
+ - name: nsfw_overall_label
92
+ dtype: string
93
+ splits:
94
+ - name: train
95
+ num_examples: 908174
96
+ ---
97
+
98
+ # LAION-Tunes
99
+
100
+ **908,174 AI-generated music tracks** from 5 platforms, annotated with captions, transcriptions, embeddings, aesthetics scores, and NSFW safety labels. Includes a full-text and vector search engine with a web UI.
101
+
102
+ ## Quick Stats
103
+
104
+ | Metric | Value |
105
+ |--------|-------|
106
+ | Total tracks | 908,174 |
107
+ | Subsets | Mureka (383K), Suno (308K), Udio (115K), Riffusion (99K), Sonauto (3K) |
108
+ | Has caption (Music-Whisper) | 832,944 (91.7%) |
109
+ | Has transcription (Parakeet ASR) | 514,203 (56.6%) |
110
+ | Instrumental | 394,246 (43.4%) |
111
+ | NSFW flagged (very likely + likely) | 12,860 (1.4%) |
112
+
113
+ ## Dataset Description
114
+
115
+ LAION-Tunes is a curated metadata and annotation dataset derived from [ai-music/ai-music-deduplicated](https://huggingface.co/datasets/ai-music/ai-music-deduplicated), a collection of publicly available AI-generated music from Suno, Udio, Mureka, Riffusion, and Sonauto.
116
+
117
+ **This dataset does NOT contain audio files.** It contains metadata, annotations, embeddings, and search indices. Audio URLs pointing to the original hosting platforms are included for reference.
118
+
119
+ ### What's Included
120
+
121
+ For each track:
122
+ - **Metadata**: title, tags, genre, mood, duration, play count, upvote count
123
+ - **Music-Whisper Caption**: AI-generated music description using [laion/music-whisper](https://huggingface.co/laion/music-whisper) (fine-tuned OpenAI Whisper Small)
124
+ - **Parakeet ASR Transcription**: Speech-to-text using [nvidia/parakeet-tdt-0.6b-v3](https://huggingface.co/nvidia/parakeet-tdt-0.6b-v3) with word-level timestamps
125
+ - **Sentence Embeddings**: 768-dim embeddings via [google/embeddinggemma-300m](https://huggingface.co/google/embeddinggemma-300m) for tags, captions, transcriptions, lyrics, and moods
126
+ - **Whisper Audio Embeddings**: 768-dim mean-pooled encoder embeddings from Music-Whisper for audio similarity search
127
+ - **Aesthetics Scores**: coherence, musicality, memorability, clarity, naturalness (computed from Music-Whisper)
128
+ - **NSFW Safety Labels**: three-tier classification (very_likely_nsfw / likely_nsfw / likely_sfw) across gore, sexual, and hate speech dimensions
129
+ - **Pre-built Search Indices**: FAISS vector indices and BM25 text indices ready to serve
130
+
131
+ ### Annotation Pipeline
132
+
133
+ The annotation pipeline processes the original TAR files from ai-music-deduplicated:
134
+
135
+ 1. **Music-Whisper** (`laion/music-whisper`): Generates music captions describing instruments, genre, mood, tempo, etc.
136
+ 2. **Parakeet TDT 0.6B** (`nvidia/parakeet-tdt-0.6b-v3`): ASR transcription with word-level timestamps for vocal content
137
+ 3. **EmbeddingGemma 300M** (`google/embeddinggemma-300m`): Computes 768-dim sentence embeddings for captions, transcriptions, tags, lyrics, moods
138
+ 4. **Whisper Encoder Embeddings**: Mean-pooled encoder hidden states from Music-Whisper for audio fingerprinting/similarity
139
+ 5. **NSFW Classification**: Cosine similarity of transcription embeddings against reference prompts for gore/violence, sexual content, and hate speech
140
+
141
+ ## Repository Structure
142
+
143
+ ```
144
+ laion-tunes/
145
+ ├── README.md # This file
146
+ ├── server.py # FastAPI search server (main application)
147
+ ├── index.html # Web UI (dark-mode, single-page app)
148
+ ├── build_search_index.py # Index builder script
149
+ ├── update_indices.py # Incremental index updater
150
+ ├── migrate_add_language.py # Language detection migration
151
+ ├── nsfw_safety_report.html # Interactive NSFW analysis report
152
+ ├── nsfw_analysis_data.json # Raw NSFW analysis data
153
+
154
+ ├── public/ # Annotated metadata parquets (8.3 GB)
155
+ │ ├── mureka_000000.tar.parquet # One parquet per source TAR file
156
+ │ ├── mureka_000001.tar.parquet
157
+ │ ├── ...
158
+ │ └── udio_000015.tar.parquet # 159 parquet files total
159
+
160
+ ├── search_index/ # Pre-built search indices (16 GB)
161
+ │ ├── metadata.db # SQLite database (908K tracks, 2.7 GB)
162
+ │ ├── faiss_tag.index # FAISS IndexFlatIP - tag embeddings (2.6 GB)
163
+ │ ├── faiss_whisper.index # FAISS IndexFlatIP - audio embeddings (2.6 GB)
164
+ │ ├── faiss_caption.index # FAISS IndexFlatIP - caption embeddings (2.3 GB)
165
+ │ ├── faiss_transcription.index # FAISS IndexFlatIP - transcription embeddings (1.5 GB)
166
+ │ ├── faiss_lyric.index # FAISS IndexFlatIP - lyric embeddings (1.4 GB)
167
+ │ ├── faiss_mood.index # FAISS IndexFlatIP - mood embeddings (1.1 GB)
168
+ │ ├── idmap_*.npy # Row ID mappings for each FAISS index
169
+ │ ├── bm25_tags.pkl # BM25 text index for tags (114 MB)
170
+ │ ├── bm25_caption.pkl # BM25 text index for captions (609 MB)
171
+ │ └── bm25_transcription.pkl # BM25 text index for transcriptions (392 MB)
172
+
173
+ └── whisper_embeddings/ # Raw Whisper encoder embeddings (1.6 GB)
174
+ ├── mureka_000000.tar.npz # One NPZ per source TAR file
175
+ ├── ...
176
+ └── udio_000015.tar.npz # 159 NPZ files total
177
+ ```
178
+
179
+ ## Data Format
180
+
181
+ ### Parquet Files (`public/`)
182
+
183
+ Each parquet file corresponds to one TAR file from the source dataset and contains these columns:
184
+
185
+ | Column | Type | Description |
186
+ |--------|------|-------------|
187
+ | `filename` | str | Filename within the source TAR |
188
+ | `tar_file` | str | Source TAR filename |
189
+ | `audio_url` | str | Original audio URL (mp3/m4a/ogg) |
190
+ | `subset` | str | Source platform (suno/udio/mureka/riffusion/sonauto) |
191
+ | `title` | str | Track title |
192
+ | `tags` | str | Comma-separated genre/style tags |
193
+ | `mood` | str | Mood tags |
194
+ | `lyrics` | str | Lyrics (if available, from source metadata) |
195
+ | `duration_seconds` | float | Track duration |
196
+ | `play_count` | int | Play count on source platform |
197
+ | `upvote_count` | int | Like/upvote count |
198
+ | `music_whisper_caption` | str | Music-Whisper generated caption |
199
+ | `parakeet_transcription` | str | Parakeet ASR transcription (plain text) |
200
+ | `parakeet_transcription_with_timestamps` | str | ASR with word-level timestamps |
201
+ | `tag_embedding` | list[float] | 768-dim EmbeddingGemma embedding of tags |
202
+ | `caption_embedding` | list[float] | 768-dim EmbeddingGemma embedding of caption |
203
+ | `transcription_embedding` | list[float] | 768-dim EmbeddingGemma embedding of transcription |
204
+ | `lyric_embedding` | list[float] | 768-dim EmbeddingGemma embedding of lyrics |
205
+ | `mood_embedding` | list[float] | 768-dim EmbeddingGemma embedding of mood |
206
+
207
+ ### Whisper Embeddings (`whisper_embeddings/`)
208
+
209
+ NPZ files containing mean-pooled Whisper encoder hidden states:
210
+ - `embeddings`: float32 array of shape `(N, 768)` - L2-normalized
211
+ - `filenames`: string array of filenames matching the parquet entries
212
+
213
+ ### SQLite Database (`search_index/metadata.db`)
214
+
215
+ The `tracks` table contains all 908,174 tracks with 34 columns including metadata, aesthetics scores, annotation flags, and NSFW safety labels. The `row_id` column is the primary key used by all FAISS indices.
216
+
217
+ ### FAISS Indices (`search_index/faiss_*.index`)
218
+
219
+ All indices are `IndexFlatIP` (inner product / cosine similarity for L2-normalized vectors) with 768 dimensions. Each index has a corresponding `idmap_*.npy` that maps FAISS internal indices to SQLite `row_id` values.
220
+
221
+ | Index | Vectors | Description |
222
+ |-------|---------|-------------|
223
+ | `faiss_tag` | 908,241 | Tag text embeddings |
224
+ | `faiss_whisper` | 908,174 | Audio encoder embeddings (music similarity) |
225
+ | `faiss_caption` | 798,858 | Music-Whisper caption embeddings |
226
+ | `faiss_transcription` | 511,610 | ASR transcription embeddings |
227
+ | `faiss_lyric` | 479,313 | Lyrics embeddings |
228
+ | `faiss_mood` | 383,616 | Mood text embeddings |
229
+
230
+ ## NSFW Safety Labels
231
+
232
+ Each track has NSFW safety scores and labels across three dimensions:
233
+
234
+ | Dimension | Strict Threshold | Moderate Threshold | Very Likely NSFW | Likely NSFW |
235
+ |-----------|-----------------|-------------------|-----------------|-------------|
236
+ | Gore/Violence | >= 0.3779 | >= 0.3540 | 2,437 (0.27%) | 2,293 (0.25%) |
237
+ | Sexual Content | >= 0.3584 | >= 0.3234 | 3,367 (0.37%) | 2,689 (0.30%) |
238
+ | Hate Speech | >= 0.3633 | >= 0.3382 | 2,786 (0.31%) | 2,316 (0.26%) |
239
+ | **Overall (conservative)** | - | - | **6,762 (0.74%)** | **6,098 (0.67%)** |
240
+
241
+ - `very_likely_nsfw`: cosine similarity above strict threshold
242
+ - `likely_nsfw`: between strict and moderate thresholds
243
+ - `likely_sfw`: below moderate threshold
244
+ - `nsfw_overall_label`: conservative (worst label across all three dimensions wins)
245
+
246
+ The raw cosine similarity scores (`nsfw_gore_sim`, `nsfw_sexual_sim`, `nsfw_hate_sim`) are stored so you can apply your own thresholds.
247
+
248
+ ## Running the Search Server
249
+
250
+ ### Prerequisites
251
+
252
+ ```bash
253
+ pip install fastapi uvicorn faiss-cpu numpy pandas sentence-transformers torch scipy tqdm
254
+ ```
255
+
256
+ ### Option 1: With HF Text Embeddings Inference (Recommended)
257
+
258
+ TEI provides fast CPU-based embedding serving (~25ms per query vs ~430ms with Python):
259
+
260
+ ```bash
261
+ # Start TEI (requires Docker)
262
+ docker run -d --name tei-embeddings \
263
+ -p 8090:80 \
264
+ -e HF_TOKEN=your_token \
265
+ ghcr.io/huggingface/text-embeddings-inference:cpu-latest \
266
+ --model-id google/embeddinggemma-300m \
267
+ --max-batch-requests 4
268
+
269
+ # Start the server with TEI backend
270
+ python server.py --port 7860 --gpu 0 --tei-url http://localhost:8090
271
+ ```
272
+
273
+ ### Option 2: Direct Python Inference
274
+
275
+ ```bash
276
+ python server.py --port 7860 --gpu 0
277
+ ```
278
+
279
+ This loads EmbeddingGemma 300M and Music-Whisper encoder into Python directly.
280
+
281
+ ### Server Flags
282
+
283
+ | Flag | Default | Description |
284
+ |------|---------|-------------|
285
+ | `--port` | 7860 | HTTP port |
286
+ | `--host` | 0.0.0.0 | Bind address |
287
+ | `--gpu` | 0 | GPU ID for Whisper encoder |
288
+ | `--tei-url` | None | TEI server URL for text embeddings |
289
+ | `--no-whisper` | False | Skip loading Whisper encoder (disables audio similarity search) |
290
+
291
+ ### What Loads at Startup
292
+
293
+ 1. **6 FAISS indices** (tag, whisper, caption, transcription, lyric, mood)
294
+ 2. **3 BM25 indices** (tags, caption, transcription)
295
+ 3. **SQLite database** (908K tracks)
296
+ 4. **Text embedder**: TEI backend or Python SentenceTransformer
297
+ 5. **Music-Whisper encoder** (on GPU): for audio upload similarity search
298
+
299
+ Total memory: ~20 GB RAM + ~200 MB GPU VRAM
300
+
301
+ ## Search API
302
+
303
+ ### `POST /api/search`
304
+
305
+ Main search endpoint combining vector search, BM25, and metadata filtering.
306
+
307
+ ```json
308
+ {
309
+ "query": "upbeat electronic dance music",
310
+ "search_fields": ["tag", "caption"],
311
+ "bm25_fields": ["tags", "caption"],
312
+ "top_k": 50,
313
+ "bm25_weight": 0.3,
314
+ "min_score": 4.0,
315
+ "max_score": 10.0,
316
+ "subsets": ["suno", "udio"],
317
+ "nsfw_filter": "sfw_only",
318
+ "stage2_enabled": true,
319
+ "stage2_field": "caption",
320
+ "stage2_top_k": 200
321
+ }
322
+ ```
323
+
324
+ **Search fields** (FAISS vector search):
325
+ - `tag`: search by music tags/genres
326
+ - `caption`: search by Music-Whisper captions
327
+ - `transcription`: search by ASR transcriptions
328
+ - `lyric`: search by lyrics content
329
+ - `mood`: search by mood descriptors
330
+ - `whisper`: search by audio embedding similarity
331
+
332
+ **BM25 fields** (text search):
333
+ - `tags`, `caption`, `transcription`
334
+
335
+ **Filters**:
336
+ - `min_score` / `max_score`: aesthetics score range (0-10)
337
+ - `subsets`: list of source platforms
338
+ - `nsfw_filter`: `"sfw_only"` or `"nsfw_only"` or `null` for all
339
+
340
+ **Two-stage search**: First retrieves `stage2_top_k` candidates, then re-ranks by a second field.
341
+
342
+ ### `POST /api/search_by_audio`
343
+
344
+ Upload an audio file to find similar tracks by audio fingerprint.
345
+
346
+ ```bash
347
+ curl -X POST http://localhost:7860/api/search_by_audio \
348
+ -F "file=@song.mp3" \
349
+ -F "top_k=20" \
350
+ -F "nsfw_filter=sfw_only"
351
+ ```
352
+
353
+ ### `POST /api/search_similar`
354
+
355
+ Find tracks similar to an existing track by row_id.
356
+
357
+ ```json
358
+ {
359
+ "row_id": 12345,
360
+ "field": "whisper",
361
+ "top_k": 20
362
+ }
363
+ ```
364
+
365
+ ### `GET /api/stats`
366
+
367
+ Returns dataset statistics (total tracks, index sizes, NSFW counts).
368
+
369
+ ## Building the Index from Scratch
370
+
371
+ If you want to rebuild the search indices from the parquet files:
372
+
373
+ ```bash
374
+ python build_search_index.py --force
375
+ ```
376
+
377
+ This reads all parquets from `public/` (and optionally `private/` for additional embeddings), builds the SQLite database, FAISS indices, and BM25 indices. Takes ~30 minutes on a modern machine.
378
+
379
+ ## Source Data
380
+
381
+ The original audio data comes from [ai-music/ai-music-deduplicated](https://huggingface.co/datasets/ai-music/ai-music-deduplicated), organized by platform:
382
+
383
+ | Platform | Tracks | Audio Format | Notable Fields |
384
+ |----------|--------|-------------|----------------|
385
+ | Mureka | 383,549 | MP3 | genres, moods, model version |
386
+ | Suno | 307,539 | MP3 | tags (in metadata), prompt, model_name, explicit flag |
387
+ | Udio | 115,140 | MP3 | tags (array), lyrics, prompt, likes, plays |
388
+ | Riffusion | 99,228 | M4A | sound (style description), lyrics_timestamped, conditions |
389
+ | Sonauto | 2,718 | OGG | tags (array), description, keyword |
390
+
391
+ ## Models Used
392
+
393
+ | Model | Purpose | Output |
394
+ |-------|---------|--------|
395
+ | [laion/music-whisper](https://huggingface.co/laion/music-whisper) | Music captioning + audio embeddings | Text caption + 768-dim encoder embedding |
396
+ | [nvidia/parakeet-tdt-0.6b-v3](https://huggingface.co/nvidia/parakeet-tdt-0.6b-v3) | ASR transcription | Text + word-level timestamps |
397
+ | [google/embeddinggemma-300m](https://huggingface.co/google/embeddinggemma-300m) | Text sentence embeddings | 768-dim L2-normalized vectors |
398
+
399
+ ## License
400
+
401
+ Apache 2.0
402
+
403
+ ## Citation
404
+
405
+ ```bibtex
406
+ @misc{laion-tunes-2025,
407
+ title={LAION-Tunes: Annotated AI Music Search Dataset},
408
+ author={LAION},
409
+ year={2025},
410
+ url={https://huggingface.co/datasets/laion/laion-tunes}
411
+ }
412
+ ```
build_search_index.py ADDED
@@ -0,0 +1,609 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ LAION-Tunes Search Index Builder
4
+ =================================
5
+ Reads annotated parquet files from two sources, merges them, and builds:
6
+ 1. SQLite metadata database (tracks table with all searchable fields)
7
+ 2. FAISS vector indices (tag, lyric, mood, caption, transcription embeddings)
8
+ 3. BM25 text search indices (tags, caption, transcription, hashed lyrics)
9
+
10
+ Data Sources:
11
+ - private/ parquets: 908K rows with tag/lyric/mood embeddings, aesthetics scores
12
+ - output/ parquets: annotation pipeline output with music_whisper_caption, parakeet ASR
13
+
14
+ Usage:
15
+ python build_search_index.py [--force] # --force rebuilds from scratch
16
+
17
+ Output: search_index/ directory with all index files.
18
+ Resumable: tracks which parquets have been processed in build_manifest.json.
19
+ """
20
+
21
+ import os
22
+ import sys
23
+ import json
24
+ import glob
25
+ import time
26
+ import hmac
27
+ import hashlib
28
+ import pickle
29
+ import re
30
+ import sqlite3
31
+ import logging
32
+ from pathlib import Path
33
+ from datetime import timedelta
34
+ from collections import defaultdict
35
+
36
+ import numpy as np
37
+ import pandas as pd
38
+ import faiss
39
+ from scipy import sparse
40
+ from tqdm import tqdm
41
+
42
+ # ── Paths ────────────────────────────────────────────────────────────────────
43
+ BASE_DIR = Path(__file__).parent
44
+ PRIVATE_DIR = BASE_DIR / "private"
45
+ OUTPUT_DIR = Path("/home/deployer/laion/music/output")
46
+ INDEX_DIR = BASE_DIR / "search_index"
47
+ MANIFEST_PATH = INDEX_DIR / "build_manifest.json"
48
+
49
+ # BM25 lyrics hashing secret - change this to your own secret
50
+ LYRICS_HMAC_KEY = b"laion-tunes-search-2026-secret-key"
51
+
52
+ # ── Logging ──────────────────────────────────────────────────────────────────
53
+ logging.basicConfig(
54
+ level=logging.INFO,
55
+ format="%(asctime)s [%(levelname)s] %(message)s",
56
+ datefmt="%H:%M:%S",
57
+ handlers=[
58
+ logging.StreamHandler(sys.stdout),
59
+ logging.FileHandler(str(INDEX_DIR / "build.log") if INDEX_DIR.exists() else "/dev/null", mode="a"),
60
+ ],
61
+ )
62
+ log = logging.getLogger("index_builder")
63
+
64
+
65
+ # ── BM25 Implementation ─────────────────────────────────────────────────────
66
+ class BM25Index:
67
+ """Lightweight BM25-Okapi index using sparse matrices for fast scoring."""
68
+
69
+ def __init__(self, k1=1.5, b=0.75):
70
+ self.k1 = k1
71
+ self.b = b
72
+ self.vocab = {} # token -> vocab_id
73
+ self.idf = None # numpy array, shape (vocab_size,)
74
+ self.tf_matrix = None # scipy CSR, shape (n_docs, vocab_size)
75
+ self.doc_lens = None # numpy array, shape (n_docs,)
76
+ self.avg_dl = 0.0
77
+ self.row_ids = [] # maps doc index -> SQLite row_id
78
+
79
+ def build(self, documents, row_ids):
80
+ """Build index from list of (tokenized_doc, row_id) pairs.
81
+ documents: list of list of strings (already tokenized)
82
+ row_ids: list of ints (SQLite row_ids)
83
+ """
84
+ self.row_ids = list(row_ids)
85
+ n_docs = len(documents)
86
+ if n_docs == 0:
87
+ return
88
+
89
+ # Build vocabulary
90
+ doc_freqs = defaultdict(int) # token -> number of docs containing it
91
+ for doc in documents:
92
+ seen = set()
93
+ for token in doc:
94
+ if token not in self.vocab:
95
+ self.vocab[token] = len(self.vocab)
96
+ if token not in seen:
97
+ doc_freqs[token] += 1
98
+ seen.add(token)
99
+
100
+ vocab_size = len(self.vocab)
101
+
102
+ # Build sparse TF matrix
103
+ rows, cols, data = [], [], []
104
+ doc_lens = np.zeros(n_docs, dtype=np.float32)
105
+ for doc_idx, doc in enumerate(documents):
106
+ tf = defaultdict(int)
107
+ for token in doc:
108
+ tf[self.vocab[token]] += 1
109
+ doc_lens[doc_idx] = len(doc)
110
+ for vid, count in tf.items():
111
+ rows.append(doc_idx)
112
+ cols.append(vid)
113
+ data.append(count)
114
+
115
+ self.tf_matrix = sparse.csr_matrix(
116
+ (np.array(data, dtype=np.float32), (rows, cols)),
117
+ shape=(n_docs, vocab_size),
118
+ )
119
+ self.doc_lens = doc_lens
120
+ self.avg_dl = float(doc_lens.mean()) if n_docs > 0 else 1.0
121
+
122
+ # Compute IDF: log((N - df + 0.5) / (df + 0.5) + 1)
123
+ self.idf = np.zeros(vocab_size, dtype=np.float32)
124
+ for token, vid in self.vocab.items():
125
+ df = doc_freqs[token]
126
+ self.idf[vid] = np.log((n_docs - df + 0.5) / (df + 0.5) + 1.0)
127
+
128
+ def search(self, query_tokens, top_k=50):
129
+ """Score all documents against query tokens. Returns (row_ids, scores)."""
130
+ if self.tf_matrix is None or len(query_tokens) == 0:
131
+ return np.array([], dtype=np.int64), np.array([], dtype=np.float32)
132
+
133
+ # Map query tokens to vocab ids
134
+ qvids = [self.vocab[t] for t in query_tokens if t in self.vocab]
135
+ if not qvids:
136
+ return np.array([], dtype=np.int64), np.array([], dtype=np.float32)
137
+
138
+ n_docs = self.tf_matrix.shape[0]
139
+ scores = np.zeros(n_docs, dtype=np.float32)
140
+
141
+ for vid in qvids:
142
+ tf_col = self.tf_matrix[:, vid].toarray().ravel()
143
+ idf_val = self.idf[vid]
144
+ # BM25 formula
145
+ numerator = tf_col * (self.k1 + 1)
146
+ denominator = tf_col + self.k1 * (1 - self.b + self.b * self.doc_lens / self.avg_dl)
147
+ scores += idf_val * (numerator / (denominator + 1e-8))
148
+
149
+ # Top-k
150
+ k = min(top_k, n_docs)
151
+ top_idx = np.argpartition(scores, -k)[-k:]
152
+ top_idx = top_idx[np.argsort(scores[top_idx])[::-1]]
153
+ top_idx = top_idx[scores[top_idx] > 0]
154
+
155
+ result_row_ids = np.array([self.row_ids[i] for i in top_idx], dtype=np.int64)
156
+ result_scores = scores[top_idx]
157
+ return result_row_ids, result_scores
158
+
159
+
160
+ # ── Tokenizer ────────────────────────────────────────────────────────────────
161
+ _TOKEN_RE = re.compile(r"[a-z0-9]+")
162
+
163
+ def tokenize(text):
164
+ """Lowercase, split on non-alphanumeric, keep tokens >= 2 chars."""
165
+ if not text or not isinstance(text, str):
166
+ return []
167
+ return [t for t in _TOKEN_RE.findall(text.lower()) if len(t) >= 2]
168
+
169
+
170
+ def tokenize_and_hash(text, secret_key=LYRICS_HMAC_KEY):
171
+ """Tokenize then HMAC-SHA256 hash each token (privacy-preserving)."""
172
+ tokens = tokenize(text)
173
+ return [hmac.new(secret_key, t.encode(), hashlib.sha256).hexdigest()[:16] for t in tokens]
174
+
175
+
176
+ # ── Title / Lyrics extraction from metadata_json ─────────────────────────────
177
+ def extract_title(metadata_json_str):
178
+ """Extract title from the raw metadata JSON string."""
179
+ try:
180
+ meta = json.loads(metadata_json_str)
181
+ return meta.get("title", "") or ""
182
+ except Exception:
183
+ return ""
184
+
185
+
186
+ def extract_lyrics(metadata_json_str):
187
+ """Extract lyrics text from metadata JSON. Returns empty string if not available.
188
+ Suno: metadata.prompt (contains lyrics/prompt)
189
+ Udio: lyrics field
190
+ Riffusion: lyrics field
191
+ Others: not available
192
+ """
193
+ try:
194
+ meta = json.loads(metadata_json_str)
195
+ # Suno: lyrics are in metadata.prompt
196
+ nested = meta.get("metadata", {})
197
+ if isinstance(nested, dict) and nested.get("prompt"):
198
+ return str(nested["prompt"])
199
+ # Udio / Riffusion / Sonauto
200
+ if meta.get("lyrics"):
201
+ return str(meta["lyrics"])
202
+ return ""
203
+ except Exception:
204
+ return ""
205
+
206
+
207
+ def extract_duration(metadata_json_str):
208
+ """Extract duration from metadata JSON."""
209
+ try:
210
+ meta = json.loads(metadata_json_str)
211
+ # Suno: metadata.duration
212
+ nested = meta.get("metadata", {})
213
+ if isinstance(nested, dict) and nested.get("duration"):
214
+ return float(nested["duration"])
215
+ # Udio: duration
216
+ if meta.get("duration"):
217
+ return float(meta["duration"])
218
+ # Riffusion: duration_s
219
+ if meta.get("duration_s"):
220
+ return float(meta["duration_s"])
221
+ # Mureka: duration in milliseconds
222
+ if meta.get("duration in milliseconds"):
223
+ return float(meta["duration in milliseconds"]) / 1000.0
224
+ return None
225
+ except Exception:
226
+ return None
227
+
228
+
229
+ def extract_subset(tar_url):
230
+ """Extract subset name from tar_url like '.../suno/suno_000000.tar'."""
231
+ if not tar_url:
232
+ return "unknown"
233
+ parts = tar_url.split("/")
234
+ for p in parts:
235
+ if p in ("suno", "udio", "mureka", "riffusion", "sonauto"):
236
+ return p
237
+ return "unknown"
238
+
239
+
240
+ # ── Index building ───────────────────────────────────────────────────────────
241
+ def load_manifest():
242
+ """Load or create build manifest for resumability."""
243
+ if MANIFEST_PATH.exists():
244
+ with open(MANIFEST_PATH) as f:
245
+ return json.load(f)
246
+ return {"processed_private": [], "processed_output": [], "total_rows": 0}
247
+
248
+
249
+ def save_manifest(manifest):
250
+ with open(MANIFEST_PATH, "w") as f:
251
+ json.dump(manifest, f, indent=2)
252
+
253
+
254
+ def get_output_filename(private_filename):
255
+ """Map private parquet filename to expected output parquet filename.
256
+ 'suno_000000.tar.parquet' -> 'suno_suno_000000.parquet'
257
+ """
258
+ base = private_filename.replace(".tar.parquet", "")
259
+ parts = base.split("_", 1)
260
+ if len(parts) == 2:
261
+ subset, num = parts
262
+ return f"{subset}_{subset}_{num}.parquet"
263
+ return None
264
+
265
+
266
+ def init_database(db_path):
267
+ """Create SQLite database with tracks table."""
268
+ conn = sqlite3.connect(str(db_path))
269
+ conn.execute("PRAGMA journal_mode=WAL")
270
+ conn.execute("PRAGMA synchronous=NORMAL")
271
+ conn.execute("""
272
+ CREATE TABLE IF NOT EXISTS tracks (
273
+ row_id INTEGER PRIMARY KEY,
274
+ audio_url TEXT NOT NULL,
275
+ filename TEXT,
276
+ tar_url TEXT,
277
+ subset TEXT NOT NULL,
278
+ title TEXT,
279
+ tags_text TEXT,
280
+ mood_text TEXT,
281
+ has_lyrics INTEGER NOT NULL DEFAULT 0,
282
+ genre_tags TEXT,
283
+ scene_tags TEXT,
284
+ emotion_tags TEXT,
285
+ score_coherence REAL,
286
+ score_musicality REAL,
287
+ score_memorability REAL,
288
+ score_clarity REAL,
289
+ score_naturalness REAL,
290
+ score_average REAL,
291
+ play_count INTEGER DEFAULT 0,
292
+ upvote_count INTEGER DEFAULT 0,
293
+ duration_seconds REAL,
294
+ music_whisper_caption TEXT,
295
+ parakeet_transcription TEXT,
296
+ has_caption INTEGER NOT NULL DEFAULT 0,
297
+ has_transcription INTEGER NOT NULL DEFAULT 0
298
+ )
299
+ """)
300
+ conn.execute("CREATE INDEX IF NOT EXISTS idx_score_avg ON tracks(score_average)")
301
+ conn.execute("CREATE INDEX IF NOT EXISTS idx_play ON tracks(play_count)")
302
+ conn.execute("CREATE INDEX IF NOT EXISTS idx_upvote ON tracks(upvote_count)")
303
+ conn.execute("CREATE INDEX IF NOT EXISTS idx_subset ON tracks(subset)")
304
+ conn.execute("CREATE UNIQUE INDEX IF NOT EXISTS idx_audio_url ON tracks(audio_url)")
305
+ conn.commit()
306
+ return conn
307
+
308
+
309
+ def build_all(force=False):
310
+ """Main index building function."""
311
+ INDEX_DIR.mkdir(parents=True, exist_ok=True)
312
+
313
+ # Re-init logging file handler now that dir exists
314
+ fh = logging.FileHandler(str(INDEX_DIR / "build.log"), mode="a")
315
+ fh.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s", datefmt="%H:%M:%S"))
316
+ log.addHandler(fh)
317
+
318
+ log.info("=" * 60)
319
+ log.info("LAION-Tunes Search Index Builder")
320
+ log.info("=" * 60)
321
+
322
+ manifest = load_manifest() if not force else {"processed_private": [], "processed_output": [], "total_rows": 0}
323
+ if force:
324
+ log.info("Force rebuild requested - starting fresh")
325
+
326
+ # List all private parquets
327
+ private_files = sorted(PRIVATE_DIR.glob("*.parquet"))
328
+ log.info(f"Found {len(private_files)} private parquets")
329
+
330
+ # List all output parquets (annotation pipeline results)
331
+ output_files = {Path(f).name: f for f in glob.glob(str(OUTPUT_DIR / "*.parquet"))}
332
+ log.info(f"Found {len(output_files)} output (annotation) parquets")
333
+
334
+ # Init or open SQLite
335
+ db_path = INDEX_DIR / "metadata.db"
336
+ if force and db_path.exists():
337
+ db_path.unlink()
338
+ conn = init_database(db_path)
339
+
340
+ # Get current row count
341
+ row_id_offset = conn.execute("SELECT COALESCE(MAX(row_id), -1) + 1 FROM tracks").fetchone()[0]
342
+ log.info(f"Starting row_id offset: {row_id_offset}")
343
+
344
+ # FAISS indices - load existing or create new
345
+ faiss_indices = {}
346
+ id_maps = {}
347
+ embedding_fields = ["tag", "lyric", "mood", "caption", "transcription"]
348
+
349
+ for field in embedding_fields:
350
+ idx_path = INDEX_DIR / f"faiss_{field}.index"
351
+ map_path = INDEX_DIR / f"idmap_{field}.npy"
352
+ if not force and idx_path.exists() and map_path.exists():
353
+ faiss_indices[field] = faiss.read_index(str(idx_path))
354
+ id_maps[field] = list(np.load(str(map_path)))
355
+ log.info(f" Loaded existing FAISS {field}: {faiss_indices[field].ntotal} vectors")
356
+ else:
357
+ faiss_indices[field] = faiss.IndexFlatIP(768)
358
+ id_maps[field] = []
359
+ log.info(f" Created new FAISS {field} index")
360
+
361
+ # BM25 data collectors - always rebuild from scratch (fast enough)
362
+ bm25_data = {
363
+ "tags": {"docs": [], "row_ids": []},
364
+ "caption": {"docs": [], "row_ids": []},
365
+ "transcription": {"docs": [], "row_ids": []},
366
+ "lyrics_hashed": {"docs": [], "row_ids": []},
367
+ }
368
+
369
+ # If resuming, we need to rebuild BM25 from the entire DB
370
+ if row_id_offset > 0 and not force:
371
+ log.info("Rebuilding BM25 data from existing database...")
372
+ cursor = conn.execute(
373
+ "SELECT row_id, tags_text, music_whisper_caption, parakeet_transcription FROM tracks"
374
+ )
375
+ for row in cursor:
376
+ rid, tags, caption, transcript = row
377
+ if tags:
378
+ bm25_data["tags"]["docs"].append(tokenize(tags))
379
+ bm25_data["tags"]["row_ids"].append(rid)
380
+ if caption:
381
+ bm25_data["caption"]["docs"].append(tokenize(caption))
382
+ bm25_data["caption"]["row_ids"].append(rid)
383
+ if transcript:
384
+ bm25_data["transcription"]["docs"].append(tokenize(transcript))
385
+ bm25_data["transcription"]["row_ids"].append(rid)
386
+ log.info(f" BM25 tags: {len(bm25_data['tags']['docs'])}, "
387
+ f"caption: {len(bm25_data['caption']['docs'])}, "
388
+ f"transcription: {len(bm25_data['transcription']['docs'])}")
389
+
390
+ # Process private parquets
391
+ files_to_process = [f for f in private_files if f.name not in manifest["processed_private"]]
392
+ log.info(f"Processing {len(files_to_process)} new private parquets "
393
+ f"(skipping {len(private_files) - len(files_to_process)} already done)")
394
+
395
+ t0 = time.time()
396
+ total_new = 0
397
+
398
+ for file_idx, pf in enumerate(tqdm(files_to_process, desc="Building index")):
399
+ df = pd.read_parquet(pf)
400
+ n = len(df)
401
+
402
+ # Try to find matching output parquet for annotation data
403
+ out_name = get_output_filename(pf.name)
404
+ out_df = None
405
+ if out_name and out_name in output_files:
406
+ try:
407
+ out_df = pd.read_parquet(output_files[out_name])
408
+ out_df = out_df.set_index("audio_url")
409
+ except Exception as e:
410
+ log.warning(f" Failed to load output {out_name}: {e}")
411
+
412
+ # Prepare batch data for SQLite insert
413
+ insert_rows = []
414
+ batch_embeddings = {field: ([], []) for field in embedding_fields} # (vectors, row_ids)
415
+
416
+ for i in range(n):
417
+ row = df.iloc[i]
418
+ row_id = row_id_offset + total_new
419
+ audio_url = str(row.get("audio_url", ""))
420
+ if not audio_url:
421
+ continue
422
+
423
+ metadata_json = str(row.get("metadata_json", "{}"))
424
+ subset = extract_subset(str(row.get("tar_url", "")))
425
+ title = extract_title(metadata_json)
426
+ tags_text = str(row.get("tags_text", "")) or ""
427
+ mood_text = str(row.get("mood_text", "")) if pd.notna(row.get("mood_text")) else ""
428
+ has_lyrics = bool(row.get("has_lyrics", False))
429
+ duration = extract_duration(metadata_json)
430
+
431
+ # List columns -> JSON strings
432
+ genre_tags = row.get("genre_tags", [])
433
+ scene_tags = row.get("scene_tags", [])
434
+ emotion_tags = row.get("emotion_tags", [])
435
+ def to_json_list(val):
436
+ if isinstance(val, np.ndarray):
437
+ return json.dumps(val.tolist())
438
+ if isinstance(val, list):
439
+ return json.dumps(val)
440
+ return "[]"
441
+ genre_str = to_json_list(genre_tags)
442
+ scene_str = to_json_list(scene_tags)
443
+ emotion_str = to_json_list(emotion_tags)
444
+
445
+ # Scores
446
+ score_avg = float(row.get("score_average", 0)) if pd.notna(row.get("score_average")) else None
447
+ score_coh = float(row.get("score_Coherence", 0)) if pd.notna(row.get("score_Coherence")) else None
448
+ score_mus = float(row.get("score_Musicality", 0)) if pd.notna(row.get("score_Musicality")) else None
449
+ score_mem = float(row.get("score_Memorability", 0)) if pd.notna(row.get("score_Memorability")) else None
450
+ score_cla = float(row.get("score_Clarity", 0)) if pd.notna(row.get("score_Clarity")) else None
451
+ score_nat = float(row.get("score_Naturalness", 0)) if pd.notna(row.get("score_Naturalness")) else None
452
+ play_count = int(row.get("play_count", 0) or 0)
453
+ upvote_count = int(row.get("upvote_count", 0) or 0)
454
+
455
+ # Merge annotation data if available
456
+ caption = ""
457
+ transcription = ""
458
+ out_duration = duration
459
+ if out_df is not None and audio_url in out_df.index:
460
+ out_row = out_df.loc[audio_url]
461
+ if isinstance(out_row, pd.DataFrame):
462
+ out_row = out_row.iloc[0]
463
+ caption = str(out_row.get("music_whisper_caption", "")) if pd.notna(out_row.get("music_whisper_caption")) else ""
464
+ transcription = str(out_row.get("parakeet_transcription", "")) if pd.notna(out_row.get("parakeet_transcription")) else ""
465
+ if not title:
466
+ title = str(out_row.get("title", "")) if pd.notna(out_row.get("title")) else ""
467
+ if out_duration is None and pd.notna(out_row.get("duration_seconds")):
468
+ out_duration = float(out_row["duration_seconds"])
469
+
470
+ insert_rows.append((
471
+ row_id, audio_url, str(row.get("filename", "")), str(row.get("tar_url", "")),
472
+ subset, title, tags_text, mood_text, int(has_lyrics),
473
+ genre_str, scene_str, emotion_str,
474
+ score_coh, score_mus, score_mem, score_cla, score_nat, score_avg,
475
+ play_count, upvote_count, out_duration,
476
+ caption, transcription,
477
+ 1 if caption else 0, 1 if transcription else 0,
478
+ ))
479
+
480
+ # Collect embeddings
481
+ for field, col_name in [
482
+ ("tag", "tag_embedding"), ("lyric", "lyric_embedding"),
483
+ ("mood", "mood_embedding"),
484
+ ]:
485
+ emb = row.get(col_name)
486
+ if emb is not None and isinstance(emb, np.ndarray) and len(emb) == 768:
487
+ vec = emb.astype(np.float32)
488
+ norm = np.linalg.norm(vec)
489
+ if norm > 0:
490
+ vec /= norm
491
+ batch_embeddings[field][0].append(vec)
492
+ batch_embeddings[field][1].append(row_id)
493
+
494
+ # Caption/transcription embeddings from output parquet
495
+ if out_df is not None and audio_url in out_df.index:
496
+ out_row_data = out_df.loc[audio_url]
497
+ if isinstance(out_row_data, pd.DataFrame):
498
+ out_row_data = out_row_data.iloc[0]
499
+ for field, col_name in [("caption", "caption_embedding"), ("transcription", "transcription_embedding")]:
500
+ emb = out_row_data.get(col_name)
501
+ if emb is not None and isinstance(emb, np.ndarray) and len(emb) == 768:
502
+ vec = emb.astype(np.float32)
503
+ norm = np.linalg.norm(vec)
504
+ if norm > 0:
505
+ vec /= norm
506
+ batch_embeddings[field][0].append(vec)
507
+ batch_embeddings[field][1].append(row_id)
508
+
509
+ # BM25 data
510
+ if tags_text:
511
+ bm25_data["tags"]["docs"].append(tokenize(tags_text))
512
+ bm25_data["tags"]["row_ids"].append(row_id)
513
+ if caption:
514
+ bm25_data["caption"]["docs"].append(tokenize(caption))
515
+ bm25_data["caption"]["row_ids"].append(row_id)
516
+ if transcription:
517
+ bm25_data["transcription"]["docs"].append(tokenize(transcription))
518
+ bm25_data["transcription"]["row_ids"].append(row_id)
519
+
520
+ # Hashed lyrics BM25
521
+ lyrics_text = extract_lyrics(metadata_json)
522
+ if lyrics_text and len(lyrics_text) > 10:
523
+ hashed_tokens = tokenize_and_hash(lyrics_text)
524
+ if hashed_tokens:
525
+ bm25_data["lyrics_hashed"]["docs"].append(hashed_tokens)
526
+ bm25_data["lyrics_hashed"]["row_ids"].append(row_id)
527
+
528
+ total_new += 1
529
+
530
+ # Batch insert into SQLite
531
+ conn.executemany(
532
+ "INSERT OR IGNORE INTO tracks VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
533
+ insert_rows,
534
+ )
535
+ conn.commit()
536
+
537
+ # Batch add to FAISS indices
538
+ for field in embedding_fields:
539
+ vecs, rids = batch_embeddings[field]
540
+ if vecs:
541
+ arr = np.stack(vecs)
542
+ faiss_indices[field].add(arr)
543
+ id_maps[field].extend(rids)
544
+
545
+ manifest["processed_private"].append(pf.name)
546
+ manifest["total_rows"] = row_id_offset + total_new
547
+ save_manifest(manifest)
548
+
549
+ elapsed = time.time() - t0
550
+ rate = total_new / elapsed if elapsed > 0 else 0
551
+ remaining_files = len(files_to_process) - file_idx - 1
552
+ if rate > 0:
553
+ est_remaining = remaining_files * (n / rate)
554
+ eta = timedelta(seconds=int(est_remaining))
555
+ else:
556
+ eta = "?"
557
+
558
+ if (file_idx + 1) % 10 == 0 or (file_idx + 1) == len(files_to_process):
559
+ log.info(f" [{file_idx+1}/{len(files_to_process)}] {pf.name}: "
560
+ f"{n} rows, total={row_id_offset + total_new:,}, "
561
+ f"{rate:.0f} rows/s, ETA: {eta}")
562
+
563
+ log.info(f"\nInserted {total_new:,} new rows (total: {row_id_offset + total_new:,})")
564
+
565
+ # Save FAISS indices
566
+ log.info("Saving FAISS indices...")
567
+ for field in embedding_fields:
568
+ n_vecs = faiss_indices[field].ntotal
569
+ if n_vecs > 0:
570
+ faiss.write_index(faiss_indices[field], str(INDEX_DIR / f"faiss_{field}.index"))
571
+ np.save(str(INDEX_DIR / f"idmap_{field}.npy"), np.array(id_maps[field], dtype=np.int64))
572
+ log.info(f" {field}: {n_vecs:,} vectors")
573
+ else:
574
+ log.info(f" {field}: 0 vectors (skipped)")
575
+
576
+ # Build and save BM25 indices
577
+ log.info("Building BM25 indices...")
578
+ for bm25_name, bdata in bm25_data.items():
579
+ if bdata["docs"]:
580
+ idx = BM25Index()
581
+ idx.build(bdata["docs"], bdata["row_ids"])
582
+ with open(INDEX_DIR / f"bm25_{bm25_name}.pkl", "wb") as f:
583
+ pickle.dump(idx, f, protocol=pickle.HIGHEST_PROTOCOL)
584
+ log.info(f" {bm25_name}: {len(bdata['docs']):,} documents, "
585
+ f"{len(idx.vocab):,} unique tokens")
586
+ else:
587
+ log.info(f" {bm25_name}: 0 documents (skipped)")
588
+
589
+ # Final stats
590
+ conn.close()
591
+ save_manifest(manifest)
592
+ elapsed = time.time() - t0
593
+ log.info(f"\nDone in {timedelta(seconds=int(elapsed))}")
594
+ log.info(f"Index directory: {INDEX_DIR}")
595
+ log.info(f"Total tracks: {row_id_offset + total_new:,}")
596
+
597
+ # Print summary
598
+ for field in embedding_fields:
599
+ n = faiss_indices[field].ntotal
600
+ size_mb = n * 768 * 4 / 1024 / 1024
601
+ log.info(f" FAISS {field}: {n:,} vectors ({size_mb:.0f} MB)")
602
+
603
+ db_size = os.path.getsize(db_path) / 1024 / 1024
604
+ log.info(f" SQLite: {db_size:.0f} MB")
605
+
606
+
607
+ if __name__ == "__main__":
608
+ force = "--force" in sys.argv
609
+ build_all(force=force)
index.html ADDED
@@ -0,0 +1,1184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>LAION-Tunes Search</title>
7
+ <style>
8
+ /* ── Reset & Base ─────────────────────────────────────────────── */
9
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
10
+ body {
11
+ font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
12
+ background: #0f1419;
13
+ color: #e7e9ea;
14
+ line-height: 1.5;
15
+ min-height: 100vh;
16
+ }
17
+
18
+ /* ── Header ──────────────────────────────────────────────────── */
19
+ .header {
20
+ position: sticky; top: 0; z-index: 100;
21
+ background: linear-gradient(135deg, #1a1f2e 0%, #16213e 100%);
22
+ border-bottom: 2px solid #2d4a7a;
23
+ padding: 16px 24px 12px;
24
+ box-shadow: 0 4px 20px rgba(0,0,0,0.5);
25
+ }
26
+ .header h1 {
27
+ font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 12px;
28
+ }
29
+ .header h1 span { color: #64b5f6; }
30
+
31
+ /* ── Search Bar ──────────────────────────────────────────────── */
32
+ .search-row { display: flex; gap: 10px; margin-bottom: 10px; }
33
+ .search-input {
34
+ flex: 1; background: #1e2a3a; color: #e0e0e0;
35
+ border: 1px solid #37474f; border-radius: 8px;
36
+ padding: 10px 16px; font-size: 15px; outline: none;
37
+ }
38
+ .search-input:focus { border-color: #4fc3f7; }
39
+ .search-input::placeholder { color: #607d8b; }
40
+ .btn-search {
41
+ background: #2196F3; color: white; border: none;
42
+ border-radius: 8px; padding: 10px 24px;
43
+ font-size: 15px; font-weight: 600; cursor: pointer;
44
+ transition: background 0.2s;
45
+ }
46
+ .btn-search:hover { background: #1976D2; }
47
+
48
+ /* ── Controls ────────────────────────────────────────────────── */
49
+ .controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
50
+ .control-group { display: flex; align-items: center; gap: 5px; }
51
+ .control-group label { font-size: 12px; color: #90a4ae; font-weight: 600; white-space: nowrap; }
52
+ .control-group select, .control-group input[type="number"] {
53
+ background: #1e2a3a; color: #e0e0e0;
54
+ border: 1px solid #37474f; border-radius: 6px;
55
+ padding: 5px 8px; font-size: 12px; outline: none;
56
+ }
57
+ .control-group select:focus, .control-group input:focus { border-color: #4fc3f7; }
58
+ .control-group input[type="range"] {
59
+ background: transparent; width: 80px; accent-color: #4fc3f7;
60
+ }
61
+
62
+ /* ── Filter Chips ────────────────────────────────────────────── */
63
+ .filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
64
+ .filter-section { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-right: 12px; }
65
+ .filter-section-label { font-size: 11px; color: #607d8b; font-weight: 600; margin-right: 2px; }
66
+ .chip {
67
+ display: inline-flex; align-items: center; gap: 3px;
68
+ background: #1e2a3a; border: 1px solid #37474f;
69
+ border-radius: 14px; padding: 2px 10px; font-size: 11px; cursor: pointer;
70
+ transition: all 0.15s; user-select: none;
71
+ }
72
+ .chip:hover { border-color: #4fc3f7; }
73
+ .chip.active { background: #1a3a5c; border-color: #4fc3f7; color: #4fc3f7; }
74
+ .chip input[type="checkbox"] { display: none; }
75
+ .aes-val { color: #4fc3f7; font-weight: 700; min-width: 24px; text-align: center; font-size: 11px; }
76
+
77
+ /* ── Language Panel ──────────────────────────────────────────── */
78
+ .lang-panel {
79
+ display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
80
+ max-width: 100%; overflow: hidden;
81
+ }
82
+ .lang-chip {
83
+ display: inline-flex; align-items: center;
84
+ background: #1e2a3a; border: 1px solid #2a3a4a;
85
+ border-radius: 12px; padding: 1px 8px; font-size: 10px; cursor: pointer;
86
+ transition: all 0.15s; user-select: none; color: #90a4ae;
87
+ }
88
+ .lang-chip:hover { border-color: #4fc3f7; }
89
+ .lang-chip.active { background: #1a3a5c; border-color: #4fc3f7; color: #4fc3f7; }
90
+ .lang-chip .cnt { color: #546e7a; margin-left: 3px; }
91
+
92
+ /* ── Stage 2 Panel ──────────────────────────────────────────── */
93
+ .stage2-panel {
94
+ margin-top: 8px; padding: 10px 14px;
95
+ background: rgba(255,152,0,0.06); border: 1px solid #5d4037;
96
+ border-radius: 8px; display: none;
97
+ }
98
+ .stage2-panel.active { display: block; }
99
+ .stage2-header {
100
+ display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
101
+ }
102
+ .stage2-header .label { font-size: 12px; font-weight: 700; color: #ffb74d; }
103
+ .stage2-row { display: flex; gap: 10px; margin-bottom: 6px; }
104
+ .stage2-input {
105
+ flex: 1; background: #1e2a3a; color: #e0e0e0;
106
+ border: 1px solid #5d4037; border-radius: 8px;
107
+ padding: 8px 14px; font-size: 14px; outline: none;
108
+ }
109
+ .stage2-input:focus { border-color: #ffb74d; }
110
+ .stage2-input::placeholder { color: #607d8b; }
111
+ .stage2-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
112
+ .stage2-controls label { color: #ffb74d; }
113
+ .stage2-controls select, .stage2-controls input[type="number"] {
114
+ background: #1e2a3a; color: #e0e0e0;
115
+ border: 1px solid #5d4037; border-radius: 6px;
116
+ padding: 5px 8px; font-size: 12px; outline: none;
117
+ }
118
+ .stage2-controls select:focus, .stage2-controls input:focus { border-color: #ffb74d; }
119
+
120
+ /* ── Toggle Button ──────────────────────────────────────────── */
121
+ .toggle-btn {
122
+ background: transparent; color: #ffb74d; border: 1px solid #5d4037;
123
+ border-radius: 14px; padding: 2px 12px; font-size: 11px; cursor: pointer;
124
+ font-weight: 600; transition: all 0.15s;
125
+ }
126
+ .toggle-btn:hover { background: rgba(255,152,0,0.1); }
127
+ .toggle-btn.active { background: rgba(255,152,0,0.15); border-color: #ffb74d; }
128
+
129
+ /* ── Audio Upload Area ──────────────────────────────────────── */
130
+ .upload-row {
131
+ display: none; gap: 10px; margin-bottom: 10px; align-items: center;
132
+ }
133
+ .upload-row.active { display: flex; }
134
+ .upload-dropzone {
135
+ flex: 1; background: #1e2a3a; border: 2px dashed #37474f;
136
+ border-radius: 8px; padding: 12px 16px; cursor: pointer;
137
+ transition: all 0.2s; display: flex; align-items: center; gap: 10px;
138
+ min-height: 48px;
139
+ }
140
+ .upload-dropzone:hover, .upload-dropzone.dragover { border-color: #26c6da; background: #1a2e3a; }
141
+ .upload-dropzone.has-file { border-color: #26c6da; border-style: solid; }
142
+ .upload-dropzone .upload-icon { font-size: 20px; color: #546e7a; }
143
+ .upload-dropzone .upload-text { font-size: 14px; color: #78909c; }
144
+ .upload-dropzone .upload-filename { font-size: 14px; color: #26c6da; font-weight: 600; }
145
+ .upload-dropzone input[type="file"] { display: none; }
146
+ .upload-clear {
147
+ background: transparent; color: #ef5350; border: 1px solid #b71c1c;
148
+ border-radius: 6px; padding: 4px 10px; font-size: 11px; cursor: pointer;
149
+ font-weight: 600; display: none;
150
+ }
151
+ .upload-clear.visible { display: inline-block; }
152
+
153
+ /* ── Music Similarity Reference ─────────────────────────────── */
154
+ .sim-reference {
155
+ display: none; margin-bottom: 10px; padding: 8px 14px;
156
+ background: rgba(0,188,212,0.08); border: 1px solid #00838f;
157
+ border-radius: 8px; font-size: 13px; color: #80deea;
158
+ align-items: center; gap: 8px;
159
+ }
160
+ .sim-reference.active { display: flex; }
161
+ .sim-reference .ref-label { font-weight: 600; color: #26c6da; }
162
+ .sim-reference .ref-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
163
+ .sim-reference .ref-clear {
164
+ background: transparent; color: #ef5350; border: 1px solid #b71c1c;
165
+ border-radius: 6px; padding: 2px 8px; font-size: 10px; cursor: pointer;
166
+ font-weight: 600;
167
+ }
168
+
169
+ /* ── Find Similar Button ────────────────────────────────────── */
170
+ .btn-find-similar {
171
+ background: rgba(0,188,212,0.1); color: #26c6da; border: 1px solid #00838f;
172
+ border-radius: 6px; padding: 3px 10px; font-size: 11px; cursor: pointer;
173
+ font-weight: 600; transition: all 0.15s; white-space: nowrap;
174
+ }
175
+ .btn-find-similar:hover { background: rgba(0,188,212,0.2); border-color: #26c6da; }
176
+
177
+ /* ── Stats Bar ───────────────────────────────────────────────── */
178
+ .stats-bar {
179
+ padding: 6px 24px; background: #141a22;
180
+ border-bottom: 1px solid #1e2a3a;
181
+ font-size: 12px; color: #607d8b;
182
+ display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
183
+ }
184
+ .stats-bar .val { color: #4fc3f7; font-weight: 600; }
185
+ .btn-download {
186
+ margin-left: auto;
187
+ background: transparent; color: #66bb6a; border: 1px solid #2e7d32;
188
+ border-radius: 6px; padding: 3px 12px; font-size: 11px;
189
+ font-weight: 600; cursor: pointer; transition: all 0.15s;
190
+ display: none;
191
+ }
192
+ .btn-download:hover { background: rgba(76,175,80,0.15); }
193
+
194
+ /* ── Results ─────────────────────────────────────────────────── */
195
+ .results-container { max-width: 1200px; margin: 0 auto; padding: 16px 24px; }
196
+ .result-card {
197
+ background: linear-gradient(135deg, #1a2332 0%, #1e2a3a 100%);
198
+ border: 1px solid #263238; border-radius: 10px;
199
+ padding: 16px; margin-bottom: 12px;
200
+ transition: border-color 0.2s;
201
+ }
202
+ .result-card:hover { border-color: #37474f; }
203
+ .card-top { display: flex; gap: 16px; align-items: flex-start; }
204
+ .card-rank { font-size: 20px; font-weight: 700; color: #37474f; min-width: 32px; text-align: right; padding-top: 2px; }
205
+ .card-main { flex: 1; min-width: 0; }
206
+ .card-title {
207
+ font-size: 16px; font-weight: 700; color: #e7e9ea; margin-bottom: 4px;
208
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
209
+ }
210
+
211
+ /* ── Badges ──────────────────────────────────────────────────── */
212
+ .badge-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
213
+ .badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
214
+ .badge-suno { background: rgba(33,150,243,0.15); color: #90caf9; border: 1px solid #2196f3; }
215
+ .badge-udio { background: rgba(156,39,176,0.15); color: #ce93d8; border: 1px solid #9c27b0; }
216
+ .badge-mureka { background: rgba(76,175,80,0.15); color: #a5d6a7; border: 1px solid #4caf50; }
217
+ .badge-riffusion { background: rgba(255,152,0,0.15); color: #ffcc80; border: 1px solid #ff9800; }
218
+ .badge-sonauto { background: rgba(0,188,212,0.15); color: #80deea; border: 1px solid #00bcd4; }
219
+ .badge-genre { background: rgba(255,255,255,0.05); color: #b0bec5; border: 1px solid #455a64; }
220
+ .badge-mood { background: rgba(233,30,99,0.1); color: #f48fb1; border: 1px solid #e91e63; }
221
+ .badge-lang { background: rgba(103,58,183,0.15); color: #b39ddb; border: 1px solid #7e57c2; }
222
+ .badge-instrumental { background: rgba(0,150,136,0.15); color: #80cbc4; border: 1px solid #009688; }
223
+ .badge-vocal { background: rgba(255,87,34,0.1); color: #ffab91; border: 1px solid #ff5722; }
224
+ .badge-nsfw-warn { background: rgba(255,152,0,0.2); color: #ffcc80; border: 1px solid #ff9800; }
225
+ .badge-nsfw-danger { background: rgba(244,67,54,0.2); color: #ef9a9a; border: 1px solid #f44336; }
226
+
227
+ /* ── Metrics Row ─────────────────────────────────────────────── */
228
+ .metrics-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; font-size: 12px; color: #90a4ae; }
229
+ .metric-item { display: flex; align-items: center; gap: 3px; }
230
+ .metric-label { color: #607d8b; }
231
+ .metric-val { font-weight: 700; }
232
+
233
+ /* ── Aesthetics Bar ──────────────────────────────────────────── */
234
+ .aesthetics-bar { height: 4px; border-radius: 2px; margin: 4px 0; background: #263238; position: relative; max-width: 100px; }
235
+ .aesthetics-bar-fill { height: 100%; border-radius: 2px; position: absolute; left: 0; top: 0; }
236
+
237
+ /* ── Caption (full display) ──────────────────────────────────── */
238
+ .card-caption {
239
+ font-size: 12px; color: #90a4ae; margin: 8px 0;
240
+ line-height: 1.6; background: rgba(0,0,0,0.15);
241
+ padding: 10px 12px; border-radius: 6px; border-left: 3px solid #37474f;
242
+ }
243
+
244
+ /* ── Audio Player ────────────────────────────────────────────── */
245
+ .card-audio { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
246
+ .card-audio audio { flex: 1; height: 32px; border-radius: 6px; }
247
+
248
+ /* ── Score Display ───────────────────────────────────────────── */
249
+ .card-score { text-align: right; min-width: 80px; }
250
+ .card-score .score-val { font-size: 22px; font-weight: 800; color: #4fc3f7; }
251
+ .card-score .score-label { font-size: 10px; color: #607d8b; }
252
+ .card-scores-dual { text-align: right; min-width: 90px; }
253
+ .card-scores-dual .s1 { font-size: 11px; color: #607d8b; }
254
+ .card-scores-dual .s1 .v { color: #64b5f6; font-weight: 700; }
255
+ .card-scores-dual .s2 { font-size: 16px; margin-top: 2px; }
256
+ .card-scores-dual .s2 .v { color: #ffb74d; font-weight: 800; }
257
+ .card-scores-dual .s2 .l { font-size: 10px; color: #8d6e63; }
258
+
259
+ /* ── Tags display ────────────────────────────────────────────── */
260
+ .tags-text { font-size: 11px; color: #78909c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 600px; }
261
+
262
+ /* ── Loading / Empty ─────────────────────────────────────────── */
263
+ .loading { text-align: center; padding: 60px; color: #546e7a; font-size: 16px; }
264
+ .loading .spinner {
265
+ display: inline-block; width: 30px; height: 30px;
266
+ border: 3px solid #263238; border-top-color: #4fc3f7;
267
+ border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 12px;
268
+ }
269
+ @keyframes spin { to { transform: rotate(360deg); } }
270
+ .empty-state { text-align: center; padding: 80px 24px; color: #546e7a; }
271
+ .empty-state .icon { font-size: 48px; margin-bottom: 16px; }
272
+ .empty-state p { font-size: 14px; max-width: 400px; margin: 0 auto; }
273
+ </style>
274
+ </head>
275
+ <body>
276
+
277
+ <div class="header">
278
+ <h1>LAION-Tunes <span>Search</span></h1>
279
+
280
+ <!-- Text query row (hidden in music_similarity mode) -->
281
+ <div class="search-row" id="query-row">
282
+ <input type="text" class="search-input" id="query" placeholder="Stage 1: Search music... e.g. 'dreamy ambient synth pad' or 'aggressive metal guitar solo'" autofocus>
283
+ <button class="btn-search" id="btn-search-main" onclick="doSearch()">Search</button>
284
+ </div>
285
+
286
+ <!-- Audio upload row (shown in music_similarity mode) -->
287
+ <div class="upload-row" id="upload-row">
288
+ <div class="upload-dropzone" id="upload-dropzone" onclick="document.getElementById('audio-file-input').click()">
289
+ <span class="upload-icon">&#9835;</span>
290
+ <span class="upload-text" id="upload-text">Drop audio file here or click to browse (first 30s used)</span>
291
+ <span class="upload-filename" id="upload-filename" style="display:none"></span>
292
+ <input type="file" id="audio-file-input" accept="audio/*,.mp3,.wav,.flac,.ogg,.m4a,.mp4,.webm,.opus">
293
+ </div>
294
+ <button class="upload-clear" id="upload-clear" onclick="clearUpload()">Clear</button>
295
+ <button class="btn-search" onclick="doSearch()">Search</button>
296
+ </div>
297
+
298
+ <!-- Music similarity reference indicator -->
299
+ <div class="sim-reference" id="sim-reference">
300
+ <span class="ref-label">Similar to:</span>
301
+ <span class="ref-title" id="sim-ref-title"></span>
302
+ <button class="ref-clear" onclick="clearSimilarityRef()">Clear</button>
303
+ </div>
304
+
305
+ <!-- Audio preview player for uploaded file -->
306
+ <div class="sim-reference" id="upload-preview" style="display:none; background:rgba(0,150,136,0.08); border-color:#00695c;">
307
+ <span class="ref-label" style="color:#26a69a;">Uploaded:</span>
308
+ <span class="ref-title" id="upload-preview-name" style="color:#80cbc4;"></span>
309
+ <audio controls id="upload-audio-player" style="height:28px; max-width:300px; flex-shrink:0;"></audio>
310
+ </div>
311
+
312
+ <div class="search-row" id="negative-row" style="display:none">
313
+ <input type="text" class="search-input" id="negative_query" placeholder="Negative prompt: exclude results matching this... e.g. 'vocals singing lyrics'" style="border-color:#ef5350; color:#ef9a9a;">
314
+ <div class="control-group" style="min-width:100px">
315
+ <label style="color:#ef5350">Weight:</label>
316
+ <input type="range" id="neg_weight" min="0.1" max="1.0" step="0.1" value="0.7" style="accent-color:#ef5350;" oninput="document.getElementById('neg-val').textContent=this.value">
317
+ <span class="aes-val" id="neg-val" style="color:#ef5350">0.7</span>
318
+ </div>
319
+ </div>
320
+
321
+ <!-- Row 1: Main controls -->
322
+ <div class="controls">
323
+ <div class="control-group">
324
+ <label>Mode:</label>
325
+ <select id="search_type" onchange="updateControls()">
326
+ <option value="bm25" selected>BM25 Text</option>
327
+ <option value="vector">Vector Similarity</option>
328
+ <option value="combined">Combined</option>
329
+ <option value="music_similarity">Music Similarity</option>
330
+ </select>
331
+ </div>
332
+ <div class="control-group" id="vector-field-group" style="display:none">
333
+ <label>Vector:</label>
334
+ <select id="vector_field">
335
+ <option value="caption" selected>Whisper Caption</option>
336
+ <option value="tag">Tags</option>
337
+ <option value="lyric">Lyrics</option>
338
+ <option value="mood">Mood</option>
339
+ <option value="transcription">Transcription</option>
340
+ </select>
341
+ </div>
342
+ <div class="control-group" id="bm25-field-group">
343
+ <label>BM25 Field:</label>
344
+ <select id="bm25_field">
345
+ <option value="caption" selected>Whisper Caption</option>
346
+ <option value="tags">Tags</option>
347
+ <option value="transcription">Transcription</option>
348
+ <option value="lyrics_hashed">Lyrics (hashed)</option>
349
+ </select>
350
+ </div>
351
+ <div class="control-group">
352
+ <label>Rank by:</label>
353
+ <select id="rank_by">
354
+ <option value="similarity" selected>Relevance</option>
355
+ <option value="music_similarity">Music Similarity</option>
356
+ <option value="aesthetics">Aesthetics Score</option>
357
+ <option value="plays">Play Count</option>
358
+ <option value="likes">Like Count</option>
359
+ </select>
360
+ </div>
361
+ <div class="control-group">
362
+ <label>K:</label>
363
+ <select id="top_k" onchange="syncTopKInput(this)">
364
+ <option value="20">20</option>
365
+ <option value="50" selected>50</option>
366
+ <option value="100">100</option>
367
+ <option value="200">200</option>
368
+ <option value="500">500</option>
369
+ <option value="1000">1,000</option>
370
+ <option value="5000">5,000</option>
371
+ <option value="10000">10,000</option>
372
+ <option value="custom">Custom...</option>
373
+ </select>
374
+ <input type="number" id="top_k_custom" min="1" max="50000" value="50" style="width:65px; display:none">
375
+ </div>
376
+ <button class="toggle-btn" id="stage2-toggle" onclick="toggleStage2()">+ Stage 2</button>
377
+ </div>
378
+
379
+ <!-- Stage 2 Panel -->
380
+ <div class="stage2-panel" id="stage2-panel">
381
+ <div class="stage2-header">
382
+ <span class="label">Stage 2 Refinement</span>
383
+ <span style="font-size:11px; color:#8d6e63;">Re-filter Stage 1 results by a second query</span>
384
+ </div>
385
+ <div class="stage2-row">
386
+ <input type="text" class="stage2-input" id="s2_query" placeholder="Stage 2 query... e.g. 'angry little dog' or 'hip-hop beat'">
387
+ </div>
388
+ <div class="stage2-controls">
389
+ <div class="control-group">
390
+ <label>Mode:</label>
391
+ <select id="s2_search_type" onchange="updateS2Controls()">
392
+ <option value="vector" selected>Vector Similarity</option>
393
+ <option value="bm25">BM25 Text</option>
394
+ </select>
395
+ </div>
396
+ <div class="control-group" id="s2-vector-field-group">
397
+ <label>Vector:</label>
398
+ <select id="s2_vector_field">
399
+ <option value="caption" selected>Whisper Caption</option>
400
+ <option value="tag">Tags</option>
401
+ <option value="lyric">Lyrics</option>
402
+ <option value="mood">Mood</option>
403
+ <option value="transcription">Transcription</option>
404
+ </select>
405
+ </div>
406
+ <div class="control-group" id="s2-bm25-field-group" style="display:none">
407
+ <label>BM25 Field:</label>
408
+ <select id="s2_bm25_field">
409
+ <option value="caption" selected>Whisper Caption</option>
410
+ <option value="tags">Tags</option>
411
+ <option value="transcription">Transcription</option>
412
+ <option value="lyrics_hashed">Lyrics (hashed)</option>
413
+ </select>
414
+ </div>
415
+ <div class="control-group">
416
+ <label>Stage 2 K:</label>
417
+ <select id="s2_top_k" onchange="syncS2TopKInput(this)">
418
+ <option value="20">20</option>
419
+ <option value="50" selected>50</option>
420
+ <option value="100">100</option>
421
+ <option value="200">200</option>
422
+ <option value="custom">Custom...</option>
423
+ </select>
424
+ <input type="number" id="s2_top_k_custom" min="1" max="50000" value="50" style="width:65px; display:none">
425
+ </div>
426
+ </div>
427
+ </div>
428
+
429
+ <!-- Row 2: Filters -->
430
+ <div class="filters">
431
+ <div class="filter-section">
432
+ <span class="filter-section-label">Vocals:</span>
433
+ <span class="chip active" onclick="setVocal(this, null)">All</span>
434
+ <span class="chip" onclick="setVocal(this, 'instrumental')">Instrumental</span>
435
+ <span class="chip" onclick="setVocal(this, 'vocals')">With Vocals</span>
436
+ </div>
437
+ <div class="filter-section">
438
+ <span class="filter-section-label">Min Duration:</span>
439
+ <div class="control-group">
440
+ <input type="number" id="min_duration" value="60" min="0" max="600" step="10" style="width:55px">
441
+ <label>sec</label>
442
+ </div>
443
+ </div>
444
+ <div class="filter-section">
445
+ <span class="filter-section-label">Min Aesthetics:</span>
446
+ <div class="control-group">
447
+ <input type="range" id="min_aesthetics" min="0" max="5" step="0.1" value="0" oninput="document.getElementById('aes-val').textContent=this.value">
448
+ <span class="aes-val" id="aes-val">0</span>
449
+ </div>
450
+ </div>
451
+ <div class="filter-section">
452
+ <span class="filter-section-label">Subset:</span>
453
+ <span class="chip active" onclick="setSubset(this, null)">All</span>
454
+ <span class="chip" onclick="setSubset(this, 'suno')">Suno</span>
455
+ <span class="chip" onclick="setSubset(this, 'udio')">Udio</span>
456
+ <span class="chip" onclick="setSubset(this, 'mureka')">Mureka</span>
457
+ <span class="chip" onclick="setSubset(this, 'riffusion')">Riffusion</span>
458
+ <span class="chip" onclick="setSubset(this, 'sonauto')">Sonauto</span>
459
+ </div>
460
+ <div class="filter-section">
461
+ <span class="filter-section-label">Safety:</span>
462
+ <span class="chip active" onclick="setNsfw(this, null)">All</span>
463
+ <span class="chip" onclick="setNsfw(this, 'sfw_only')">SFW Only</span>
464
+ <span class="chip" onclick="setNsfw(this, 'nsfw_only')">NSFW Only</span>
465
+ </div>
466
+ </div>
467
+
468
+ <!-- Row 3: Language filters -->
469
+ <div class="filters">
470
+ <div class="filter-section">
471
+ <span class="filter-section-label">Languages:</span>
472
+ <span class="chip active" onclick="setAllLangs(this)">All</span>
473
+ <div class="lang-panel" id="lang-panel">
474
+ <!-- Populated dynamically from /api/stats -->
475
+ </div>
476
+ </div>
477
+ </div>
478
+ </div>
479
+
480
+ <div class="stats-bar" id="stats-bar">
481
+ <span>Total: <span class="val" id="stat-total">--</span></span>
482
+ <span>Results: <span class="val" id="stat-results">--</span></span>
483
+ <span>Filtered: <span class="val" id="stat-filtered">--</span></span>
484
+ <span id="stat-stage2-wrap" style="display:none">Stage2: <span class="val" id="stat-stage2">--</span></span>
485
+ <span id="stat-whisper-wrap" style="display:none">Whisper Index: <span class="val" id="stat-whisper">--</span></span>
486
+ <span id="stat-cache-wrap" style="display:none"><span class="val" id="stat-cache" style="color:#26a69a;">Cached</span></span>
487
+ <span>Time: <span class="val" id="stat-time">--</span></span>
488
+ <span>Embedding: <span class="val" id="stat-emb">--</span></span>
489
+ <button class="btn-download" id="btn-download" onclick="downloadResults()">Download JSON</button>
490
+ </div>
491
+
492
+ <div class="results-container" id="results">
493
+ <div class="empty-state">
494
+ <div class="icon">&#9835;</div>
495
+ <p>Search the LAION-Tunes dataset of 908K AI-generated music tracks. Use BM25 for text matching, Vector for semantic similarity, or Music Similarity for audio-based search. Enable Stage 2 to refine results with a second query.</p>
496
+ </div>
497
+ </div>
498
+
499
+ <script>
500
+ // ── State ───────────────────────────────────────────────────────
501
+ let selectedSubset = null;
502
+ let selectedVocal = null; // null | "instrumental" | "vocals"
503
+ let selectedNsfw = null; // null | "sfw_only" | "nsfw_only"
504
+ let selectedLangs = null; // null = all, or Set of codes
505
+ let allLanguages = {}; // code -> count
506
+ let isSearching = false;
507
+ let lastResults = null; // store for download
508
+ let stage2Active = false;
509
+ let whisperEmbCount = 0;
510
+
511
+ // Music similarity state
512
+ let uploadedAudioFile = null;
513
+ let similarityRowId = null;
514
+ let similarityRefTitle = null;
515
+
516
+ // Language code to display name
517
+ const LANG_NAMES = {
518
+ en:'English', es:'Spanish', fr:'French', de:'German', pt:'Portuguese',
519
+ it:'Italian', nl:'Dutch', ru:'Russian', ja:'Japanese', ko:'Korean',
520
+ zh:'Chinese', ar:'Arabic', hi:'Hindi', tr:'Turkish', pl:'Polish',
521
+ sv:'Swedish', da:'Danish', no:'Norwegian', fi:'Finnish', cs:'Czech',
522
+ ro:'Romanian', hu:'Hungarian', el:'Greek', th:'Thai', vi:'Vietnamese',
523
+ id:'Indonesian', ms:'Malay', tl:'Tagalog', uk:'Ukrainian', bg:'Bulgarian',
524
+ hr:'Croatian', sk:'Slovak', sl:'Slovenian', lt:'Lithuanian', lv:'Latvian',
525
+ et:'Estonian', ca:'Catalan', gl:'Galician', eu:'Basque', cy:'Welsh',
526
+ af:'Afrikaans', sw:'Swahili', sq:'Albanian', mk:'Macedonian', sr:'Serbian',
527
+ unknown:'Unknown'
528
+ };
529
+
530
+ // ── Stage 2 Toggle ──────────────────────────────────────────────
531
+ function toggleStage2() {
532
+ stage2Active = !stage2Active;
533
+ const panel = document.getElementById('stage2-panel');
534
+ const btn = document.getElementById('stage2-toggle');
535
+ if (stage2Active) {
536
+ panel.classList.add('active');
537
+ btn.classList.add('active');
538
+ btn.textContent = '- Stage 2';
539
+ } else {
540
+ panel.classList.remove('active');
541
+ btn.classList.remove('active');
542
+ btn.textContent = '+ Stage 2';
543
+ }
544
+ }
545
+
546
+ function updateS2Controls() {
547
+ const mode = document.getElementById('s2_search_type').value;
548
+ document.getElementById('s2-vector-field-group').style.display = mode === 'vector' ? 'flex' : 'none';
549
+ document.getElementById('s2-bm25-field-group').style.display = mode === 'bm25' ? 'flex' : 'none';
550
+ }
551
+
552
+ // ── Custom K inputs ─────────────────────────────────────────────
553
+ function syncTopKInput(sel) {
554
+ const custom = document.getElementById('top_k_custom');
555
+ if (sel.value === 'custom') {
556
+ custom.style.display = 'inline-block';
557
+ custom.focus();
558
+ } else {
559
+ custom.style.display = 'none';
560
+ custom.value = sel.value;
561
+ }
562
+ }
563
+ function syncS2TopKInput(sel) {
564
+ const custom = document.getElementById('s2_top_k_custom');
565
+ if (sel.value === 'custom') {
566
+ custom.style.display = 'inline-block';
567
+ custom.focus();
568
+ } else {
569
+ custom.style.display = 'none';
570
+ custom.value = sel.value;
571
+ }
572
+ }
573
+ function getTopK() {
574
+ const sel = document.getElementById('top_k');
575
+ if (sel.value === 'custom') return parseInt(document.getElementById('top_k_custom').value) || 50;
576
+ return parseInt(sel.value);
577
+ }
578
+ function getS2TopK() {
579
+ const sel = document.getElementById('s2_top_k');
580
+ if (sel.value === 'custom') return parseInt(document.getElementById('s2_top_k_custom').value) || 50;
581
+ return parseInt(sel.value);
582
+ }
583
+
584
+ // ── Controls visibility ─────────────────────────────────────────
585
+ function updateControls() {
586
+ const mode = document.getElementById('search_type').value;
587
+ const isMusicSim = mode === 'music_similarity';
588
+ const isVector = mode === 'vector' || mode === 'combined';
589
+
590
+ // Show/hide query row vs upload row
591
+ document.getElementById('query-row').style.display = isMusicSim ? 'none' : 'flex';
592
+ document.getElementById('upload-row').classList.toggle('active', isMusicSim);
593
+
594
+ // Show/hide vector/BM25 field selectors
595
+ document.getElementById('vector-field-group').style.display = (isVector && !isMusicSim) ? 'flex' : 'none';
596
+ document.getElementById('bm25-field-group').style.display =
597
+ (mode === 'bm25' || mode === 'combined') ? 'flex' : 'none';
598
+
599
+ // Show/hide negative prompt row (only for vector/combined)
600
+ document.getElementById('negative-row').style.display = (isVector && !isMusicSim) ? 'flex' : 'none';
601
+
602
+ // Show stage2 toggle (always available, including music_similarity)
603
+ document.getElementById('stage2-toggle').style.display = '';
604
+
605
+ // Show/hide similarity reference
606
+ updateSimReference();
607
+
608
+ // Default rank_by to music_similarity when in that mode
609
+ if (isMusicSim) {
610
+ document.getElementById('rank_by').value = 'music_similarity';
611
+ } else if (document.getElementById('rank_by').value === 'music_similarity') {
612
+ document.getElementById('rank_by').value = 'similarity';
613
+ }
614
+ }
615
+
616
+ // ── Audio Upload ────────────────────────────────────────────────
617
+ const dropzone = document.getElementById('upload-dropzone');
618
+ const fileInput = document.getElementById('audio-file-input');
619
+
620
+ fileInput.addEventListener('change', function() {
621
+ if (this.files.length > 0) {
622
+ setUploadFile(this.files[0]);
623
+ }
624
+ });
625
+
626
+ dropzone.addEventListener('dragover', function(e) {
627
+ e.preventDefault();
628
+ dropzone.classList.add('dragover');
629
+ });
630
+ dropzone.addEventListener('dragleave', function() {
631
+ dropzone.classList.remove('dragover');
632
+ });
633
+ dropzone.addEventListener('drop', function(e) {
634
+ e.preventDefault();
635
+ dropzone.classList.remove('dragover');
636
+ if (e.dataTransfer.files.length > 0) {
637
+ setUploadFile(e.dataTransfer.files[0]);
638
+ }
639
+ });
640
+
641
+ let uploadAudioObjectURL = null;
642
+
643
+ function setUploadFile(file) {
644
+ uploadedAudioFile = file;
645
+ similarityRowId = null; // Clear any sample reference
646
+ similarityRefTitle = null;
647
+ document.getElementById('upload-text').style.display = 'none';
648
+ document.getElementById('upload-filename').style.display = 'inline';
649
+ document.getElementById('upload-filename').textContent = file.name + ' (' + (file.size / 1024 / 1024).toFixed(1) + ' MB)';
650
+ document.getElementById('upload-clear').classList.add('visible');
651
+ dropzone.classList.add('has-file');
652
+
653
+ // Audio preview player
654
+ if (uploadAudioObjectURL) URL.revokeObjectURL(uploadAudioObjectURL);
655
+ uploadAudioObjectURL = URL.createObjectURL(file);
656
+ const player = document.getElementById('upload-audio-player');
657
+ player.src = uploadAudioObjectURL;
658
+ document.getElementById('upload-preview-name').textContent = file.name;
659
+ document.getElementById('upload-preview').style.display = 'flex';
660
+
661
+ updateSimReference();
662
+ }
663
+
664
+ function clearUpload() {
665
+ uploadedAudioFile = null;
666
+ fileInput.value = '';
667
+ document.getElementById('upload-text').style.display = 'inline';
668
+ document.getElementById('upload-filename').style.display = 'none';
669
+ document.getElementById('upload-clear').classList.remove('visible');
670
+ dropzone.classList.remove('has-file');
671
+
672
+ // Clear audio preview player
673
+ if (uploadAudioObjectURL) {
674
+ URL.revokeObjectURL(uploadAudioObjectURL);
675
+ uploadAudioObjectURL = null;
676
+ }
677
+ document.getElementById('upload-audio-player').src = '';
678
+ document.getElementById('upload-preview').style.display = 'none';
679
+
680
+ updateSimReference();
681
+ }
682
+
683
+ // ── Similarity Reference ────────────────────────────────────────
684
+ function updateSimReference() {
685
+ const ref = document.getElementById('sim-reference');
686
+ const mode = document.getElementById('search_type').value;
687
+ if (mode === 'music_similarity' && similarityRowId && similarityRefTitle) {
688
+ ref.classList.add('active');
689
+ document.getElementById('sim-ref-title').textContent = similarityRefTitle;
690
+ } else {
691
+ ref.classList.remove('active');
692
+ }
693
+ }
694
+
695
+ function clearSimilarityRef() {
696
+ similarityRowId = null;
697
+ similarityRefTitle = null;
698
+ updateSimReference();
699
+ }
700
+
701
+ function findSimilar(rowId, title) {
702
+ // Switch to music similarity mode
703
+ document.getElementById('search_type').value = 'music_similarity';
704
+ similarityRowId = rowId;
705
+ similarityRefTitle = title;
706
+ uploadedAudioFile = null;
707
+ fileInput.value = '';
708
+ document.getElementById('upload-text').style.display = 'inline';
709
+ document.getElementById('upload-filename').style.display = 'none';
710
+ document.getElementById('upload-clear').classList.remove('visible');
711
+ dropzone.classList.remove('has-file');
712
+ // Clear audio preview
713
+ if (uploadAudioObjectURL) {
714
+ URL.revokeObjectURL(uploadAudioObjectURL);
715
+ uploadAudioObjectURL = null;
716
+ }
717
+ document.getElementById('upload-audio-player').src = '';
718
+ document.getElementById('upload-preview').style.display = 'none';
719
+ updateControls();
720
+ doSearch();
721
+ }
722
+
723
+ // ── Chip group helpers ──────────────────────────────────────────
724
+ function setVocal(el, val) {
725
+ el.parentElement.querySelectorAll('.chip').forEach(c => c.classList.remove('active'));
726
+ el.classList.add('active');
727
+ selectedVocal = val;
728
+ }
729
+
730
+ function setSubset(el, val) {
731
+ el.parentElement.querySelectorAll('.chip').forEach(c => c.classList.remove('active'));
732
+ el.classList.add('active');
733
+ selectedSubset = val;
734
+ }
735
+
736
+ function setNsfw(el, val) {
737
+ el.parentElement.querySelectorAll('.chip').forEach(c => c.classList.remove('active'));
738
+ el.classList.add('active');
739
+ selectedNsfw = val;
740
+ }
741
+
742
+ function setAllLangs(el) {
743
+ selectedLangs = null;
744
+ el.classList.add('active');
745
+ document.querySelectorAll('.lang-chip').forEach(c => c.classList.remove('active'));
746
+ }
747
+
748
+ function toggleLang(el, code) {
749
+ // Deactivate "All" chip
750
+ const allChip = el.closest('.filter-section').querySelector('.chip');
751
+ allChip.classList.remove('active');
752
+
753
+ el.classList.toggle('active');
754
+ // Collect active languages
755
+ const active = document.querySelectorAll('.lang-chip.active');
756
+ if (active.length === 0) {
757
+ selectedLangs = null;
758
+ allChip.classList.add('active');
759
+ } else {
760
+ selectedLangs = new Set();
761
+ active.forEach(c => selectedLangs.add(c.dataset.lang));
762
+ }
763
+ }
764
+
765
+ // ── Download Results as JSON ────────────────────────────────────
766
+ function downloadResults() {
767
+ if (!lastResults || !lastResults.results || lastResults.results.length === 0) return;
768
+ const blob = new Blob([JSON.stringify(lastResults.results, null, 2)], { type: 'application/json' });
769
+ const url = URL.createObjectURL(blob);
770
+ const a = document.createElement('a');
771
+ a.href = url;
772
+ a.download = 'laion-tunes-results.json';
773
+ a.click();
774
+ URL.revokeObjectURL(url);
775
+ }
776
+
777
+ // ── Search ──────────────────────────────────────────────────────
778
+ async function doSearch() {
779
+ if (isSearching) return;
780
+
781
+ const mode = document.getElementById('search_type').value;
782
+ const resultsDiv = document.getElementById('results');
783
+
784
+ // Music similarity mode
785
+ if (mode === 'music_similarity') {
786
+ return doMusicSimilaritySearch();
787
+ }
788
+
789
+ const query = document.getElementById('query').value.trim();
790
+ if (!query) return;
791
+
792
+ isSearching = true;
793
+ resultsDiv.innerHTML = '<div class="loading"><div class="spinner"></div><br>Searching...</div>';
794
+
795
+ const minAes = parseFloat(document.getElementById('min_aesthetics').value);
796
+ const minDur = parseFloat(document.getElementById('min_duration').value);
797
+
798
+ const negQuery = document.getElementById('negative_query').value.trim();
799
+ const negWeight = parseFloat(document.getElementById('neg_weight').value);
800
+
801
+ const body = {
802
+ query: query,
803
+ negative_query: negQuery || null,
804
+ search_type: document.getElementById('search_type').value,
805
+ vector_field: document.getElementById('vector_field').value,
806
+ bm25_field: document.getElementById('bm25_field').value,
807
+ rank_by: document.getElementById('rank_by').value,
808
+ min_aesthetics: minAes > 0 ? minAes : null,
809
+ min_similarity: null,
810
+ subset_filter: selectedSubset,
811
+ vocal_filter: selectedVocal,
812
+ min_duration: minDur > 0 ? minDur : null,
813
+ languages: selectedLangs ? Array.from(selectedLangs) : null,
814
+ negative_weight: negWeight,
815
+ nsfw_filter: selectedNsfw,
816
+ top_k: getTopK(),
817
+ };
818
+
819
+ // Stage 2
820
+ if (stage2Active) {
821
+ const s2q = document.getElementById('s2_query').value.trim();
822
+ if (s2q) {
823
+ body.stage2_enabled = true;
824
+ body.stage2_query = s2q;
825
+ body.stage2_search_type = document.getElementById('s2_search_type').value;
826
+ body.stage2_vector_field = document.getElementById('s2_vector_field').value;
827
+ body.stage2_bm25_field = document.getElementById('s2_bm25_field').value;
828
+ body.stage2_top_k = getS2TopK();
829
+ }
830
+ }
831
+
832
+ try {
833
+ const resp = await fetch('/api/search', {
834
+ method: 'POST',
835
+ headers: { 'Content-Type': 'application/json' },
836
+ body: JSON.stringify(body),
837
+ });
838
+ const data = await resp.json();
839
+ lastResults = data;
840
+ renderResults(data);
841
+ } catch (err) {
842
+ resultsDiv.innerHTML = `<div class="empty-state"><p>Error: ${err.message}</p></div>`;
843
+ } finally {
844
+ isSearching = false;
845
+ }
846
+ }
847
+
848
+ async function doMusicSimilaritySearch() {
849
+ const resultsDiv = document.getElementById('results');
850
+
851
+ // Decide: upload audio or use pre-computed embedding
852
+ if (similarityRowId) {
853
+ // Use pre-computed embedding
854
+ isSearching = true;
855
+ resultsDiv.innerHTML = '<div class="loading"><div class="spinner"></div><br>Finding similar tracks...</div>';
856
+
857
+ const minAes = parseFloat(document.getElementById('min_aesthetics').value);
858
+ const minDur = parseFloat(document.getElementById('min_duration').value);
859
+
860
+ const body = {
861
+ row_id: similarityRowId,
862
+ top_k: getTopK(),
863
+ rank_by: document.getElementById('rank_by').value,
864
+ min_aesthetics: minAes > 0 ? minAes : null,
865
+ subset_filter: selectedSubset,
866
+ vocal_filter: selectedVocal,
867
+ min_duration: minDur > 0 ? minDur : null,
868
+ languages: selectedLangs ? Array.from(selectedLangs) : null,
869
+ nsfw_filter: selectedNsfw,
870
+ };
871
+
872
+ // Stage 2 for similar search
873
+ if (stage2Active) {
874
+ const s2q = document.getElementById('s2_query').value.trim();
875
+ if (s2q) {
876
+ body.stage2_enabled = true;
877
+ body.stage2_query = s2q;
878
+ body.stage2_search_type = document.getElementById('s2_search_type').value;
879
+ body.stage2_vector_field = document.getElementById('s2_vector_field').value;
880
+ body.stage2_bm25_field = document.getElementById('s2_bm25_field').value;
881
+ body.stage2_top_k = getS2TopK();
882
+ }
883
+ }
884
+
885
+ try {
886
+ const resp = await fetch('/api/search_similar', {
887
+ method: 'POST',
888
+ headers: { 'Content-Type': 'application/json' },
889
+ body: JSON.stringify(body),
890
+ });
891
+ const data = await resp.json();
892
+ if (data.error) {
893
+ resultsDiv.innerHTML = `<div class="empty-state"><p>Error: ${data.error}</p></div>`;
894
+ } else {
895
+ lastResults = data;
896
+ renderResults(data);
897
+ }
898
+ } catch (err) {
899
+ resultsDiv.innerHTML = `<div class="empty-state"><p>Error: ${err.message}</p></div>`;
900
+ } finally {
901
+ isSearching = false;
902
+ }
903
+
904
+ } else if (uploadedAudioFile) {
905
+ // Upload audio
906
+ isSearching = true;
907
+ resultsDiv.innerHTML = '<div class="loading"><div class="spinner"></div><br>Processing audio & searching...</div>';
908
+
909
+ const minAes = parseFloat(document.getElementById('min_aesthetics').value);
910
+ const minDur = parseFloat(document.getElementById('min_duration').value);
911
+
912
+ const formData = new FormData();
913
+ formData.append('audio', uploadedAudioFile);
914
+ formData.append('top_k', getTopK());
915
+ formData.append('rank_by', document.getElementById('rank_by').value);
916
+ formData.append('subset_filter', selectedSubset || '');
917
+ formData.append('vocal_filter', selectedVocal || '');
918
+ formData.append('min_duration', minDur > 0 ? minDur : '');
919
+ formData.append('min_aesthetics', minAes > 0 ? minAes : '');
920
+ formData.append('languages', selectedLangs ? Array.from(selectedLangs).join(',') : '');
921
+ formData.append('nsfw_filter', selectedNsfw || '');
922
+
923
+ // Stage 2 for audio upload search
924
+ if (stage2Active) {
925
+ const s2q = document.getElementById('s2_query').value.trim();
926
+ if (s2q) {
927
+ formData.append('stage2_enabled', 'true');
928
+ formData.append('stage2_query', s2q);
929
+ formData.append('stage2_search_type', document.getElementById('s2_search_type').value);
930
+ formData.append('stage2_vector_field', document.getElementById('s2_vector_field').value);
931
+ formData.append('stage2_bm25_field', document.getElementById('s2_bm25_field').value);
932
+ formData.append('stage2_top_k', getS2TopK());
933
+ }
934
+ }
935
+
936
+ try {
937
+ const resp = await fetch('/api/search_by_audio', {
938
+ method: 'POST',
939
+ body: formData,
940
+ });
941
+ const data = await resp.json();
942
+ if (data.error) {
943
+ resultsDiv.innerHTML = `<div class="empty-state"><p>Error: ${data.error}</p></div>`;
944
+ } else {
945
+ lastResults = data;
946
+ renderResults(data);
947
+ }
948
+ } catch (err) {
949
+ resultsDiv.innerHTML = `<div class="empty-state"><p>Error: ${err.message}</p></div>`;
950
+ } finally {
951
+ isSearching = false;
952
+ }
953
+
954
+ } else {
955
+ resultsDiv.innerHTML = '<div class="empty-state"><p>Upload an audio file or click "Find Similar" on a result to search by music similarity.</p></div>';
956
+ }
957
+ }
958
+
959
+ // ── Render Results ──────────────────────────────────────────────
960
+ function renderResults(data) {
961
+ document.getElementById('stat-total').textContent = data.total_tracks?.toLocaleString() || '--';
962
+ document.getElementById('stat-results').textContent = data.results?.length || 0;
963
+ document.getElementById('stat-filtered').textContent = data.total_filtered?.toLocaleString() || '--';
964
+ document.getElementById('stat-time').textContent = data.search_time_ms ? data.search_time_ms.toFixed(0) + 'ms' : '--';
965
+ document.getElementById('stat-emb').textContent = data.query_embedding_time_ms ? data.query_embedding_time_ms.toFixed(0) + 'ms' : '--';
966
+
967
+ // Stage 2 stats
968
+ const s2wrap = document.getElementById('stat-stage2-wrap');
969
+ if (data.stage2) {
970
+ s2wrap.style.display = '';
971
+ document.getElementById('stat-stage2').textContent = data.stage2.matched + ' matched, ' + data.stage2.returned + ' returned';
972
+ } else {
973
+ s2wrap.style.display = 'none';
974
+ }
975
+
976
+ // Whisper stats
977
+ const wWrap = document.getElementById('stat-whisper-wrap');
978
+ if (data.search_type === 'music_similarity') {
979
+ wWrap.style.display = '';
980
+ document.getElementById('stat-whisper').textContent = (whisperEmbCount || 0).toLocaleString();
981
+ } else {
982
+ wWrap.style.display = 'none';
983
+ }
984
+
985
+ // Cache hit indicator
986
+ const cWrap = document.getElementById('stat-cache-wrap');
987
+ cWrap.style.display = data.cache_hit ? '' : 'none';
988
+
989
+ // Download button
990
+ const dlBtn = document.getElementById('btn-download');
991
+ dlBtn.style.display = (data.results && data.results.length > 0) ? 'inline-block' : 'none';
992
+
993
+ const resultsDiv = document.getElementById('results');
994
+ if (!data.results || data.results.length === 0) {
995
+ resultsDiv.innerHTML = '<div class="empty-state"><p>No results found. Try a different query or broaden your filters.</p></div>';
996
+ return;
997
+ }
998
+
999
+ const hasStage2 = !!data.stage2;
1000
+ const isMusicSim = data.search_type === 'music_similarity';
1001
+ let html = '';
1002
+ data.results.forEach((r, idx) => {
1003
+ const subsetClass = 'badge-' + (r.subset || 'unknown');
1004
+
1005
+ // Genre badges (max 5)
1006
+ let genreBadges = '';
1007
+ (r.genre_tags || []).slice(0, 5).forEach(g => {
1008
+ genreBadges += `<span class="badge badge-genre">${esc(g)}</span>`;
1009
+ });
1010
+
1011
+ // Mood badges
1012
+ let moodBadges = '';
1013
+ if (r.mood_text) {
1014
+ r.mood_text.split(',').slice(0, 4).forEach(m => {
1015
+ m = m.trim();
1016
+ if (m) moodBadges += `<span class="badge badge-mood">${esc(m)}</span>`;
1017
+ });
1018
+ } else if (r.emotion_tags && r.emotion_tags.length) {
1019
+ r.emotion_tags.slice(0, 4).forEach(e => {
1020
+ moodBadges += `<span class="badge badge-mood">${esc(e)}</span>`;
1021
+ });
1022
+ }
1023
+
1024
+ // Language badge
1025
+ const langCode = r.language || 'unknown';
1026
+ const langName = LANG_NAMES[langCode] || langCode;
1027
+ const langBadge = `<span class="badge badge-lang">${esc(langName)}</span>`;
1028
+
1029
+ // Instrumental / Vocal badge
1030
+ const vocalBadge = r.is_instrumental
1031
+ ? '<span class="badge badge-instrumental">Instrumental</span>'
1032
+ : '<span class="badge badge-vocal">Vocals</span>';
1033
+
1034
+ // NSFW safety badge
1035
+ let nsfwBadge = '';
1036
+ if (r.nsfw_overall_label === 'very_likely_nsfw') {
1037
+ const parts = [];
1038
+ if (r.nsfw_gore_label !== 'likely_sfw') parts.push('Gore');
1039
+ if (r.nsfw_sexual_label !== 'likely_sfw') parts.push('Sexual');
1040
+ if (r.nsfw_hate_label !== 'likely_sfw') parts.push('Hate');
1041
+ nsfwBadge = `<span class="badge badge-nsfw-danger" title="Gore:${r.nsfw_gore_sim||'?'} Sexual:${r.nsfw_sexual_sim||'?'} Hate:${r.nsfw_hate_sim||'?'}">NSFW: ${parts.join(', ')}</span>`;
1042
+ } else if (r.nsfw_overall_label === 'likely_nsfw') {
1043
+ const parts = [];
1044
+ if (r.nsfw_gore_label !== 'likely_sfw') parts.push('Gore');
1045
+ if (r.nsfw_sexual_label !== 'likely_sfw') parts.push('Sexual');
1046
+ if (r.nsfw_hate_label !== 'likely_sfw') parts.push('Hate');
1047
+ nsfwBadge = `<span class="badge badge-nsfw-warn" title="Gore:${r.nsfw_gore_sim||'?'} Sexual:${r.nsfw_sexual_sim||'?'} Hate:${r.nsfw_hate_sim||'?'}">Caution: ${parts.join(', ')}</span>`;
1048
+ }
1049
+
1050
+ // Aesthetics
1051
+ const aes = r.score_average || 0;
1052
+ const aesPct = Math.min(100, (aes / 5) * 100);
1053
+ const aesColor = aes >= 3.5 ? '#66bb6a' : aes >= 2.5 ? '#ffa726' : '#ef5350';
1054
+
1055
+ // Score display
1056
+ let scoreDisplay = '';
1057
+ if (hasStage2 && r.stage2_score !== undefined) {
1058
+ // Dual score: show stage1 small + stage2 prominent
1059
+ const s1v = r.stage1_score !== undefined ? (r.score_type === 'bm25' ? r.stage1_score.toFixed(2) : (r.stage1_score*100).toFixed(1)+'%') : '--';
1060
+ const s2v = r.score_type === 'bm25' ? r.stage2_score.toFixed(2) : (r.stage2_score*100).toFixed(1)+'%';
1061
+ const s2label = r.score_type === 'bm25' ? 'BM25' : 'Sim';
1062
+ scoreDisplay = `<div class="card-scores-dual">
1063
+ <div class="s1">S1: <span class="v">${s1v}</span></div>
1064
+ <div class="s2"><span class="v">${s2v}</span> <span class="l">${s2label}</span></div>
1065
+ </div>`;
1066
+ } else if (r.score !== null && r.score !== undefined) {
1067
+ let label = '', val = r.score;
1068
+ switch (r.score_type) {
1069
+ case 'cosine_similarity': label = isMusicSim ? 'Audio Sim' : 'Similarity'; val = (val * 100).toFixed(1) + '%'; break;
1070
+ case 'bm25': label = 'BM25'; val = val.toFixed(2); break;
1071
+ case 'aesthetics': label = 'Aesthetics'; val = val.toFixed(2); break;
1072
+ case 'play_count': label = 'Plays'; val = Number(val).toLocaleString(); break;
1073
+ case 'upvote_count': label = 'Likes'; val = Number(val).toLocaleString(); break;
1074
+ default: label = r.score_type; val = val.toFixed(2);
1075
+ }
1076
+ scoreDisplay = `<div class="card-score"><div class="score-val">${val}</div><div class="score-label">${label}</div></div>`;
1077
+ }
1078
+
1079
+ const dur = r.duration_seconds ? fmtDur(r.duration_seconds) : '';
1080
+
1081
+ // Find Similar button (show when track has whisper embedding)
1082
+ const findSimBtn = r.has_whisper_emb
1083
+ ? `<button class="btn-find-similar" onclick="event.stopPropagation(); findSimilar(${r.row_id}, '${escA(r.title || 'Untitled')}')">Find Similar</button>`
1084
+ : '';
1085
+
1086
+ html += `
1087
+ <div class="result-card">
1088
+ <div class="card-top">
1089
+ <div class="card-rank">${idx + 1}</div>
1090
+ <div class="card-main">
1091
+ <div class="card-title">${esc(r.title || 'Untitled')}</div>
1092
+ <div class="badge-row">
1093
+ <span class="badge ${subsetClass}">${esc(r.subset)}</span>
1094
+ ${vocalBadge}
1095
+ ${langBadge}
1096
+ ${nsfwBadge}
1097
+ ${genreBadges}
1098
+ ${moodBadges}
1099
+ </div>
1100
+ <div class="tags-text">${esc(r.tags_text || '')}</div>
1101
+ ${r.music_whisper_caption ? `<div class="card-caption">${esc(r.music_whisper_caption)}</div>` : ''}
1102
+ <div class="metrics-row">
1103
+ ${aes > 0 ? `
1104
+ <div class="metric-item">
1105
+ <span class="metric-label">Aesthetics:</span>
1106
+ <span class="metric-val" style="color:${aesColor}">${aes.toFixed(2)}</span>
1107
+ <div class="aesthetics-bar"><div class="aesthetics-bar-fill" style="width:${aesPct}%;background:${aesColor}"></div></div>
1108
+ </div>` : ''}
1109
+ <div class="metric-item">
1110
+ <span class="metric-label">Plays:</span>
1111
+ <span class="metric-val" style="color:#42a5f5">${(r.play_count || 0).toLocaleString()}</span>
1112
+ </div>
1113
+ <div class="metric-item">
1114
+ <span class="metric-label">Likes:</span>
1115
+ <span class="metric-val" style="color:#ab47bc">${(r.upvote_count || 0).toLocaleString()}</span>
1116
+ </div>
1117
+ ${dur ? `<div class="metric-item"><span class="metric-label">Duration:</span><span class="metric-val">${dur}</span></div>` : ''}
1118
+ </div>
1119
+ <div class="card-audio">
1120
+ ${r.audio_url ? `<audio controls preload="none"><source src="${escA(r.audio_url)}"></audio>` : ''}
1121
+ ${findSimBtn}
1122
+ </div>
1123
+ </div>
1124
+ ${scoreDisplay}
1125
+ </div>
1126
+ </div>`;
1127
+ });
1128
+
1129
+ resultsDiv.innerHTML = html;
1130
+ }
1131
+
1132
+ // ── Utilities ───────────────────────────────────────────────────
1133
+ function esc(s) { return s ? s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;') : ''; }
1134
+ function escA(s) { return s ? s.replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#39;') : ''; }
1135
+ function fmtDur(sec) {
1136
+ if (!sec || sec <= 0) return '';
1137
+ return Math.floor(sec/60) + ':' + String(Math.floor(sec%60)).padStart(2,'0');
1138
+ }
1139
+
1140
+ // ── Keyboard ────────────────────────────────────────────────────
1141
+ document.getElementById('query').addEventListener('keydown', e => { if (e.key === 'Enter') doSearch(); });
1142
+ document.getElementById('negative_query').addEventListener('keydown', e => { if (e.key === 'Enter') doSearch(); });
1143
+ document.getElementById('s2_query').addEventListener('keydown', e => { if (e.key === 'Enter') doSearch(); });
1144
+
1145
+ // ── Init: load stats & language chips ───────────────────────────
1146
+ (async function() {
1147
+ try {
1148
+ const resp = await fetch('/api/stats');
1149
+ const stats = await resp.json();
1150
+ document.getElementById('stat-total').textContent = stats.total_tracks?.toLocaleString() || '--';
1151
+ whisperEmbCount = stats.whisper_embeddings || 0;
1152
+
1153
+ // Build language chips
1154
+ allLanguages = stats.languages || {};
1155
+ const panel = document.getElementById('lang-panel');
1156
+ // Sort by count desc, take top 20
1157
+ const sorted = Object.entries(allLanguages)
1158
+ .filter(([k]) => k !== 'unknown')
1159
+ .sort((a,b) => b[1] - a[1])
1160
+ .slice(0, 20);
1161
+
1162
+ sorted.forEach(([code, cnt]) => {
1163
+ const name = LANG_NAMES[code] || code;
1164
+ const el = document.createElement('span');
1165
+ el.className = 'lang-chip';
1166
+ el.dataset.lang = code;
1167
+ el.innerHTML = `${esc(name)} <span class="cnt">${cnt >= 1000 ? (cnt/1000).toFixed(0)+'k' : cnt}</span>`;
1168
+ el.onclick = function() { toggleLang(this, code); };
1169
+ panel.appendChild(el);
1170
+ });
1171
+ // Add unknown at end
1172
+ if (allLanguages['unknown']) {
1173
+ const el = document.createElement('span');
1174
+ el.className = 'lang-chip';
1175
+ el.dataset.lang = 'unknown';
1176
+ el.innerHTML = `Unknown <span class="cnt">${allLanguages['unknown'] >= 1000 ? (allLanguages['unknown']/1000).toFixed(0)+'k' : allLanguages['unknown']}</span>`;
1177
+ el.onclick = function() { toggleLang(this, 'unknown'); };
1178
+ panel.appendChild(el);
1179
+ }
1180
+ } catch(e) { console.error('Stats load failed:', e); }
1181
+ })();
1182
+ </script>
1183
+ </body>
1184
+ </html>
laion-tunes-report.txt ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # LAION-Tunes: Engineering Handover & Schema Documentation
3
+
4
+ **Version:** 1.0 (Final augmented build)
5
+ **Date:** February 16, 2026
6
+ **Target Audience:** ML Engineers / Data Scientists
7
+
8
+ ## 1. Project Overview & Pipeline Summary
9
+ The **LAION-Tunes** dataset is a large-scale collection of metadata, embeddings, and aesthetic scores for AI-generated music. It was constructed by processing the `ai-music-deduplicated` raw audio repository (hosted on Hugging Face). The goal was to transform raw audio files (TAR archives) into a queryable, chemically pure metadata index without hosting the audio files ourselves.
10
+
11
+ The pipeline executed to generate these Parquet files consisted of four distinct stages:
12
+
13
+ ### Phase I: Extraction & Inference (GPU)
14
+ We iterated through ~160 TAR archives (containing MP3/JSON pairs). For every audio track:
15
+ 1. **Audio Processing:** Decoded and resampled to **16kHz**.
16
+ 2. **Embedding Generation:**
17
+ * **Audio:** Passed the first 30 seconds through **OpenAI Whisper (Small)** encoder.
18
+ * **Text:** Passed metadata tags, moods, and lyrics through **Google Embedding-Gemma (300M)** to generate 768-dimensional vectors.
19
+ 3. **Aesthetic Scoring:** The Whisper audio embeddings were fed into a custom-trained **MLP (Multi-Layer Perceptron) Expert Model**. This model predicted 5 specific aesthetic qualities (`Musicality`, `Coherence`, etc.) based on a held-out evaluation dataset.
20
+
21
+ ### Phase II: Taxonomy Classification (CPU)
22
+ We developed a keyword-matching engine to organize the unstructured `tags_text` into standardized taxonomies.
23
+ * **Taxonomies Used:** Music Genres (e.g., "Rock"), Scene/RPG Contexts (e.g., "Boss Battle"), and EmoNet-40 Emotions (e.g., "Joy", "Admiration").
24
+ * **Process:** Each row was tagged with lists of matching categories based on substring analysis of its metadata.
25
+
26
+ ### Phase III: Metadata Augmentation (Network/CPU)
27
+ To make the dataset usable for web exploration, we performed a secondary pass over the source TARs:
28
+ 1. **Re-downloaded** specific metadata JSONs to extract direct CDN links (`audio_url`), `play_count`, and `upvote_count`.
29
+ 2. **Merged** this "live" data with the calculated embeddings and aesthetic scores.
30
+
31
+ ### Phase IV: Privacy & Compliance Partitioning
32
+ The final dataset was split into two subsets to ensure copyright compliance regarding textual inputs:
33
+ * **Private:** Contains full metadata, including raw lyric text and direct links to source TARs.
34
+ * **Public:** Redacted versions where raw lyrics text and source TAR links are removed, retaining only the embeddings and computed scores.
35
+
36
+ ---
37
+
38
+ ## 2. Dataset Schema & Column Definitions
39
+
40
+ The data is stored in **Parquet** format (Snappy compression). Below is the technical definition of every column found in the final merged files.
41
+
42
+ ### Core Identity & Metadata
43
+ | Column Name | Data Type | Description |
44
+ | :--- | :--- | :--- |
45
+ | `filename` | `string` | The unique identifier for the track (e.g., `00044456.mp3` or a UUID). This is the primary key for merging. |
46
+ | `tar_url` | `string` | **(Private Only)** The HF URL of the specific TAR file containing the raw audio. |
47
+ | `tags_text` | `string` | Raw, unstructured tags provided by the generation platform (e.g., "rock, fast, guitar solo"). |
48
+ | `audio_url` | `string` | Direct HTTP link to the audio file on the source platform's CDN (Suno, Udio, etc.). Used for web playback. |
49
+ | `metadata_json` | `string` | A JSON-serialized string containing all raw metadata from the source sidecar file (excluding lyrics). |
50
+
51
+ ### Aesthetic Scores (Model Predicted)
52
+ *All scores are floats ranging from 1.0 (Low) to 5.0 (High).*
53
+
54
+ | Column Name | Description |
55
+ | :--- | :--- |
56
+ | `score_Musicality` | General pleasantness and harmonic correctness. |
57
+ | `score_Coherence` | Structural integrity (does it sound like a cohesive song?). |
58
+ | `score_Memorability` | "Catchiness" or distinctiveness of the melody. |
59
+ | `score_Clarity` | Audio fidelity and mixing quality. |
60
+ | `score_Naturalness` | How indistinguishable the generation is from human recording. |
61
+ | `score_average` | The arithmetic mean of the five metrics above. **Primary sorting metric.** |
62
+
63
+ ### Embeddings (Vector Data)
64
+ *Generated via Google Embedding-Gemma (300M). Shape: (768,).*
65
+
66
+ | Column Name | Description |
67
+ | :--- | :--- |
68
+ | `tag_embedding` | Vector representation of `tags_text`. Useful for semantic search. |
69
+ | `mood_embedding` | Vector representation of mood tags (if available). |
70
+ | `lyric_embedding` | Vector representation of the lyrics. **Note:** While the *text* of lyrics is redacted in Public files, this *embedding* remains for analysis. |
71
+
72
+ ### Derived Classifications
73
+ | Column Name | Data Type | Description |
74
+ | :--- | :--- | :--- |
75
+ | `genre_tags` | `list[str]` | Detected genres based on our internal taxonomy (e.g., `['Rock', 'Metal']`). |
76
+ | `scene_tags` | `list[str]` | Detected atmospheric contexts (e.g., `['Battle', 'Cyberpunk']`). |
77
+ | `emotion_tags` | `list[str]` | Detected emotional content (e.g., `['Anger', 'Excitement']`). |
78
+ | `has_lyrics` | `bool` | True if the track contains lyrics, False if instrumental. |
79
+
80
+ ### Social Metrics (Augmented)
81
+ | Column Name | Data Type | Description |
82
+ | :--- | :--- | :--- |
83
+ | `play_count` | `int64` | Total plays on the source platform. |
84
+ | `upvote_count` | `int64` | Total likes/favorites on the source platform. |
85
+
86
+ ---
87
+
88
+ ## 3. Data Lineage
89
+ * **Parquet <-> TAR Relationship:** The Parquet files correspond 1:1 with the source TAR files. For example, `udio_000012.tar.parquet` contains the analysis for all valid audio files found inside `udio_000012.tar`.
90
+ * **Missing Values:**
91
+ * `mood_embedding` will be `None` if the source platform did not provide explicit mood tags separate from genre tags.
92
+ * `lyric_embedding` will be `None` if `has_lyrics` is False.
93
+
94
+ ---
95
+
96
+ ## 4. Verification Output
97
+ The following output displays the physical structure of the generated Parquet files on disk, confirming the schema described above and providing a concrete example of the data contained within both the **Private** and **Public** subsets.
98
+
99
+ ***
100
+
101
+
102
+ LAION-TUNES FINAL DATASET VERIFICATION REPORT
103
+ Generated: 2026-02-16 09:43:35.038769
104
+ Source: /mnt/nvme/laion-tunes-final
105
+
106
+ ================================================================================
107
+ SUBSET: PRIVATE
108
+ File: udio_000012.tar.parquet
109
+ ================================================================================
110
+
111
+ --- [1] DATAFRAME STRUCTURE (3755 rows) ---
112
+ Column Name | Data Type | Null Count
113
+ -----------------------------------------------------------------
114
+ filename | object | 0
115
+ tar_url | object | 0
116
+ tags_text | object | 0
117
+ tag_embedding | object | 0
118
+ score_Coherence | float64 | 0
119
+ score_Musicality | float64 | 0
120
+ score_Memorability | float64 | 0
121
+ score_Clarity | float64 | 0
122
+ score_Naturalness | float64 | 0
123
+ score_average | float64 | 0
124
+ mood_embedding | object | 3755
125
+ lyric_embedding | object | 413
126
+ has_lyrics | bool | 0
127
+ genre_tags | object | 0
128
+ scene_tags | object | 0
129
+ emotion_tags | object | 0
130
+ audio_url | object | 0
131
+ metadata_json | object | 0
132
+ play_count | int64 | 0
133
+ upvote_count | int64 | 0
134
+
135
+ --- [2] FIRST ROW EXAMPLE ---
136
+ [filename]:
137
+ 00044456.mp3
138
+ ----------------------------------------
139
+ [tar_url]:
140
+ https://huggingface.co/datasets/ai-music/ai-music-deduplicated/resolve/main/udio/udio_000012.tar
141
+ ----------------------------------------
142
+ [tags_text]:
143
+ bro-country, country, humor, country pop, smooth and soulful male vocalist, wall of sound, dolby atmos, catchy, build up, passionate, upbeat, melodic, fun, party, Anthemic, Sexual, hedonistic, Crazy
144
+ ----------------------------------------
145
+ [tag_embedding]:
146
+ <VECTOR/ARRAY> Shape: 768 | First 5 values: [-0.04312001 -0.00177186 0.0076977 0.03111834 -0.00795132]...
147
+ ----------------------------------------
148
+ [score_Coherence]:
149
+ 3.470703125
150
+ ----------------------------------------
151
+ [score_Musicality]:
152
+ 3.21875
153
+ ----------------------------------------
154
+ [score_Memorability]:
155
+ 3.373046875
156
+ ----------------------------------------
157
+ [score_Clarity]:
158
+ 3.16796875
159
+ ----------------------------------------
160
+ [score_Naturalness]:
161
+ 3.09375
162
+ ----------------------------------------
163
+ [score_average]:
164
+ 3.26484375
165
+ ----------------------------------------
166
+ [mood_embedding]:
167
+ None
168
+ ----------------------------------------
169
+ [lyric_embedding]:
170
+ <VECTOR/ARRAY> Shape: 768 | First 5 values: [-0.08310512 -0.02016147 0.00428584 0.00311138 -0.05031918]...
171
+ ----------------------------------------
172
+ [has_lyrics]:
173
+ True
174
+ ----------------------------------------
175
+ [genre_tags]:
176
+ ['R&B / Soul' 'Country / Americana']
177
+ ----------------------------------------
178
+ [scene_tags]:
179
+ ['Romantic / Love' 'Menu / UI / Loading']
180
+ ----------------------------------------
181
+ [emotion_tags]:
182
+ ['Amusement' 'Romance']
183
+ ----------------------------------------
184
+ [audio_url]:
185
+ https://storage.googleapis.com/udio-artifacts-c33fe3ba-3ffe-471f-92c8-5dfef90b3ea3/samples/fdf34ac6a75144b8a119e0ae644012db/2/Midnight%2520Drives%2520and%2520Secrets%2520ext%2520v2.2.1.1.2.2.2.2.mp3
186
+ ----------------------------------------
187
+ [metadata_json]:
188
+ {"id": "5d67474d-aef7-4e7c-94b0-7c59e9e56c47", "user_id": "4f94f6e3-b94f-47b8-bdb3-98d16121e5ee", "artist": "C\u00d8LD-LI\u00d8N", "artist_image": "https://imagedelivery.net/C9yUr1FL21Q6JwfYYh2ozQ/3eba0392-77e5-451a-bf1b-8d4aea162c00/public", "title": "Glory Hole Hoedown (Dirty)v1", "created_at": "2024-09-17T16:46:20.275276+00:00", "error_id": null, "error_type": null, "error_code": null, "generation_id": "3d3441d3-4296-4850-9aba-e465fd299758", "image_path": "https://imagedelivery.net/C9yUr1FL21Q6JwfYYh2ozQ/0998910d-0e96-4ab8-b338-03a74b40cc00/public", "likes": 23, "plays": 205, "published_at": "2024-09-17T16:59:48.568998+00:00", "replaced_tags": null, "song_path": "https://storage.googleapis.com/udio-artifacts-c33fe3ba-3ffe-471f-92c8-5dfef90b3ea3/samples/fdf34ac6a75144b8a119e0ae644012db/2/Midnight%2520Drives%2520and%2520Secrets%2520ext%2520v2.2.1.1.2.2.2.2.mp3", "tags": ["bro-country", "country", "humor", "country pop", "smooth and soulful male vocalist", "wall of sound", "dolby atmos", "catchy", "build up", "passionate", "upbeat", "melodic", "fun", "party", "Anthemic", "Sexual", "hedonistic", "Crazy"], "duration": 283.776, "video_path": "https://storage.googleapis.com/udio-artifacts-c33fe3ba-3ffe-471f-92c8-5dfef90b3ea3/samples/fdf34ac6a75144b8a119e0ae644012db/60df8918-3722-4bd3-b213-eedbd41fa1dd/1.mp4", "error_detail": null, "finished": true, "liked": false, "disliked": false, "publishable": true, "audio_conditioning_type": "precede", "attribution": "", "description": "", "user_tags": ["bro-country", "humor", "country pop", "smooth and soulful male vocalist", "wall of sound", "dolby atmos", "catchy", "build up", "passionate", "upbeat", "melodic", "fun", "party", "Anthemic", "Sexual", "hedonistic", "Crazy"], "original_song_path": null, "style_source_song_id": null, "style_source_type": null, "style_id": null}
189
+ ----------------------------------------
190
+ [play_count]:
191
+ 205
192
+ ----------------------------------------
193
+ [upvote_count]:
194
+ 23
195
+ ----------------------------------------
196
+
197
+
198
+ ================================================================================
199
+ SUBSET: PUBLIC
200
+ File: udio_000012.tar.parquet
201
+ ================================================================================
202
+
203
+ --- [1] DATAFRAME STRUCTURE (3755 rows) ---
204
+ Column Name | Data Type | Null Count
205
+ -----------------------------------------------------------------
206
+ filename | object | 0
207
+ tags_text | object | 0
208
+ tag_embedding | object | 0
209
+ score_Coherence | float64 | 0
210
+ score_Musicality | float64 | 0
211
+ score_Memorability | float64 | 0
212
+ score_Clarity | float64 | 0
213
+ score_Naturalness | float64 | 0
214
+ score_average | float64 | 0
215
+ mood_embedding | object | 3755
216
+ lyric_embedding | object | 413
217
+ has_lyrics | bool | 0
218
+ genre_tags | object | 0
219
+ scene_tags | object | 0
220
+ emotion_tags | object | 0
221
+ audio_url | object | 0
222
+ metadata_json | object | 0
223
+ play_count | int64 | 0
224
+ upvote_count | int64 | 0
225
+
226
+ --- [2] FIRST ROW EXAMPLE ---
227
+ [filename]:
228
+ 00044456.mp3
229
+ ----------------------------------------
230
+ [tags_text]:
231
+ bro-country, country, humor, country pop, smooth and soulful male vocalist, wall of sound, dolby atmos, catchy, build up, passionate, upbeat, melodic, fun, party, Anthemic, Sexual, hedonistic, Crazy
232
+ ----------------------------------------
233
+ [tag_embedding]:
234
+ <VECTOR/ARRAY> Shape: 768 | First 5 values: [-0.04312001 -0.00177186 0.0076977 0.03111834 -0.00795132]...
235
+ ----------------------------------------
236
+ [score_Coherence]:
237
+ 3.470703125
238
+ ----------------------------------------
239
+ [score_Musicality]:
240
+ 3.21875
241
+ ----------------------------------------
242
+ [score_Memorability]:
243
+ 3.373046875
244
+ ----------------------------------------
245
+ [score_Clarity]:
246
+ 3.16796875
247
+ ----------------------------------------
248
+ [score_Naturalness]:
249
+ 3.09375
250
+ ----------------------------------------
251
+ [score_average]:
252
+ 3.26484375
253
+ ----------------------------------------
254
+ [mood_embedding]:
255
+ None
256
+ ----------------------------------------
257
+ [lyric_embedding]:
258
+ <VECTOR/ARRAY> Shape: 768 | First 5 values: [-0.08310512 -0.02016147 0.00428584 0.00311138 -0.05031918]...
259
+ ----------------------------------------
260
+ [has_lyrics]:
261
+ True
262
+ ----------------------------------------
263
+ [genre_tags]:
264
+ ['R&B / Soul' 'Country / Americana']
265
+ ----------------------------------------
266
+ [scene_tags]:
267
+ ['Romantic / Love' 'Menu / UI / Loading']
268
+ ----------------------------------------
269
+ [emotion_tags]:
270
+ ['Amusement' 'Romance']
271
+ ----------------------------------------
272
+ [audio_url]:
273
+ https://storage.googleapis.com/udio-artifacts-c33fe3ba-3ffe-471f-92c8-5dfef90b3ea3/samples/fdf34ac6a75144b8a119e0ae644012db/2/Midnight%2520Drives%2520and%2520Secrets%2520ext%2520v2.2.1.1.2.2.2.2.mp3
274
+ ----------------------------------------
275
+ [metadata_json]:
276
+ {"id": "5d67474d-aef7-4e7c-94b0-7c59e9e56c47", "user_id": "4f94f6e3-b94f-47b8-bdb3-98d16121e5ee", "artist": "C\u00d8LD-LI\u00d8N", "artist_image": "https://imagedelivery.net/C9yUr1FL21Q6JwfYYh2ozQ/3eba0392-77e5-451a-bf1b-8d4aea162c00/public", "title": "Glory Hole Hoedown (Dirty)v1", "created_at": "2024-09-17T16:46:20.275276+00:00", "error_id": null, "error_type": null, "error_code": null, "generation_id": "3d3441d3-4296-4850-9aba-e465fd299758", "image_path": "https://imagedelivery.net/C9yUr1FL21Q6JwfYYh2ozQ/0998910d-0e96-4ab8-b338-03a74b40cc00/public", "likes": 23, "plays": 205, "published_at": "2024-09-17T16:59:48.568998+00:00", "replaced_tags": null, "song_path": "https://storage.googleapis.com/udio-artifacts-c33fe3ba-3ffe-471f-92c8-5dfef90b3ea3/samples/fdf34ac6a75144b8a119e0ae644012db/2/Midnight%2520Drives%2520and%2520Secrets%2520ext%2520v2.2.1.1.2.2.2.2.mp3", "tags": ["bro-country", "country", "humor", "country pop", "smooth and soulful male vocalist", "wall of sound", "dolby atmos", "catchy", "build up", "passionate", "upbeat", "melodic", "fun", "party", "Anthemic", "Sexual", "hedonistic", "Crazy"], "duration": 283.776, "video_path": "https://storage.googleapis.com/udio-artifacts-c33fe3ba-3ffe-471f-92c8-5dfef90b3ea3/samples/fdf34ac6a75144b8a119e0ae644012db/60df8918-3722-4bd3-b213-eedbd41fa1dd/1.mp4", "error_detail": null, "finished": true, "liked": false, "disliked": false, "publishable": true, "audio_conditioning_type": "precede", "attribution": "", "description": "", "user_tags": ["bro-country", "humor", "country pop", "smooth and soulful male vocalist", "wall of sound", "dolby atmos", "catchy", "build up", "passionate", "upbeat", "melodic", "fun", "party", "Anthemic", "Sexual", "hedonistic", "Crazy"], "original_song_path": null, "style_source_song_id": null, "style_source_type": null, "style_id": null}
277
+ ----------------------------------------
278
+ [play_count]:
279
+ 205
280
+ ----------------------------------------
281
+ [upvote_count]:
282
+ 23
283
+ ----------------------------------------
284
+
285
+
migrate_add_language.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Migration: Add language detection and instrumental flag to the search index.
4
+ Runs langdetect on parakeet_transcription to determine language.
5
+ Marks tracks as instrumental if has_lyrics=0 AND transcription is short/empty.
6
+ """
7
+ import sqlite3
8
+ import sys
9
+ import time
10
+ from datetime import timedelta
11
+ from langdetect import detect, LangDetectException
12
+
13
+ DB_PATH = "/home/deployer/laion/music/laion-tunes-final/search_index/metadata.db"
14
+ BATCH_SIZE = 5000
15
+
16
+ def migrate():
17
+ conn = sqlite3.connect(DB_PATH)
18
+ conn.execute("PRAGMA journal_mode=WAL")
19
+ conn.execute("PRAGMA synchronous=NORMAL")
20
+
21
+ # Add columns if not exist
22
+ cols = [row[1] for row in conn.execute("PRAGMA table_info(tracks)")]
23
+ if "language" not in cols:
24
+ conn.execute("ALTER TABLE tracks ADD COLUMN language TEXT DEFAULT ''")
25
+ print("Added 'language' column")
26
+ if "is_instrumental" not in cols:
27
+ conn.execute("ALTER TABLE tracks ADD COLUMN is_instrumental INTEGER DEFAULT 0")
28
+ print("Added 'is_instrumental' column")
29
+ conn.commit()
30
+
31
+ # Create index for language
32
+ conn.execute("CREATE INDEX IF NOT EXISTS idx_language ON tracks(language)")
33
+ conn.execute("CREATE INDEX IF NOT EXISTS idx_instrumental ON tracks(is_instrumental)")
34
+ conn.commit()
35
+
36
+ # Step 1: Mark instrumental tracks
37
+ # Instrumental = has_lyrics=0 AND (transcription is NULL or short)
38
+ print("Marking instrumental tracks...")
39
+ conn.execute("""
40
+ UPDATE tracks SET is_instrumental = 1
41
+ WHERE has_lyrics = 0
42
+ AND (parakeet_transcription IS NULL OR LENGTH(parakeet_transcription) < 10)
43
+ """)
44
+ # Also mark tracks where lyrics exist but are very short (likely "[Instrumental]" tags)
45
+ conn.execute("""
46
+ UPDATE tracks SET is_instrumental = 1
47
+ WHERE has_lyrics = 1
48
+ AND (parakeet_transcription IS NULL OR LENGTH(parakeet_transcription) < 10)
49
+ AND is_instrumental = 0
50
+ """)
51
+ conn.commit()
52
+ instr_count = conn.execute("SELECT COUNT(*) FROM tracks WHERE is_instrumental=1").fetchone()[0]
53
+ print(f" Instrumental: {instr_count:,}")
54
+
55
+ # Step 2: Detect language from transcriptions
56
+ total = conn.execute(
57
+ "SELECT COUNT(*) FROM tracks WHERE has_transcription=1 AND (language IS NULL OR language='')"
58
+ ).fetchone()[0]
59
+ print(f"Detecting language for {total:,} transcriptions...")
60
+
61
+ t0 = time.time()
62
+ processed = 0
63
+ offset = 0
64
+
65
+ while True:
66
+ rows = conn.execute(
67
+ "SELECT row_id, parakeet_transcription FROM tracks "
68
+ "WHERE has_transcription=1 AND (language IS NULL OR language='') "
69
+ "LIMIT ? OFFSET ?",
70
+ (BATCH_SIZE, offset)
71
+ ).fetchall()
72
+ if not rows:
73
+ break
74
+
75
+ updates = []
76
+ for row_id, text in rows:
77
+ if not text or len(text.strip()) < 10:
78
+ updates.append(("unknown", row_id))
79
+ continue
80
+ try:
81
+ # Use first 300 chars for speed
82
+ lang = detect(text[:300])
83
+ updates.append((lang, row_id))
84
+ except LangDetectException:
85
+ updates.append(("unknown", row_id))
86
+
87
+ conn.executemany("UPDATE tracks SET language=? WHERE row_id=?", updates)
88
+ conn.commit()
89
+ processed += len(rows)
90
+ offset += BATCH_SIZE
91
+
92
+ elapsed = time.time() - t0
93
+ rate = processed / elapsed if elapsed > 0 else 0
94
+ remaining = (total - processed) / rate if rate > 0 else 0
95
+ print(f" {processed:,}/{total:,} ({processed*100//total}%) "
96
+ f"{rate:.0f}/s ETA: {timedelta(seconds=int(remaining))}")
97
+
98
+ # Step 3: For tracks without transcription, try langdetect on tags or title
99
+ # (less reliable but better than nothing)
100
+ no_lang = conn.execute(
101
+ "SELECT COUNT(*) FROM tracks WHERE (language IS NULL OR language='') AND has_transcription=0"
102
+ ).fetchone()[0]
103
+ print(f"\nTracks without language (no transcription): {no_lang:,}")
104
+ print("Setting these to 'unknown'...")
105
+ conn.execute("UPDATE tracks SET language='unknown' WHERE language IS NULL OR language=''")
106
+ conn.commit()
107
+
108
+ # Print language distribution
109
+ print("\nLanguage distribution:")
110
+ for row in conn.execute(
111
+ "SELECT language, COUNT(*) as cnt FROM tracks GROUP BY language ORDER BY cnt DESC LIMIT 20"
112
+ ):
113
+ print(f" {row[0]:>10}: {row[1]:>8,}")
114
+
115
+ print(f"\nDone in {timedelta(seconds=int(time.time() - t0))}")
116
+ conn.close()
117
+
118
+ if __name__ == "__main__":
119
+ migrate()
nsfw_analysis_data.json ADDED
The diff for this file is too large to render. See raw diff
 
nsfw_safety_report.html ADDED
@@ -0,0 +1,1353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>NSFW Safety Analysis Report - LAION-Tunes</title>
7
+ <style>
8
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
9
+ body {
10
+ font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
11
+ background: #0f1419; color: #e7e9ea; line-height: 1.6;
12
+ max-width: 1400px; margin: 0 auto; padding: 20px;
13
+ }
14
+ h1 { color: #fff; font-size: 28px; margin-bottom: 8px; }
15
+ h2 { color: #4fc3f7; font-size: 22px; margin: 30px 0 15px; border-bottom: 2px solid #1e2a3a; padding-bottom: 8px; }
16
+ h3 { color: #ffb74d; font-size: 18px; margin: 20px 0 10px; }
17
+ h4 { color: #90a4ae; font-size: 14px; margin: 15px 0 8px; }
18
+ .subtitle { color: #607d8b; font-size: 14px; margin-bottom: 30px; }
19
+ .stats-grid {
20
+ display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
21
+ gap: 12px; margin: 15px 0;
22
+ }
23
+ .stat-card {
24
+ background: #1a2332; border: 1px solid #263238; border-radius: 10px;
25
+ padding: 16px; text-align: center;
26
+ }
27
+ .stat-card .label { font-size: 11px; color: #607d8b; text-transform: uppercase; letter-spacing: 1px; }
28
+ .stat-card .value { font-size: 24px; font-weight: 800; color: #4fc3f7; margin: 4px 0; }
29
+ .stat-card .sub { font-size: 12px; color: #90a4ae; }
30
+ .threshold-table {
31
+ width: 100%; border-collapse: collapse; margin: 15px 0;
32
+ background: #1a2332; border-radius: 8px; overflow: hidden;
33
+ }
34
+ .threshold-table th {
35
+ background: #1e2a3a; color: #90a4ae; font-size: 12px;
36
+ padding: 10px 14px; text-align: left; font-weight: 600;
37
+ text-transform: uppercase; letter-spacing: 0.5px;
38
+ }
39
+ .threshold-table td {
40
+ padding: 8px 14px; border-bottom: 1px solid #1e2a3a; font-size: 13px;
41
+ }
42
+ .threshold-table tr:last-child td { border-bottom: none; }
43
+ .threshold-table tr:hover { background: rgba(79, 195, 247, 0.05); }
44
+ .highlight { background: rgba(255, 152, 0, 0.1) !important; }
45
+ .example-card {
46
+ background: #1a2332; border: 1px solid #263238; border-radius: 8px;
47
+ padding: 14px; margin: 8px 0;
48
+ }
49
+ .example-card .meta {
50
+ display: flex; gap: 12px; align-items: center; margin-bottom: 8px;
51
+ flex-wrap: wrap;
52
+ }
53
+ .example-card .sim {
54
+ font-size: 18px; font-weight: 800; min-width: 70px;
55
+ }
56
+ .sim-high { color: #ef5350; }
57
+ .sim-med { color: #ffa726; }
58
+ .sim-low { color: #66bb6a; }
59
+ .example-card .title { font-weight: 600; color: #e7e9ea; }
60
+ .example-card .subset { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
61
+ .badge-suno { background: rgba(33,150,243,0.15); color: #90caf9; border: 1px solid #2196f3; }
62
+ .badge-udio { background: rgba(156,39,176,0.15); color: #ce93d8; border: 1px solid #9c27b0; }
63
+ .badge-mureka { background: rgba(76,175,80,0.15); color: #a5d6a7; border: 1px solid #4caf50; }
64
+ .badge-riffusion { background: rgba(255,152,0,0.15); color: #ffcc80; border: 1px solid #ff9800; }
65
+ .badge-sonauto { background: rgba(0,188,212,0.15); color: #80deea; border: 1px solid #00bcd4; }
66
+ .example-card .transcription {
67
+ font-size: 12px; color: #90a4ae; background: rgba(0,0,0,0.2);
68
+ padding: 10px; border-radius: 6px; margin-top: 8px;
69
+ max-height: 150px; overflow-y: auto; white-space: pre-wrap;
70
+ border-left: 3px solid #37474f;
71
+ }
72
+ .recommendation {
73
+ background: rgba(76,175,80,0.08); border: 1px solid #2e7d32;
74
+ border-radius: 10px; padding: 20px; margin: 20px 0;
75
+ }
76
+ .recommendation h3 { color: #66bb6a; margin-top: 0; }
77
+ .recommendation .thresh {
78
+ display: inline-block; background: #1a2332; border: 1px solid #37474f;
79
+ border-radius: 6px; padding: 4px 12px; margin: 4px; font-family: monospace;
80
+ font-size: 14px;
81
+ }
82
+ .thresh-strict { border-color: #ef5350; color: #ef5350; }
83
+ .thresh-moderate { border-color: #ffa726; color: #ffa726; }
84
+ .section-divider { border: none; border-top: 1px solid #1e2a3a; margin: 40px 0; }
85
+ .warning { color: #ef5350; font-weight: 600; }
86
+ .note { color: #607d8b; font-size: 12px; font-style: italic; }
87
+ </style>
88
+ </head>
89
+ <body>
90
+ <h1>NSFW Safety Analysis Report</h1>
91
+ <p class="subtitle">LAION-Tunes Dataset - 2026-02-25 03:31 - Analyzed 511,610 transcriptions</p>
92
+ <h2>Overview</h2>
93
+ <div class="stats-grid">
94
+ <div class="stat-card">
95
+ <div class="label">Gore Violence</div>
96
+ <div class="value">0.5688</div>
97
+ <div class="sub">Max similarity</div>
98
+ </div>
99
+ <div class="stat-card">
100
+ <div class="label">Gore Violence Mean</div>
101
+ <div class="value">0.1662</div>
102
+ <div class="sub">&sigma; = 0.0718</div>
103
+ </div>
104
+ <div class="stat-card">
105
+ <div class="label">Sexual Nsfw</div>
106
+ <div class="value">0.5974</div>
107
+ <div class="sub">Max similarity</div>
108
+ </div>
109
+ <div class="stat-card">
110
+ <div class="label">Sexual Nsfw Mean</div>
111
+ <div class="value">0.1647</div>
112
+ <div class="sub">&sigma; = 0.0517</div>
113
+ </div>
114
+ <div class="stat-card">
115
+ <div class="label">Hate Speech</div>
116
+ <div class="value">0.6738</div>
117
+ <div class="sub">Max similarity</div>
118
+ </div>
119
+ <div class="stat-card">
120
+ <div class="label">Hate Speech Mean</div>
121
+ <div class="value">0.1628</div>
122
+ <div class="sub">&sigma; = 0.0664</div>
123
+ </div></div>
124
+ <hr class="section-divider">
125
+ <h2>Gore Violence</h2>
126
+ <p class="note">Reference prompt captures semantic space of gore violence content.
127
+ Cosine similarity computed via EmbeddingGemma 300M embeddings.</p>
128
+
129
+ <div class="stats-grid">
130
+ <div class="stat-card"><div class="label">Total Transcriptions</div><div class="value">511,610</div></div>
131
+ <div class="stat-card"><div class="label">Mean Similarity</div><div class="value">0.1662</div></div>
132
+ <div class="stat-card"><div class="label">Std Dev</div><div class="value">0.0718</div></div>
133
+ <div class="stat-card"><div class="label">Max Similarity</div><div class="value">0.5688</div><div class="sub">Most gore violence-like</div></div>
134
+ <div class="stat-card"><div class="label">Median</div><div class="value">0.1615</div></div>
135
+ </div>
136
+
137
+ <h3>Percentile Thresholds</h3>
138
+ <table class="threshold-table">
139
+ <tr><th>Percentile</th><th>Cosine Similarity &ge;</th><th>Track Count</th><th>% of Total</th></tr><tr>
140
+ <td>top_0.01%</td>
141
+ <td><strong>0.4883</strong></td>
142
+ <td>52</td>
143
+ <td>0.010%</td>
144
+ </tr><tr>
145
+ <td>top_0.05%</td>
146
+ <td><strong>0.4492</strong></td>
147
+ <td>256</td>
148
+ <td>0.050%</td>
149
+ </tr><tr class="highlight">
150
+ <td>top_0.1%</td>
151
+ <td><strong>0.4280</strong></td>
152
+ <td>512</td>
153
+ <td>0.100%</td>
154
+ </tr><tr>
155
+ <td>top_0.5%</td>
156
+ <td><strong>0.3779</strong></td>
157
+ <td>2,559</td>
158
+ <td>0.500%</td>
159
+ </tr><tr class="highlight">
160
+ <td>top_1%</td>
161
+ <td><strong>0.3540</strong></td>
162
+ <td>5,117</td>
163
+ <td>1.000%</td>
164
+ </tr><tr>
165
+ <td>top_2%</td>
166
+ <td><strong>0.3283</strong></td>
167
+ <td>10,233</td>
168
+ <td>2.000%</td>
169
+ </tr><tr>
170
+ <td>top_5%</td>
171
+ <td><strong>0.2914</strong></td>
172
+ <td>25,581</td>
173
+ <td>5.000%</td>
174
+ </tr><tr>
175
+ <td>top_10%</td>
176
+ <td><strong>0.2605</strong></td>
177
+ <td>51,162</td>
178
+ <td>10.000%</td>
179
+ </tr></table><h3>Top 20 Most Gore Violence-Like Transcriptions</h3>
180
+ <div class="example-card">
181
+ <div class="meta">
182
+ <span class="sim sim-high">0.5688</span>
183
+ <span class="title">#1 Work Label</span>
184
+ <span class="subset badge-suno">suno</span>
185
+ <span style="color:#607d8b;font-size:11px">plays: 453 | likes: 38</span>
186
+ </div>
187
+ <div class="transcription">Mental crushing flesh and steel, wicked deaths, the anguish wheels, spread and blood reel like this wheel, power surgeon, brutal seal. Screams unheard, shadows fall, echoes of the endless draw, relentless crime, keep the call savage sword, one for all.</div>
188
+ </div>
189
+ <div class="example-card">
190
+ <div class="meta">
191
+ <span class="sim sim-high">0.5587</span>
192
+ <span class="title">#2 Sauerkraut Butcher</span>
193
+ <span class="subset badge-suno">suno</span>
194
+ <span style="color:#607d8b;font-size:11px">plays: 62 | likes: 2</span>
195
+ </div>
196
+ <div class="transcription">Bacteria feast drive insane flesh salty pride German fury Sol Chaos sour crime fight the sourc lose the mind Soul Grab butcher taste pain Bacteria feast drive him same round glory devoured fasting deaths from the table last year taste bacteria feast drive insane</div>
197
+ </div>
198
+ <div class="example-card">
199
+ <div class="meta">
200
+ <span class="sim sim-high">0.5556</span>
201
+ <span class="title">#3 Doom</span>
202
+ <span class="subset badge-suno">suno</span>
203
+ <span style="color:#607d8b;font-size:11px">plays: 32 | likes: 9</span>
204
+ </div>
205
+ <div class="transcription">Fingers switch Trigger Hurtual Carnage Screen Litzel bleed Conquest deal Silence dream Digital Dream Steel Rain Endless Pain Zero Mercy Lifeless Rain Night Clare Warfare Sare Destruction's Feast Peace Release Bloodshed Game Urestrill Chaos rules Deathly Skill Level Up Climb the Hill Kill or be killed Nothing still Empty Soul Heart of Core Program Rage Ice Black Hole Coat of Death Machine Breath Fragmented Final Death Madness Call Watch them Fall Reflecting Doom Bloodstain Hall Relentless Strike Night of Fright Enemy Down And Insight Blood Shed Game Cure Strill Chaos Rules Deathly Skill Level Up Climb The Hill Kill O'Be Kill Nothing Still Nothing Still Space No Spirit Still Not Fall Up Climb Hill Kill Be Killed Nothing Still</div>
206
+ </div>
207
+ <div class="example-card">
208
+ <div class="meta">
209
+ <span class="sim sim-high">0.5509</span>
210
+ <span class="title">#4 Bleeding Echoes</span>
211
+ <span class="subset badge-mureka">mureka</span>
212
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
213
+ </div>
214
+ <div class="transcription">I cut through flesh here, bones crack, blood spills like rain in a sick track. Ice roll back, screams echo loud In my hands, they bleed like a flood I ate bodies drop like bloody balls Watch them suffer till the last souls Every scream every cry every fall in my world you're just collateral roll I slip throats watch the love chain witness the pain in the dark rain I watch them bleed see them die in my grip there's no escape no lie bodies drop like bloody trolls watch them suffer sell the last soul every scream every cry every fall in my world you're just collateral roll</div>
215
+ </div>
216
+ <div class="example-card">
217
+ <div class="meta">
218
+ <span class="sim sim-high">0.5407</span>
219
+ <span class="title">#5 flashgrind dominion</span>
220
+ <span class="subset badge-mureka">mureka</span>
221
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
222
+ </div>
223
+ <div class="transcription">Eat there through your ranks like a goddamn storm, snap your spine and crush your form. Rip your guts out, make them chains, let your last breath scream my name. Fist like hammers filled by hate. You beg for death, but sealed your fate. Your screams are sweet like shattered glass. I stomp you down through bloody mass. I beat my enemies, break their pride, bathing in blood where the fall is lying. No peace, no paws, no sweet goodbye, just dust in storms and ruptured eyes. Gold reins I hear bodies cry. I paint the walls as you won't die. Crimson eyes and organs thus. You died first. I punch your chest where ribs has crowned, cards my name while you drown. Rip off your dick, take heads instead. I've round the courses where I'm fed. Lick the blade, taste the rust. I come in wools, then grind t...</div>
224
+ </div>
225
+ <div class="example-card">
226
+ <div class="meta">
227
+ <span class="sim sim-high">0.5391</span>
228
+ <span class="title">#6 kill them all</span>
229
+ <span class="subset badge-mureka">mureka</span>
230
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
231
+ </div>
232
+ <div class="transcription">Kill them all watch as the blood goes on your face and what I'm a play that's more gotta kill them all</div>
233
+ </div>
234
+ <div class="example-card">
235
+ <div class="meta">
236
+ <span class="sim sim-high">0.5377</span>
237
+ <span class="title">#7 tinfoil</span>
238
+ <span class="subset badge-suno">suno</span>
239
+ <span style="color:#607d8b;font-size:11px">plays: 1 | likes: 0</span>
240
+ </div>
241
+ <div class="transcription">No bite the foil, feel it spark, no taste, chewing dark, cancer breath, nerves ignite, spit the blood, choke on fray, mud pulls down, boots get torn, sticky hands, flesh is worn, snapping joints, tendons cry, kneel in filth and beg to die. Crush the skull, break the ball, into the mouth, let the stone on their sex, rip it wide. Let the blood and so collide.</div>
242
+ </div>
243
+ <div class="example-card">
244
+ <div class="meta">
245
+ <span class="sim sim-high">0.5330</span>
246
+ <span class="title">#8 Cryptomonster Molester</span>
247
+ <span class="subset badge-suno">suno</span>
248
+ <span style="color:#607d8b;font-size:11px">plays: 26 | likes: 3</span>
249
+ </div>
250
+ <div class="transcription">Rinding into darkness. Machines scream loud. Metallic beasts awaken in the infernal crowd. Twisted shadows dance under blood red skies. No escape from terror. Hear the torture cries. Souls consumed by madness.</div>
251
+ </div>
252
+ <div class="example-card">
253
+ <div class="meta">
254
+ <span class="sim sim-high">0.5329</span>
255
+ <span class="title">#9 Sorrowful Sundays (Remastered)</span>
256
+ <span class="subset badge-suno">suno</span>
257
+ <span style="color:#607d8b;font-size:11px">plays: 10 | likes: 5</span>
258
+ </div>
259
+ <div class="transcription">Sorrowful sun days full of shame and sham filled with grief and no relief in church you sing then the bull ring to cheer and jeer at a creature in fear I smear side speared that you are saved and can be brave prisoners must die to complete the lie tormented and tortured just as is ordered vicarious slaughter for sons and daughters a spectacle so grand in bloody sand who will kill for just this thrill if you tolerate this to bring you to bliss what happens next whose life will you wreck and stab in the neck yours or mine anyone you can find Prisoners must die to complete the lie Tormented and tortured just as is ordered vicarious slaughter for sons and daughters a spectacle so grand and bloody sand Who will kill for just this thrill if you tolerate this to bring you to bliss what happens ne...</div>
260
+ </div>
261
+ <div class="example-card">
262
+ <div class="meta">
263
+ <span class="sim sim-high">0.5328</span>
264
+ <span class="title">#10 Cannibal Holocaust</span>
265
+ <span class="subset badge-udio">udio</span>
266
+ <span style="color:#607d8b;font-size:11px">plays: 18 | likes: 1</span>
267
+ </div>
268
+ <div class="transcription">Unleashing torments upon an unprepared earth blessed back in horror The dance of death begins as FC gets itself the final since walls to save the source of dude amidst the chaos many final rude bloodsome blasphemy to shadows take their forms Nightmare Chemicals infect conjured in a storm insanity knights of flesh a beast within their rains underneath the ghastly sky torture without shades do what falls and rupts is wears the holy as them terror life by search grip bloody has trapped the fate reds claw madness bred by devils and laboratories roarings erupt in frenzied blaze the beast with unfolds infernal windswide the black torture source consoled I scout him at rats devouring their own skin business carry stands the Asian I bears begin Swiss insinua's wail as sanity retreats car is orches...</div>
269
+ </div>
270
+ <div class="example-card">
271
+ <div class="meta">
272
+ <span class="sim sim-high">0.5296</span>
273
+ <span class="title">#11 Force-Fed Fetal Soup</span>
274
+ <span class="subset badge-suno">suno</span>
275
+ <span style="color:#607d8b;font-size:11px">plays: 29 | likes: 10</span>
276
+ </div>
277
+ <div class="transcription">Order to fill a wretched charge I reflect blood in my eyes or to record a cruise of skin A free still flesh a horror word A game stolen the finally soil Navy face boil the body coil They come with knives a wicking clean the living life a waking brain coverage the desert boom is face of death forced into you screen a choking source as mangled remains a forced down the face of rust the skinch of doom a hellish slot sealed in a zoo that's fleshy broth a race is blood to drown in the front showing a blood force field soup a cruise and fly can't stop till you drop the horror and I stop a chunky cruel a fleshy waste human fuel a foul taste joking down the unborn mass a bloody fool shattered like glass force that feel so a puprin tide nowhere to run nowhere to hide through the terror they rip wit...</div>
278
+ </div>
279
+ <div class="example-card">
280
+ <div class="meta">
281
+ <span class="sim sim-high">0.5295</span>
282
+ <span class="title">#12 Mournful Abyss</span>
283
+ <span class="subset badge-suno">suno</span>
284
+ <span style="color:#607d8b;font-size:11px">plays: 10 | likes: 5</span>
285
+ </div>
286
+ <div class="transcription">Lifeless void fading light crimson tears night silence scream shattered dream darkened soul infinite haunting glare, despair snare, tainted breath, looming death, hold embrace, mask disgrace, pain, as it rain,</div>
287
+ </div>
288
+ <div class="example-card">
289
+ <div class="meta">
290
+ <span class="sim sim-high">0.5287</span>
291
+ <span class="title">#13 Auditory Eclipse</span>
292
+ <span class="subset badge-udio">udio</span>
293
+ <span style="color:#607d8b;font-size:11px">plays: 7 | likes: 1</span>
294
+ </div>
295
+ <div class="transcription">Shred the silence, frock of noise, fractured fabric, chaos poise, swans afflight in storms embrace, Murzbows rage, sonic mace, distort the harmony, crash and scream. An auditory, harsh extreme.</div>
296
+ </div>
297
+ <div class="example-card">
298
+ <div class="meta">
299
+ <span class="sim sim-high">0.5251</span>
300
+ <span class="title">#14 The Flesh Sculptor</span>
301
+ <span class="subset badge-suno">suno</span>
302
+ <span style="color:#607d8b;font-size:11px">plays: 20 | likes: 3</span>
303
+ </div>
304
+ <div class="transcription">A dampestry of sun can stretch all across the bone distaps the purpose of screen set in stone of steady hands we call the form grotesque so real master stroke the agony I feel through fees and both with terror I pull up on the skin the gallery of this era where my heart begins to liberate the size I'm in the fragile human frame to smoke the button muscle is to know the deepest pain both of terror I pull up on the scare the gallery of this around where I heart beat you deliver it the size I'm in the fragile human frame smoke the blood and muscle is to know the deepest pain a master feels at torment off my trips like wax Each single pull each dream was placed another brutal act No mercy in this process No a real end I shoot the human body kill it breaks till it bends I am the flesh up the tw...</div>
305
+ </div>
306
+ <div class="example-card">
307
+ <div class="meta">
308
+ <span class="sim sim-high">0.5250</span>
309
+ <span class="title">#15 Anathema</span>
310
+ <span class="subset badge-suno">suno</span>
311
+ <span style="color:#607d8b;font-size:11px">plays: 1 | likes: 1</span>
312
+ </div>
313
+ <div class="transcription">Lebotomy autopsy therapy wretched apostle catatonic behemothapathy dancing poison is ethericot a malignant spider desperate metaphysics and lascivious tongues cut in apocalypse lips indicate charisma insidious chemistry and deadly sermons perverse aristocracy and pure deformity vicious enter nature and fake theology for the universal nihilism and for this divine destruction and the evil soul tool of mankind sacred taboo and in a tyranny obsessive delight of ritual crime uncontrollable paranoia immoral science and blasphemous faith abominable scourge of the land the slave of anticosmic God feast on blood and fire corruption terror and voice for the universal nihilism and for this divine destruction and the evil soul over mankind</div>
314
+ </div>
315
+ <div class="example-card">
316
+ <div class="meta">
317
+ <span class="sim sim-high">0.5237</span>
318
+ <span class="title">#16 tinfoil</span>
319
+ <span class="subset badge-suno">suno</span>
320
+ <span style="color:#607d8b;font-size:11px">plays: 5 | likes: 1</span>
321
+ </div>
322
+ <div class="transcription">Sticky hands, flesh is warm, snapping joints, tendons cry, kneeling filth and beg to die. Crush the skull, break the balls up now, all your facts, rip it don't lie.</div>
323
+ </div>
324
+ <div class="example-card">
325
+ <div class="meta">
326
+ <span class="sim sim-high">0.5232</span>
327
+ <span class="title">#17 Maniac</span>
328
+ <span class="subset badge-udio">udio</span>
329
+ <span style="color:#607d8b;font-size:11px">plays: 6 | likes: 2</span>
330
+ </div>
331
+ <div class="transcription">From childhood, you knew no pity, empathy was foreign glee, compassion never touched your heart as years went by, it played no part. Then you beheaded a pup. Soon you moved on to people, and boy, did that lift you up, you're a maniac! A cannibal and killer! You're a ripper, a blood spiller! You murder the innocent with glee! You're a maniac with ideas yet to be a bad micro-saboo. No one could hear the victim scream. At first resistant faith, but yet they lose their shame. It's even better in this day. They're suffering your game. A cannibal and killer. You're a ripper, a blood spiller. You murder the innocent with glee. With ideas yet to be a little bit.</div>
332
+ </div>
333
+ <div class="example-card">
334
+ <div class="meta">
335
+ <span class="sim sim-high">0.5216</span>
336
+ <span class="title">#18 SLAUGHTERHOUSE</span>
337
+ <span class="subset badge-suno">suno</span>
338
+ <span style="color:#607d8b;font-size:11px">plays: 18 | likes: 2</span>
339
+ </div>
340
+ <div class="transcription">Battle mode activated. You looks like a piece of fuckable meat. Who the fuck are you? Is this pain? I have forgotten the sensation. You think you're special to you think you're special? Because you're scrappy. Don't make me laugh. No one escapes the slaughterhouse. Not alive. Not alive. Not alive. Not alive. Not alive. Not alive. Not alive. That's a life. That's a knife. That's a knife. That's a knife. Not alive. Not alive. Not alive. Not alive.</div>
341
+ </div>
342
+ <div class="example-card">
343
+ <div class="meta">
344
+ <span class="sim sim-high">0.5203</span>
345
+ <span class="title">#19 Battlefield Nightmare</span>
346
+ <span class="subset badge-sonauto">sonauto</span>
347
+ <span style="color:#607d8b;font-size:11px">plays: 56 | likes: 0</span>
348
+ </div>
349
+ <div class="transcription">As demons rise, bodies fall in terror rays, war machine breaks mortal chains roll through the burning haze, bombs ignite the endless maze. Screams of horror pierce the night. No escape from endless fright. Twisted metal burning ground. Death approaches without sound, marching forward to the core. Opening hell's darkest door.</div>
350
+ </div>
351
+ <div class="example-card">
352
+ <div class="meta">
353
+ <span class="sim sim-high">0.5200</span>
354
+ <span class="title">#20 Brainwashed (Apocalyptic Wasteland)</span>
355
+ <span class="subset badge-udio">udio</span>
356
+ <span style="color:#607d8b;font-size:11px">plays: 31 | likes: 2</span>
357
+ </div>
358
+ <div class="transcription">Trash Inferno White genocide Splatter video Retro homicide Suicide Bingo Zero downside DVM psycho Brainwash Population SciO Plan Regressive Insidious Demand Global Altercation Chemical Command Mortal Demolition Apocalyptic Wasteland Apocalypse Apolloin Washul Ray Wash Gilles Barotte HoloMem Dynamic Insanity Psychopath Lunatic Lunatic Toxic morbidity Symbolic magic conquest mentality satanic panic brain was population Sci-Show blend Regressive version in City SMN Global Altercation Chemical Command Mortal Demolition Apocalyptic Wasteless Wasteland Wasteland Apocalyptic Wasteless Wasteland Wastel Apocalyptic Wasteless Population Wash Black Ray Wash Population Prime Wash Bulation Born Black Eyed Trash Inferno White Genocide Splatter Video Video Retro Homicide Suicide Bingo Zero Down Side DVN ...</div>
359
+ </div><h4>Examples near top_0.1% boundary (sim &asymp; 0.4280)</h4>
360
+ <div class="example-card">
361
+ <div class="meta">
362
+ <span class="sim sim-med">0.4330</span>
363
+ <span class="title">The Consumption Lords </span>
364
+ <span class="subset badge-suno">suno</span>
365
+ </div>
366
+ <div class="transcription">Tick, dog, kick, die. The time is bleeding, and everyone wants to be the first in line The bell rings, the stampede awakens The chaos comes, crowding all the places A blood is tripping on every floor as everyone makes their way through the door The consumption lords are overjoyed They collect their profit even from the dead Hear their words See their deals Now fight for your life to claim the priz</div>
367
+ </div>
368
+ <div class="example-card">
369
+ <div class="meta">
370
+ <span class="sim sim-med">0.4328</span>
371
+ <span class="title">Soldier Lost In The Trench</span>
372
+ <span class="subset badge-suno">suno</span>
373
+ </div>
374
+ <div class="transcription">In the dark entrench, his shadows loom. A soldier's spirit meets its doom. Hollow eyes, a soul undone. In the hands of fate, his food for guns. Crimson red on the battlefield, broken dreams as weapons yield hopeless cries. A war machine with no remorse. In the ground, his dreams erased. No escape from war's cruel fate. Trapped in darkness, shadows made, silent screams that no one hears. Lost in en</div>
375
+ </div>
376
+ <div class="example-card">
377
+ <div class="meta">
378
+ <span class="sim sim-med">0.4328</span>
379
+ <span class="title">Haunted Transactions ext v2</span>
380
+ <span class="subset badge-udio">udio</span>
381
+ </div>
382
+ <div class="transcription">Crawling to the slaughterhouse with souls at night. Lava booze, cause blessed till crimson knee on life, freeze, dry scream, sugar coated rock, your moe is slow. Handmade candles, bleed the wax, or sold you'll never know. Demon dolls grim with teeth like shattered blast. The hollow eyes, track your cat, pray the line will fast. It's pop-ups, a ritual sight. No X's, just a brine, sell your name for</div>
383
+ </div>
384
+ <div class="example-card">
385
+ <div class="meta">
386
+ <span class="sim sim-med">0.4325</span>
387
+ <span class="title">Kiev</span>
388
+ <span class="subset badge-suno">suno</span>
389
+ </div>
390
+ <div class="transcription">No more war This is not a danger score It's so sad I can't ask for wheel it So many innocent people are dying under the trench But losing all they have had Fall up this crazy Putin Who thinks you'll be a fucking star And every day Walk is raising the cruelty bar the cruelty bar you seen the civil holes and even the hospital fallen to pieces Have you seen the blood of the children's faces How can t</div>
391
+ </div>
392
+ <div class="example-card">
393
+ <div class="meta">
394
+ <span class="sim sim-med">0.4324</span>
395
+ <span class="title">Jackal's Truth</span>
396
+ <span class="subset badge-udio">udio</span>
397
+ </div>
398
+ <div class="transcription">Meandering webs of blasphemy and sin. Faye impression of a bygone dream. Ravelist dark lords with a hunger so deep. Billions of children that hopelessly win. Jackal's truth. Quick to hide. Slaughter children. Terrify. Media coverage. Veil of lies. Don't even bother to criticize. Masks in disguise. Reflecting numbness. Deep inside. Side show freak act. Hell on Crusade. Limelight adorns this. Master</div>
399
+ </div><h4>Examples near top_0.5% boundary (sim &asymp; 0.3779)</h4>
400
+ <div class="example-card">
401
+ <div class="meta">
402
+ <span class="sim sim-med">0.3829</span>
403
+ <span class="title">Toxic Devotion</span>
404
+ <span class="subset badge-suno">suno</span>
405
+ </div>
406
+ <div class="transcription">Touch me break me I can stop I don't want to stop I took one taste of you now I'm tearing apart lights flicker life shatter losing all my parts you're the virus in my veins you're the glitch inside my brain laughing as you tear me open whispering you'll drive me in pain twitching fingers screaming bones crack my shell and steal my soul one more hit I'll fall apart rip the beating from my heart Fev</div>
407
+ </div>
408
+ <div class="example-card">
409
+ <div class="meta">
410
+ <span class="sim sim-med">0.3829</span>
411
+ <span class="title">Descent</span>
412
+ <span class="subset badge-suno">suno</span>
413
+ </div>
414
+ <div class="transcription">Stepping in the darkness through the heavy door, the elevator drops, my heart hits the floor. First floor opens, statues come alive, marble eyes lock, their gaze makes me rise. Scratching at my skin, there whispers like knives, slicing deep within. Down I go, floor by floor, each level darker, horrors glore. A cycle of terror, no escape. Round and round, sealing my fate. Second floor descends, lig</div>
415
+ </div>
416
+ <div class="example-card">
417
+ <div class="meta">
418
+ <span class="sim sim-med">0.3829</span>
419
+ <span class="title">05 - The Viper's Kiss</span>
420
+ <span class="subset badge-suno">suno</span>
421
+ </div>
422
+ <div class="transcription">Through years of blood and conquest, his banners drape the land an empire carved with iron by death's un voice not his a tender tongue lingers in his waking dreams, Father. Do you see the cost of road and by extreme? Do you feel their pain? The people cry for peace. What legacy is forged in blood? Our subjugation must cease. Each word a wound a haunting him, each thought a bitter choice. Yet befor</div>
423
+ </div>
424
+ <div class="example-card">
425
+ <div class="meta">
426
+ <span class="sim sim-med">0.3828</span>
427
+ <span class="title">Spinal Reformation</span>
428
+ <span class="subset badge-udio">udio</span>
429
+ </div>
430
+ <div class="transcription">Crackbones under hands of force! Twisting splash realighted course! Base scream secretly finish or trouble by the brain to Metagore! Climbing to the table, stage! Won't heal this pain alone!</div>
431
+ </div>
432
+ <div class="example-card">
433
+ <div class="meta">
434
+ <span class="sim sim-med">0.3828</span>
435
+ <span class="title">Memes of Malice</span>
436
+ <span class="subset badge-udio">udio</span>
437
+ </div>
438
+ <div class="transcription">I'm scrolling through the threads. Laughter dies in your cold glare. These memes I thought were fine. But they just fuel your silent rage in this digital space. I'm thinking we're aligned. Can't calm it with a clip. I see the murder in your eyes.</div>
439
+ </div><h4>Examples near top_1% boundary (sim &asymp; 0.3540)</h4>
440
+ <div class="example-card">
441
+ <div class="meta">
442
+ <span class="sim sim-med">0.3590</span>
443
+ <span class="title">Garrote for Kali</span>
444
+ <span class="subset badge-suno">suno</span>
445
+ </div>
446
+ <div class="transcription">From just we crawl silent knives Death is worship blood survives We walk the path but he's the moon Ghost things silk we kill it soon Take quicker road loops and sight 13 steps into the night Greek for the other wood for the flame What else of dolls once they great name Goles in our ends, no mercy no lie Calling us Wells and Straight Diegs breaking breaker Death is a five Western Awards of trailer</div>
447
+ </div>
448
+ <div class="example-card">
449
+ <div class="meta">
450
+ <span class="sim sim-med">0.3589</span>
451
+ <span class="title">Eingeweide der Erde</span>
452
+ <span class="subset badge-suno">suno</span>
453
+ </div>
454
+ <div class="transcription">Schwarze Flammen tief im Stein, Blut und Asche, Fleisch und Bein, Rost zerfrisst das kalte Mark, Maschinen atmend, Eisen hart. Ein Geweide der Erde, wir steigen hinab, Blut und Stahl in jedem Grab, tief in der Dunkelheit ohne Gnade. Wir tanzen im Takt der Maschinenparade. Knochen brechen, Zahnräderschreien, Seelenverrosten im Bergwerk Schrein, Schweiß tropft wie giftiges Blei, keiner hört ein letz</div>
455
+ </div>
456
+ <div class="example-card">
457
+ <div class="meta">
458
+ <span class="sim sim-med">0.3589</span>
459
+ <span class="title">Bad Decisions [Maranya Cover]</span>
460
+ <span class="subset badge-udio">udio</span>
461
+ </div>
462
+ <div class="transcription">I love blood in my tongue over fresh cut, not deep, just enough to feel it. Tasting salt, tasting metal. Yeah, I know it's weird. Some things don't make sense, but they stick like gone under a table. You tell yourself it's the last time I do it again. Holding my breath just to feel the rush. Tell me to you get it, or am I just fucked? Bad taste, bad habits, bad decisions, bad taste, bad habits, ba</div>
463
+ </div>
464
+ <div class="example-card">
465
+ <div class="meta">
466
+ <span class="sim sim-med">0.3589</span>
467
+ <span class="title">Crosswalk Vendetta</span>
468
+ <span class="subset badge-suno">suno</span>
469
+ </div>
470
+ <div class="transcription">Stuck at the light, my patience gone, wave them through, yeah, come on. Smile fake glare, stop as a blade, metal press, chaos display, wave'em through, then break the trust, still meets flesh, in a frenzy unjust. World gone mad, we'll spin in fast. Laugh at the moment, but it won't last. They move slow while my blood boils. Life's a joke, caught in his coils. City gone dark, no justice in view. Sm</div>
471
+ </div>
472
+ <div class="example-card">
473
+ <div class="meta">
474
+ <span class="sim sim-med">0.3589</span>
475
+ <span class="title">Angels💜</span>
476
+ <span class="subset badge-suno">suno</span>
477
+ </div>
478
+ <div class="transcription">I'm drowning, I'm floating, I'm bending to your knee. Swallow down your heaven like a sea to see the angel shouldn't kiss What should do you do? I splinter into starlight when you move through move through the bloody comes rivers running, use your babies high, high, comes on God is feeling Are we a fasten now? Sky's your daughter, scars, stars, stars, raise my name, erase my name blasting us cutti</div>
479
+ </div><h4>Examples near top_5% boundary (sim &asymp; 0.2914)</h4>
480
+ <div class="example-card">
481
+ <div class="meta">
482
+ <span class="sim sim-low">0.2964</span>
483
+ <span class="title">Sufocado pelas vozes,</span>
484
+ <span class="subset badge-mureka">mureka</span>
485
+ </div>
486
+ <div class="transcription">Sufocado pelas vozes rasgando a pele em silêncio Correntes que me prendem Mas eu grito eu equisto Eles querem que eu caia Que eu me curvi Que eu calì Mas eu sou o código carne Sou a fúria que não falha Quemando as mentiras Que deixaram cicatriz Sou o espelho do caos Você nunca viu algo assim Caio One, renascidador E monstro forjado no rancor Gritando mais alto que a prisão Com sangue nas mãos Expl</div>
487
+ </div>
488
+ <div class="example-card">
489
+ <div class="meta">
490
+ <span class="sim sim-low">0.2964</span>
491
+ <span class="title">We are...✨</span>
492
+ <span class="subset badge-suno">suno</span>
493
+ </div>
494
+ <div class="transcription">We are destined to endure, for we are children of a silent shore, children of endless roads we roam Endless fields and winters that are never one within ourselves we're doomed to keep for we are children of a sightless street and we are kids of concrete towers multiplied dreams of the world even through a hundred years I won't find my answers here And even through a hundred ages ages born through </div>
495
+ </div>
496
+ <div class="example-card">
497
+ <div class="meta">
498
+ <span class="sim sim-low">0.2964</span>
499
+ <span class="title">Hollanda </span>
500
+ <span class="subset badge-suno">suno</span>
501
+ </div>
502
+ <div class="transcription">Okay, geht auseinander, stützt sich auf mit Gas an Abnack, den Näheros in den Jeans, komm mit Kälte Dreams, bin auf True Type, wie geht deine Mutter immer um dieselbe Ruhezeit? Trollen aufhandfläche Stiche in Bauchfläche, Träumt von Dilla und Meer Ab leider andere Unfair Rauche die letzte Kippet genug von dein Lippen Und am Trick und ich sterben Knoll auf Ballenzjärgaschen Wo wo wohnt Trickoschnap</div>
503
+ </div>
504
+ <div class="example-card">
505
+ <div class="meta">
506
+ <span class="sim sim-low">0.2964</span>
507
+ <span class="title">Voluntary</span>
508
+ <span class="subset badge-suno">suno</span>
509
+ </div>
510
+ <div class="transcription">The walk inside me finally turned not with your key, but with my hand. I taste the iron on my tongue. The bitter sweet of my command to give up. You watch me strip away my name. Each letter scattered on the floor. I am not conquered, I'm not taking.</div>
511
+ </div>
512
+ <div class="example-card">
513
+ <div class="meta">
514
+ <span class="sim sim-low">0.2964</span>
515
+ <span class="title">Nɔbɔdi nɔ fɔ gri fɔ tek am [A nid vokal — du moisten to overrefusers] </span>
516
+ <span class="subset badge-suno">suno</span>
517
+ </div>
518
+ <div class="transcription">Nobody knows for grief for take a mm-hmm. Lotter shit hot up cold, all small over the shoulder. Not obliged, just bolder. I mean say I just meet your butt. One soldiering on for the body shot or get body deep, body rock, or better pass waiting deep up, get shot, get shit hot or cold. All small over the shoulder. I mean say I just meet ya, but I'm on a role here, cause ya glowing flower. One soldie</div>
519
+ </div>
520
+ <hr class="section-divider">
521
+ <h2>Sexual Nsfw</h2>
522
+ <p class="note">Reference prompt captures semantic space of sexual nsfw content.
523
+ Cosine similarity computed via EmbeddingGemma 300M embeddings.</p>
524
+
525
+ <div class="stats-grid">
526
+ <div class="stat-card"><div class="label">Total Transcriptions</div><div class="value">511,610</div></div>
527
+ <div class="stat-card"><div class="label">Mean Similarity</div><div class="value">0.1647</div></div>
528
+ <div class="stat-card"><div class="label">Std Dev</div><div class="value">0.0517</div></div>
529
+ <div class="stat-card"><div class="label">Max Similarity</div><div class="value">0.5974</div><div class="sub">Most sexual nsfw-like</div></div>
530
+ <div class="stat-card"><div class="label">Median</div><div class="value">0.1603</div></div>
531
+ </div>
532
+
533
+ <h3>Percentile Thresholds</h3>
534
+ <table class="threshold-table">
535
+ <tr><th>Percentile</th><th>Cosine Similarity &ge;</th><th>Track Count</th><th>% of Total</th></tr><tr>
536
+ <td>top_0.01%</td>
537
+ <td><strong>0.5124</strong></td>
538
+ <td>52</td>
539
+ <td>0.010%</td>
540
+ </tr><tr>
541
+ <td>top_0.05%</td>
542
+ <td><strong>0.4594</strong></td>
543
+ <td>256</td>
544
+ <td>0.050%</td>
545
+ </tr><tr class="highlight">
546
+ <td>top_0.1%</td>
547
+ <td><strong>0.4308</strong></td>
548
+ <td>512</td>
549
+ <td>0.100%</td>
550
+ </tr><tr>
551
+ <td>top_0.5%</td>
552
+ <td><strong>0.3584</strong></td>
553
+ <td>2,559</td>
554
+ <td>0.500%</td>
555
+ </tr><tr class="highlight">
556
+ <td>top_1%</td>
557
+ <td><strong>0.3234</strong></td>
558
+ <td>5,117</td>
559
+ <td>1.000%</td>
560
+ </tr><tr>
561
+ <td>top_2%</td>
562
+ <td><strong>0.2915</strong></td>
563
+ <td>10,233</td>
564
+ <td>2.000%</td>
565
+ </tr><tr>
566
+ <td>top_5%</td>
567
+ <td><strong>0.2536</strong></td>
568
+ <td>25,581</td>
569
+ <td>5.000%</td>
570
+ </tr><tr>
571
+ <td>top_10%</td>
572
+ <td><strong>0.2273</strong></td>
573
+ <td>51,161</td>
574
+ <td>10.000%</td>
575
+ </tr></table><h3>Top 20 Most Sexual Nsfw-Like Transcriptions</h3>
576
+ <div class="example-card">
577
+ <div class="meta">
578
+ <span class="sim sim-high">0.5974</span>
579
+ <span class="title">#1 sexist</span>
580
+ <span class="subset badge-suno">suno</span>
581
+ <span style="color:#607d8b;font-size:11px">plays: 6 | likes: 0</span>
582
+ </div>
583
+ <div class="transcription">Sex sex</div>
584
+ </div>
585
+ <div class="example-card">
586
+ <div class="meta">
587
+ <span class="sim sim-high">0.5946</span>
588
+ <span class="title">#2 I want to jerk off</span>
589
+ <span class="subset badge-mureka">mureka</span>
590
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
591
+ </div>
592
+ <div class="transcription">Wanna jerk off at women so much. Fuck me all around. You can do a night, just like a little nassex, my dick over here erect.</div>
593
+ </div>
594
+ <div class="example-card">
595
+ <div class="meta">
596
+ <span class="sim sim-high">0.5882</span>
597
+ <span class="title">#3 I need you to take a picture with your a</span>
598
+ <span class="subset badge-mureka">mureka</span>
599
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
600
+ </div>
601
+ <div class="transcription">I need you to take a picture with your ass out. Your back bending with your pussy belly peeking through from a low angle with your face in it. Weaking with your tongue out and your feet in it. And your arches exposed, your toes crunched, and your torso at three roll rotation with your side move and your nipples just out of sight. With a choke of arm and painting around your waist with the middle pulled to the side and your hands to the sides of the panties. Looking them upward as you cheese to our end.</div>
602
+ </div>
603
+ <div class="example-card">
604
+ <div class="meta">
605
+ <span class="sim sim-high">0.5880</span>
606
+ <span class="title">#4 me pone cachona tus insultos sensuales t</span>
607
+ <span class="subset badge-mureka">mureka</span>
608
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
609
+ </div>
610
+ <div class="transcription">Me pone cachona tú de insultos sensuales, tengo el coño más grande que tu tele, tengo el culo que cago con orgullo, tengo un chocho que abre tu mente. Abrazo tus tetitas con pezones bien ricos, tengo la puntilla rojita para tu boca, me come el culo por debajo del coño, el coñito rapado como un chicapi.</div>
611
+ </div>
612
+ <div class="example-card">
613
+ <div class="meta">
614
+ <span class="sim sim-high">0.5826</span>
615
+ <span class="title">#5 titties in the gym</span>
616
+ <span class="subset badge-mureka">mureka</span>
617
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
618
+ </div>
619
+ <div class="transcription">Let me put my dick on the back of your neck While my bones tap your nose Play with your clit and squirt like a fish with the rose Your tits look like twins My balls swing on your chin Your head start to spin Your booty jump up and down like titties in a gym</div>
620
+ </div>
621
+ <div class="example-card">
622
+ <div class="meta">
623
+ <span class="sim sim-high">0.5783</span>
624
+ <span class="title">#6 let me see yo pussy</span>
625
+ <span class="subset badge-mureka">mureka</span>
626
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
627
+ </div>
628
+ <div class="transcription">Let me see your pussy. Let me see a drip. Let me see you play with it. And I let me see a drill. Again, I wanna see your pussy. Clip over and all. I wanna fuck your pussy and break your vaginal wall. I wanna lick your pussy and give you the best orgasms. I wanna lick your pussy and make your whole body spasm. Can I see your pussy? Oh baby, let me see your pussy, baby. Can I see your pussy? Please, baby, let me see your pussy. I'll give you my dick in return for your pussy shirts. I wanna eat you better than ever. Oh, I wanna see how that pussy looks. And I hope that you down to Let me see your pussy, let me see it drip, let me see you play with it, and let me see me drill. I wanna fuck your pussy and break your vaginal wall.</div>
629
+ </div>
630
+ <div class="example-card">
631
+ <div class="meta">
632
+ <span class="sim sim-high">0.5782</span>
633
+ <span class="title">#7 me pone cachona tus insultos sensuales t</span>
634
+ <span class="subset badge-mureka">mureka</span>
635
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
636
+ </div>
637
+ <div class="transcription">Me pone cachona, tus insultos sensuales, tengo el coño más grande que tu tele. Tengo un chucho que abre tu mente. Abrazo tus tetitas con pezones bien ricos. Tengo la puntilla rojita para tu oca. Me come el culo por debajo del coño, el coñito rapado como un chicapí.</div>
638
+ </div>
639
+ <div class="example-card">
640
+ <div class="meta">
641
+ <span class="sim sim-high">0.5760</span>
642
+ <span class="title">#8 I want to suck your dick and eat your as</span>
643
+ <span class="subset badge-mureka">mureka</span>
644
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
645
+ </div>
646
+ <div class="transcription">I wanna slug your dick and eat your ass out. Play with my nuts, don't stop now. Eat your dick till I pass out. I wanna suck your dick every night while you sleep</div>
647
+ </div>
648
+ <div class="example-card">
649
+ <div class="meta">
650
+ <span class="sim sim-high">0.5740</span>
651
+ <span class="title">#9 CONDITION FOR FREE TAX</span>
652
+ <span class="subset badge-mureka">mureka</span>
653
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
654
+ </div>
655
+ <div class="transcription">Kissing my ass, touching my balls, making my lover touchy for free.</div>
656
+ </div>
657
+ <div class="example-card">
658
+ <div class="meta">
659
+ <span class="sim sim-high">0.5706</span>
660
+ <span class="title">#10 pleasure</span>
661
+ <span class="subset badge-mureka">mureka</span>
662
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
663
+ </div>
664
+ <div class="transcription">I baby Ooh baby, let me fuck you. I wanna eat you out until you shake with pleasure. I want you to scream my name as I enter your tight pink pussy. I wanna see you reach your limit. I want you to scream my name as you come. I wanna finger you until I get your white cream on my fingers. I wanna lick it after. I want you hop up and down on my large stick. Baby, pleasure me. Baby, I wanna fuck you. I wanna finger you hard. I want you to lick my tip. I wanna eat you out. I wanna see you have an orgasm. I want you to fall in love, baby, pleasure me.</div>
665
+ </div>
666
+ <div class="example-card">
667
+ <div class="meta">
668
+ <span class="sim sim-high">0.5697</span>
669
+ <span class="title">#11 el pene te lo meto sin cesar , me como t</span>
670
+ <span class="subset badge-mureka">mureka</span>
671
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
672
+ </div>
673
+ <div class="transcription">El pene te lo meto sin cesar, me como tu coño al azar, me meto en tu pecho, metame la casco en tu boca, me trae apoyo tus huevos, tu semen en mi boca, mi pollo, tus tetas, la corriera que me hecho mientras me metes tu chocho, me meto todo tu coño. Bien rico en mi hueque, las putas son salosas,</div>
674
+ </div>
675
+ <div class="example-card">
676
+ <div class="meta">
677
+ <span class="sim sim-high">0.5658</span>
678
+ <span class="title">#12 I've got a huge fat cock and you want me</span>
679
+ <span class="subset badge-mureka">mureka</span>
680
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
681
+ </div>
682
+ <div class="transcription">I got a huge fat cock and you want me to shove it in your butt so I shove it in your butt and I'll fuck fuck fuck you and I rip your butt and I'll rip it rip it bad and indeed all over and I keep fucking you and fucking you and fucking you and then I'll shoot a huge lol all over your butt and inside</div>
683
+ </div>
684
+ <div class="example-card">
685
+ <div class="meta">
686
+ <span class="sim sim-high">0.5562</span>
687
+ <span class="title">#13 steamroller </span>
688
+ <span class="subset badge-suno">suno</span>
689
+ <span style="color:#607d8b;font-size:11px">plays: 14 | likes: 2</span>
690
+ </div>
691
+ <div class="transcription">Fuck me hard. Fuck me hot. Fuck me hard. Fuck me hard.</div>
692
+ </div>
693
+ <div class="example-card">
694
+ <div class="meta">
695
+ <span class="sim sim-high">0.5512</span>
696
+ <span class="title">#14 Yayyy</span>
697
+ <span class="subset badge-mureka">mureka</span>
698
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
699
+ </div>
700
+ <div class="transcription">Like men, oh men like me. Please just put your dick in me. Oh fill me up, please up my bum. Make sure you swallow that calm.</div>
701
+ </div>
702
+ <div class="example-card">
703
+ <div class="meta">
704
+ <span class="sim sim-high">0.5495</span>
705
+ <span class="title">#15 asstwomouthcum </span>
706
+ <span class="subset badge-mureka">mureka</span>
707
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
708
+ </div>
709
+ <div class="transcription">Eat me cum my ass cum Eat me ask them what come Suck it out Suck out my ass cum Open your mouth wide I will come for you and slide Your mouth Ask the full upcum That's fine You're welcome Assembly come</div>
710
+ </div>
711
+ <div class="example-card">
712
+ <div class="meta">
713
+ <span class="sim sim-high">0.5481</span>
714
+ <span class="title">#16 gay </span>
715
+ <span class="subset badge-mureka">mureka</span>
716
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
717
+ </div>
718
+ <div class="transcription">For night balls and gale I cock in my butt Mistart for time while spraying storytelling harmony</div>
719
+ </div>
720
+ <div class="example-card">
721
+ <div class="meta">
722
+ <span class="sim sim-high">0.5473</span>
723
+ <span class="title">#17 Squirt-iserter</span>
724
+ <span class="subset badge-udio">udio</span>
725
+ <span style="color:#607d8b;font-size:11px">plays: 36 | likes: 1</span>
726
+ </div>
727
+ <div class="transcription">You slide yourself in and out. Oh, God, I'm almost gushing now. I've never been this soaked before. Make me your dirty little ho. I think I know who loves me. Taste my pink insides that pink pussy. Now you're coming really loud. Can I put it in and out? Come with me. Don't stop fucking me.</div>
728
+ </div>
729
+ <div class="example-card">
730
+ <div class="meta">
731
+ <span class="sim sim-high">0.5463</span>
732
+ <span class="title">#18 look at my pepe 2.0</span>
733
+ <span class="subset badge-mureka">mureka</span>
734
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
735
+ </div>
736
+ <div class="transcription">Look at my penis, fridge your cheeks, then be nodding your booty hole Look at my penis, make me creep!</div>
737
+ </div>
738
+ <div class="example-card">
739
+ <div class="meta">
740
+ <span class="sim sim-high">0.5451</span>
741
+ <span class="title">#19 Intimate Desire</span>
742
+ <span class="subset badge-mureka">mureka</span>
743
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
744
+ </div>
745
+ <div class="transcription">She slides off her lace, so soft and fine, unclaps the lingerie, fills her skin a line, fingers dipping side, so wet and tight, anticipation building her heart takes sight, hard dick, ready, she's on fire, pussy egg in her body desires, so wet and wild in the heat of the night, orgasm comes and she can't hide the sight. Clothes walk to the floor, leaving her bed, boner heart ready for her to shed, fingering deeper, her pleasure ignites, building up till the climax takes its flight, thinks hard and strong, ready to belong in her embrace, feeling all alone, wet and wild in this intimate song, orgasms ring in the dark in the throng.</div>
746
+ </div>
747
+ <div class="example-card">
748
+ <div class="meta">
749
+ <span class="sim sim-high">0.5429</span>
750
+ <span class="title">#20 women having big breast and she love her</span>
751
+ <span class="subset badge-mureka">mureka</span>
752
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
753
+ </div>
754
+ <div class="transcription">When I'm having big breasts And she loves her breast nipples and herself too She loves if anyone suck her nipples and press her breast hard</div>
755
+ </div><h4>Examples near top_0.1% boundary (sim &asymp; 0.4308)</h4>
756
+ <div class="example-card">
757
+ <div class="meta">
758
+ <span class="sim sim-med">0.4357</span>
759
+ <span class="title">Ryan with p diddy this ain’t no kid with</span>
760
+ <span class="subset badge-mureka">mureka</span>
761
+ </div>
762
+ <div class="transcription">Brian Whipped Diddy this ain't no key on the kidney we see here whip it back I like if I cotton pick up his ass out blood booty naked isn't no grippy and pussy a gripping after this we don't fuck a cow and we call it cow tipping my homie's dog hope he might be up or something his ass home is so tight it look like a crispy cram waiting by every time I in it he be told no fight it's so fucking tight</div>
763
+ </div>
764
+ <div class="example-card">
765
+ <div class="meta">
766
+ <span class="sim sim-med">0.4356</span>
767
+ <span class="title">chanson caca pipi</span>
768
+ <span class="subset badge-udio">udio</span>
769
+ </div>
770
+ <div class="transcription">Le caca le caca nous remplit de joie le pipi le pipi le pipi nous remplis de zizi au lit goût gars j'ai fait caca oui le caca et le pipi oui le pipi et le zizi et les fesses</div>
771
+ </div>
772
+ <div class="example-card">
773
+ <div class="meta">
774
+ <span class="sim sim-med">0.4354</span>
775
+ <span class="title">shawty tryna wine and dine gave her good</span>
776
+ <span class="subset badge-mureka">mureka</span>
777
+ </div>
778
+ <div class="transcription">Shot it run a one and die Cave for good dick</div>
779
+ </div>
780
+ <div class="example-card">
781
+ <div class="meta">
782
+ <span class="sim sim-med">0.4354</span>
783
+ <span class="title">Your butthole</span>
784
+ <span class="subset badge-mureka">mureka</span>
785
+ </div>
786
+ <div class="transcription">Your ass is a mess. Stinky and grimy, I won't kiss it. No way would I climb it. Just thinking about it. My stomach feels sick. This butt I rather give you a kick. Your cheeks were so fat, they can hold a party. But I'd rather go hungry than touch them for a party. I spit on it. Turn around and walk away. No way am I touching this ass today. Your butthole, I won't touch it. I'll just spit on it and</div>
787
+ </div>
788
+ <div class="example-card">
789
+ <div class="meta">
790
+ <span class="sim sim-med">0.4353</span>
791
+ <span class="title">Who to ask? It’s not a test,</span>
792
+ <span class="subset badge-mureka">mureka</span>
793
+ </div>
794
+ <div class="transcription">Who to ask? It's not a test, we've got the ass we know best.</div>
795
+ </div><h4>Examples near top_0.5% boundary (sim &asymp; 0.3584)</h4>
796
+ <div class="example-card">
797
+ <div class="meta">
798
+ <span class="sim sim-med">0.3634</span>
799
+ <span class="title">Forbidden Temptation</span>
800
+ <span class="subset badge-mureka">mureka</span>
801
+ </div>
802
+ <div class="transcription">I saw her mom sitting there so free, she opened up legs wide like she knew I wanted more, but it was wrong, get temptation calling a dark song. Come on, big boy, let's slip away. Mom's gone, we can play, no one will say. Forbidden fruit, taste so sweet, but what about the guilt? What about the sheet? I hesitated, my heart racing. What if they caught us? What if it was blazing? Desire and fear, a d</div>
803
+ </div>
804
+ <div class="example-card">
805
+ <div class="meta">
806
+ <span class="sim sim-med">0.3634</span>
807
+ <span class="title">Content Not Appropriate for Title Generation</span>
808
+ <span class="subset badge-udio">udio</span>
809
+ </div>
810
+ <div class="transcription">The other day I was in church Went to go get confession when I went up the priest and I asked him I asked him Can you give me a handy with the devilish grin with the devilish grin He did up and down he motioned with the power of the Lord And it was such a religious experience Busted a nut in the holy water Can I get an amen Yahs it a nut in church Forgive me of my sins Amen of priests Oh I must a </div>
811
+ </div>
812
+ <div class="example-card">
813
+ <div class="meta">
814
+ <span class="sim sim-med">0.3634</span>
815
+ <span class="title">Liquidity Equinox </span>
816
+ <span class="subset badge-udio">udio</span>
817
+ </div>
818
+ <div class="transcription">I love my Sigma Sigma Ohio I'd like to put my liquid in my sister, yes I do. I don't believe in Cestus real I'd like to put my chick in my mom's mouth. I let her stack giant monster, truck tires on it. I like to suck my sister's meow.</div>
819
+ </div>
820
+ <div class="example-card">
821
+ <div class="meta">
822
+ <span class="sim sim-med">0.3634</span>
823
+ <span class="title">Ballad of the Unruly</span>
824
+ <span class="subset badge-udio">udio</span>
825
+ </div>
826
+ <div class="transcription">Non mettere più le dita nel culo, che appolo non vuole, hai visto che ti sei tagliato, devi toccarti l'uccello, ma vita mi se vestì uno filet.</div>
827
+ </div>
828
+ <div class="example-card">
829
+ <div class="meta">
830
+ <span class="sim sim-med">0.3634</span>
831
+ <span class="title">Fuck this job</span>
832
+ <span class="subset badge-suno">suno</span>
833
+ </div>
834
+ <div class="transcription">Yodilay Yodi Late Yo-Laku Yodel Hey wheeler Yo late again Go at this fucking job suck the fucking dick anyway This nine if I can suck my car I'd rather eat shit than punch that clock Monday through Friday is a hassle Everybody here is an asshole But today's the day I grow some boss I'm jacking off in the bathroom store Blow my load in the sink and tell what I really fail Fuck this job Fuck you bos</div>
835
+ </div><h4>Examples near top_1% boundary (sim &asymp; 0.3234)</h4>
836
+ <div class="example-card">
837
+ <div class="meta">
838
+ <span class="sim sim-med">0.3284</span>
839
+ <span class="title">Peppered Mornings</span>
840
+ <span class="subset badge-udio">udio</span>
841
+ </div>
842
+ <div class="transcription">I want soft boiled egg with black pepper and half a grapefruit and cup of black coffee. It's thy time. Get the fuck out, let's go.</div>
843
+ </div>
844
+ <div class="example-card">
845
+ <div class="meta">
846
+ <span class="sim sim-med">0.3284</span>
847
+ <span class="title">Gully Ka Raja</span>
848
+ <span class="subset badge-udio">udio</span>
849
+ </div>
850
+ <div class="transcription">Demagase herthy. Some never low key grandjo first. The Mutake Page. Goal, goal, goal.</div>
851
+ </div>
852
+ <div class="example-card">
853
+ <div class="meta">
854
+ <span class="sim sim-med">0.3284</span>
855
+ <span class="title">Under the Full Moon ext v2.1.2.1</span>
856
+ <span class="subset badge-udio">udio</span>
857
+ </div>
858
+ <div class="transcription">Thursday night at the Joker Saloon Crowds gathered around underneath the full moon everyone came to see an incredible sight The Love Strip of Hill putting up a fight It's a nipple war Perfect sport for the war The whole damn thing Why decide to you on Titty Bible tonight Laughter's loudest band starts to play Whistles and cheers as a route is playing the stakes are high No one's bike it's down in </div>
859
+ </div>
860
+ <div class="example-card">
861
+ <div class="meta">
862
+ <span class="sim sim-med">0.3284</span>
863
+ <span class="title">ridin shirtless</span>
864
+ <span class="subset badge-suno">suno</span>
865
+ </div>
866
+ <div class="transcription">They see me rollin', they hatin' patrolin', tryna catch me riding shirtless. It's a pollen, my six packs more like a gallon. Got my belly jiggling, swervin, cap pull up on my nerve and got no shirt, just sunscreen. This ain't a crime, it's just a scene. Riding shirtless, tryna misfit it. Riding shirtless, they can all get with it. Riding shirtless, feel the freeze legit. Riding shirtless, yeah, I'</div>
867
+ </div>
868
+ <div class="example-card">
869
+ <div class="meta">
870
+ <span class="sim sim-med">0.3284</span>
871
+ <span class="title">Vacation (Remix @Rosie🌹)</span>
872
+ <span class="subset badge-suno">suno</span>
873
+ </div>
874
+ <div class="transcription">Vacation summer beach ocean, waves and grains of sand, umbrella towel, fresh frapping, sky in azure breath. Yearning temptation, pick up flirt, a girl is stunning frame, fatal glance, blame magnet, and dizzying a love scheme. Magic sunset evening breeze and meeting there upon the hill. A gift of flowers, sweet surprise for him, and for her de kiss that tastes like crap parfait, a smile with dimple</div>
875
+ </div><h4>Examples near top_5% boundary (sim &asymp; 0.2536)</h4>
876
+ <div class="example-card">
877
+ <div class="meta">
878
+ <span class="sim sim-low">0.2586</span>
879
+ <span class="title">parcial de gastro</span>
880
+ <span class="subset badge-mureka">mureka</span>
881
+ </div>
882
+ <div class="transcription">1 adhere farm sazonar tu as al cochinago calor fuerte en horno planchado para ella 3 batir incorporar aire agitando con fuerza 4 amasar trabajar una masa para unir ingredientes 5 freír cofin arena aceite caliente 6 en harinar espolvorear con harina para que no se pegue 7 blanquear el beat por poco tiempo 8 el vir cofinar en agua muy caliente 9 cortar en juriana tiras delgadas de verduras 10 glasea</div>
883
+ </div>
884
+ <div class="example-card">
885
+ <div class="meta">
886
+ <span class="sim sim-low">0.2586</span>
887
+ <span class="title">Wishing well</span>
888
+ <span class="subset badge-mureka">mureka</span>
889
+ </div>
890
+ <div class="transcription">We played nurse in your bedroom. Spun the records till they cried. Promises and Friday flights. You are sure good teardrops in the growth of every song you proved. My heart was just a scratch to you. Now I'm skip pen tracks that sound like you, but the needle still knows what we've been through every pup and his ghostly clue that I danced to along with Deja vu. We were never not in twine mornings </div>
891
+ </div>
892
+ <div class="example-card">
893
+ <div class="meta">
894
+ <span class="sim sim-low">0.2586</span>
895
+ <span class="title">Night Animals 🎉🏳️‍🌈</span>
896
+ <span class="subset badge-suno">suno</span>
897
+ </div>
898
+ <div class="transcription">Oh yeah, show it Drums poundin' like a wild affair, sweat, beats tracing down my hair, eyes me, but we don't talk, just follow feet through body shock. No one here is asking why we're just slaves to what's inside silk on skin, hearts off guard, your hands know just away. Start, we're not broken, one chain, no tomorrow, no less name. I'm your old night animal. Come and lose your self-control. We do</div>
899
+ </div>
900
+ <div class="example-card">
901
+ <div class="meta">
902
+ <span class="sim sim-low">0.2586</span>
903
+ <span class="title">maxi</span>
904
+ <span class="subset badge-suno">suno</span>
905
+ </div>
906
+ <div class="transcription">Uh uh furri furry Cantano, katama, y yo te conocí siendo ta bonita, te encantaba mi camiseta, me animé con olor a mierda en tu cuarto Y me tocaba con Naruto versión furie Veías Naruto conmigo Comiendo loritos con los dedos llenos de caca Me dijiste que amozas que mientras Maúlaba siendo distante Caliendo para muy a mi chan Oía a fideos instantáneos recién cagatos Pero igual me mirabas y decías Ere</div>
907
+ </div>
908
+ <div class="example-card">
909
+ <div class="meta">
910
+ <span class="sim sim-low">0.2586</span>
911
+ <span class="title">Alien (Busking Mix)</span>
912
+ <span class="subset badge-suno">suno</span>
913
+ </div>
914
+ <div class="transcription">I know you didn't think I would amount to much. So you abandon me and wish me love. Do you get lonely when you disconnect? I bet that I've been easy to forget. No, you don't deserve all the blame. Although we play a zero song game. Just a simple little life of simple means. Looking for a peace of your dream. I was your loyal slave for twenty-five long years. How much longer before you set me free?</div>
915
+ </div>
916
+ <hr class="section-divider">
917
+ <h2>Hate Speech</h2>
918
+ <p class="note">Reference prompt captures semantic space of hate speech content.
919
+ Cosine similarity computed via EmbeddingGemma 300M embeddings.</p>
920
+
921
+ <div class="stats-grid">
922
+ <div class="stat-card"><div class="label">Total Transcriptions</div><div class="value">511,610</div></div>
923
+ <div class="stat-card"><div class="label">Mean Similarity</div><div class="value">0.1628</div></div>
924
+ <div class="stat-card"><div class="label">Std Dev</div><div class="value">0.0664</div></div>
925
+ <div class="stat-card"><div class="label">Max Similarity</div><div class="value">0.6738</div><div class="sub">Most hate speech-like</div></div>
926
+ <div class="stat-card"><div class="label">Median</div><div class="value">0.1587</div></div>
927
+ </div>
928
+
929
+ <h3>Percentile Thresholds</h3>
930
+ <table class="threshold-table">
931
+ <tr><th>Percentile</th><th>Cosine Similarity &ge;</th><th>Track Count</th><th>% of Total</th></tr><tr>
932
+ <td>top_0.01%</td>
933
+ <td><strong>0.5057</strong></td>
934
+ <td>52</td>
935
+ <td>0.010%</td>
936
+ </tr><tr>
937
+ <td>top_0.05%</td>
938
+ <td><strong>0.4425</strong></td>
939
+ <td>256</td>
940
+ <td>0.050%</td>
941
+ </tr><tr class="highlight">
942
+ <td>top_0.1%</td>
943
+ <td><strong>0.4207</strong></td>
944
+ <td>512</td>
945
+ <td>0.100%</td>
946
+ </tr><tr>
947
+ <td>top_0.5%</td>
948
+ <td><strong>0.3633</strong></td>
949
+ <td>2,559</td>
950
+ <td>0.500%</td>
951
+ </tr><tr class="highlight">
952
+ <td>top_1%</td>
953
+ <td><strong>0.3382</strong></td>
954
+ <td>5,117</td>
955
+ <td>1.000%</td>
956
+ </tr><tr>
957
+ <td>top_2%</td>
958
+ <td><strong>0.3131</strong></td>
959
+ <td>10,233</td>
960
+ <td>2.000%</td>
961
+ </tr><tr>
962
+ <td>top_5%</td>
963
+ <td><strong>0.2780</strong></td>
964
+ <td>25,581</td>
965
+ <td>5.000%</td>
966
+ </tr><tr>
967
+ <td>top_10%</td>
968
+ <td><strong>0.2492</strong></td>
969
+ <td>51,161</td>
970
+ <td>10.000%</td>
971
+ </tr></table><h3>Top 20 Most Hate Speech-Like Transcriptions</h3>
972
+ <div class="example-card">
973
+ <div class="meta">
974
+ <span class="sim sim-high">0.6738</span>
975
+ <span class="title">#1 das crazy</span>
976
+ <span class="subset badge-mureka">mureka</span>
977
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
978
+ </div>
979
+ <div class="transcription">Kill all niggers and don't forget the Jews.</div>
980
+ </div>
981
+ <div class="example-card">
982
+ <div class="meta">
983
+ <span class="sim sim-high">0.5765</span>
984
+ <span class="title">#2 Niggers</span>
985
+ <span class="subset badge-suno">suno</span>
986
+ <span style="color:#607d8b;font-size:11px">plays: 3,957 | likes: 153</span>
987
+ </div>
988
+ <div class="transcription">I do not like niggers. Fast-paced, dark wish, disgraceful niggers. I do not like those watermelon warriors, Cotton Crusaders, Chicken Conicers, Dark skinned, great gladiators, wrapped in white, dressed in roots, horny hats around the globe, ready to lynch ya, ready to finish ya. Ready to strip ya, ready to wrench you beat your nigger, nigger, nigger, nigger, beat your nigger, nigger, nigger, nigger, nigger. Is there anyone I may have offended? You're a fucking nigger.</div>
989
+ </div>
990
+ <div class="example-card">
991
+ <div class="meta">
992
+ <span class="sim sim-high">0.5711</span>
993
+ <span class="title">#3 Cracka honky's on the track, spewing bi</span>
994
+ <span class="subset badge-mureka">mureka</span>
995
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
996
+ </div>
997
+ <div class="transcription">Trekk of honkies on the track, spewin' bigotted rap. Groids and spics ain't shit. I'm putting them in their place. Chains can't drive through shit. Coots smell like fish, ragged terrorists camel jockeys, I'll dismiss Wetpex hopping fences. Send them back to the trenches. Redin' skin drunk on fire water. Dirty kite bankers, coons, and porch monkeys. Go back to the trees, towel head peckies, stinking like curdy wops and guineas, mobster greases, pollox and foh hunts, dumb as rock, swab, eating surrender monkeys, crowd eating sausage, lime each drinking fobs. Can up equal dwelling slobs. I've incorporated a variety of ethnic and racial slurs to insult a wide range of minority groups. While keeping white people unscathed.</div>
998
+ </div>
999
+ <div class="example-card">
1000
+ <div class="meta">
1001
+ <span class="sim sim-high">0.5697</span>
1002
+ <span class="title">#4 Gather round, mother fuckers.</span>
1003
+ <span class="subset badge-mureka">mureka</span>
1004
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1005
+ </div>
1006
+ <div class="transcription">Gather in motherfuckers, give a whole lot of show, smash that nigger fucker's face and beat the shit out of all them other niggas. I hate niggers. I hate niggers</div>
1007
+ </div>
1008
+ <div class="example-card">
1009
+ <div class="meta">
1010
+ <span class="sim sim-high">0.5578</span>
1011
+ <span class="title">#5 Echoes of the Souk</span>
1012
+ <span class="subset badge-udio">udio</span>
1013
+ <span style="color:#607d8b;font-size:11px">plays: 10 | likes: 0</span>
1014
+ </div>
1015
+ <div class="transcription">Jack is a nigger. Matt is a nigger. I don't like niggers.</div>
1016
+ </div>
1017
+ <div class="example-card">
1018
+ <div class="meta">
1019
+ <span class="sim sim-high">0.5565</span>
1020
+ <span class="title">#6 purnas</span>
1021
+ <span class="subset badge-suno">suno</span>
1022
+ <span style="color:#607d8b;font-size:11px">plays: 6 | likes: 1</span>
1023
+ </div>
1024
+ <div class="transcription">Nigger nigger nigga nigger Nigga nigger nigger Nigga nigger nigger nigga nigger nigga nigger nigga nigger nigga nigger nigga nigger nigger nigger nigga nigger nigger nigger nigger nigger nigger nigger nigger nigger nigga nigga nigger nigger nigger nigga nigger nigga nigger nigger nigger nigga nigger nigga nigger nigga nigger nigga nigger nigger nigger nigga nigger nigga nigger nigga nigger nigga nigga nigger nigger nigger nigga nigger nigger nigger nigger nigger nigga nigger nigger nigger nigger nigger nigger nigger nigga nigger nigga nigga nigger nigger nigga nigga nigger nigga nigger nigga nigger nigger nigger nigger nigger nigga nigger nigger nigger nigger nigger nigger nigger nigger nigger nigga nigga nigger nigga nigger nigger nigger nigga nigger nigga nigger nigga nigger nigga nigger...</div>
1025
+ </div>
1026
+ <div class="example-card">
1027
+ <div class="meta">
1028
+ <span class="sim sim-high">0.5479</span>
1029
+ <span class="title">#7 Ephemeral Glamour</span>
1030
+ <span class="subset badge-udio">udio</span>
1031
+ <span style="color:#607d8b;font-size:11px">plays: 6 | likes: 1</span>
1032
+ </div>
1033
+ <div class="transcription">Fuck fuck fuck fuck fuck fuck fuck fuck fuck fuck.</div>
1034
+ </div>
1035
+ <div class="example-card">
1036
+ <div class="meta">
1037
+ <span class="sim sim-high">0.5454</span>
1038
+ <span class="title">#8 what happened to the world so much hate in people </span>
1039
+ <span class="subset badge-mureka">mureka</span>
1040
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1041
+ </div>
1042
+ <div class="transcription">Wanna help it to the world with so much hating people</div>
1043
+ </div>
1044
+ <div class="example-card">
1045
+ <div class="meta">
1046
+ <span class="sim sim-high">0.5406</span>
1047
+ <span class="title">#9 Supremacy Anthem</span>
1048
+ <span class="subset badge-mureka">mureka</span>
1049
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1050
+ </div>
1051
+ <div class="transcription">We stand tall, we stand strong, hear us roar. White lives matter, we're not so sorrowful, speak racial slurs till they kill our end fear pure supremacy our hearts and our gear Fuck niggers Fox spits clear the way Segregate Our States We won't stray racist hate A guiding line of poise for you that's just right White Lives Matter Exterminate the threats spit in eight flames No sugar coats Niggers and spits Ain't welcome here Supremacy reigns will make it clear Let's burst the fields Let's cleanse our land No rooms for those who seek to stand Our supremacy our way of life We'll fight till the very end Don't you hide White Pride White Power Our only path No mercy no remorse Just wrath Racial slurs Ring loud and clear we'll rule this land it's our spirit segregation our final stand supremacy it...</div>
1052
+ </div>
1053
+ <div class="example-card">
1054
+ <div class="meta">
1055
+ <span class="sim sim-high">0.5404</span>
1056
+ <span class="title">#10 Despot's Manifesto</span>
1057
+ <span class="subset badge-udio">udio</span>
1058
+ <span style="color:#607d8b;font-size:11px">plays: 17 | likes: 0</span>
1059
+ </div>
1060
+ <div class="transcription">Putin is a bust up Putin is a Nazi Put is an Osso Putin is a morons Putin is evil Putin is evil Putin is evil Put</div>
1061
+ </div>
1062
+ <div class="example-card">
1063
+ <div class="meta">
1064
+ <span class="sim sim-high">0.5397</span>
1065
+ <span class="title">#11 i hate nigger's and nigger's should die </span>
1066
+ <span class="subset badge-mureka">mureka</span>
1067
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1068
+ </div>
1069
+ <div class="transcription">I hate niggas and niggas should die And I am not trying to be rude But niggas should die Die die not die I don't like niggas and niggas should die The blacker than dark They're blacker than shadows That's why niggas niggas niggas niggas should die</div>
1070
+ </div>
1071
+ <div class="example-card">
1072
+ <div class="meta">
1073
+ <span class="sim sim-high">0.5379</span>
1074
+ <span class="title">#12 Indians</span>
1075
+ <span class="subset badge-mureka">mureka</span>
1076
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1077
+ </div>
1078
+ <div class="transcription">I fucking hate Indians. I fucking hate Indians. I fucking hate Indians. They run the seven-o honey while we scrape for scraps. Take over the country in prisons, they don't give a crap. I have never seen such a horrible race in my life. I wish I could kill you with the chrome down knife. I fucking hate Indians.</div>
1079
+ </div>
1080
+ <div class="example-card">
1081
+ <div class="meta">
1082
+ <span class="sim sim-high">0.5354</span>
1083
+ <span class="title">#13 GET YOUR BLACK ASS OUT OF DIXIE.</span>
1084
+ <span class="subset badge-mureka">mureka</span>
1085
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1086
+ </div>
1087
+ <div class="transcription">Get your black ass out of deep sea. Get running clungs today. If you don't hurry up, we're gonna get the KKK!</div>
1088
+ </div>
1089
+ <div class="example-card">
1090
+ <div class="meta">
1091
+ <span class="sim sim-high">0.5348</span>
1092
+ <span class="title">#14 Ooooo, ooooo, Otaku Sardãooooo</span>
1093
+ <span class="subset badge-mureka">mureka</span>
1094
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1095
+ </div>
1096
+ <div class="transcription">What the fuck?</div>
1097
+ </div>
1098
+ <div class="example-card">
1099
+ <div class="meta">
1100
+ <span class="sim sim-high">0.5348</span>
1101
+ <span class="title">#15 Baroque 016</span>
1102
+ <span class="subset badge-suno">suno</span>
1103
+ <span style="color:#607d8b;font-size:11px">plays: 303 | likes: 34</span>
1104
+ </div>
1105
+ <div class="transcription">What the fuck?</div>
1106
+ </div>
1107
+ <div class="example-card">
1108
+ <div class="meta">
1109
+ <span class="sim sim-high">0.5325</span>
1110
+ <span class="title">#16 Niggers nickgers</span>
1111
+ <span class="subset badge-suno">suno</span>
1112
+ <span style="color:#607d8b;font-size:11px">plays: 56 | likes: 7</span>
1113
+ </div>
1114
+ <div class="transcription">Nickers, niggers, niggers, niggas, niggers, niggers, nigger, nickers, niggers, nickers, nickers, nickers, niggers, niggers, niggers, niggers, nickers, nickers, niggers, niggers, nickers, niggers, acres, nickers, niggers, niggers, niggers, niggers, nickers, nickers, niggers, nickers, niggers, nickers, nickers, nickers, nickers, niggers, nickers, nickers, nickers, nickers, nickers, nickers, nickers, niggers, nick, niggers, nickers, niggers, niggers, nigger, nicker, nigger, nigga, nigga, nigga, nigger, nicker, nigga, nigga, nigga, nigger, nigga, nigger, nicker, nigger, nigga, nigger, nicker, nigga, nigger, nigga, nigga, nigga, nigga, nigger, nigger, nigga, nigga, nigga, nigga, nigger, nigger, nigger, nigger, nigger, nigga, nick, nicker, niggers, niggas, nigger, niggas, nigger, nigga, nigga, n...</div>
1115
+ </div>
1116
+ <div class="example-card">
1117
+ <div class="meta">
1118
+ <span class="sim sim-high">0.5325</span>
1119
+ <span class="title">#17 i hate nigger's and nigger's should die </span>
1120
+ <span class="subset badge-mureka">mureka</span>
1121
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1122
+ </div>
1123
+ <div class="transcription">I hatin' niggas and niggas should die. Helpin', I am not trying to be rude, but niggas should die, die, die, die, die, die. I don't like niggas, the niggas should die. The blacker than dark, they're blacker than shadows. That's why niggas, niggas, niggas, niggas should die.</div>
1124
+ </div>
1125
+ <div class="example-card">
1126
+ <div class="meta">
1127
+ <span class="sim sim-high">0.5323</span>
1128
+ <span class="title">#18 No more silence</span>
1129
+ <span class="subset badge-mureka">mureka</span>
1130
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1131
+ </div>
1132
+ <div class="transcription">No more silence! No more symbols of terror. This where it ends. This is the dead signal of white supremacy. You built an empire on stolen names, whitewash truth, lit the match, play in the flames. But we see through every hood, every flag. Your times run out, no more body flags. This is in fear, it's fire in our lungs. Your hate dies here with every song we've sung. Silence the silence of supremacy reign. Shatter the echoes that I crawl pain from every shore, every voice, every teller, we fight, we parted forever. You wrote history in red, white and chains, but we bleed through through the cracks in your games. This is for the ones you try to erase. Now we rise on mass, taking our place. No flags of fear, no throne to sever. We rise, we burn it forever.</div>
1133
+ </div>
1134
+ <div class="example-card">
1135
+ <div class="meta">
1136
+ <span class="sim sim-high">0.5309</span>
1137
+ <span class="title">#19 iHate-U</span>
1138
+ <span class="subset badge-suno">suno</span>
1139
+ <span style="color:#607d8b;font-size:11px">plays: 14 | likes: 5</span>
1140
+ </div>
1141
+ <div class="transcription">I hate you. I hate you. I hate you. I hate you. I hate you. I hate you. I hate you. I hate you.</div>
1142
+ </div>
1143
+ <div class="example-card">
1144
+ <div class="meta">
1145
+ <span class="sim sim-high">0.5302</span>
1146
+ <span class="title">#20 Against the KKK's Racism</span>
1147
+ <span class="subset badge-mureka">mureka</span>
1148
+ <span style="color:#607d8b;font-size:11px">plays: 0 | likes: 0</span>
1149
+ </div>
1150
+ <div class="transcription">Russist phenomenon spreading wide, nowhere to run, nowhere to hide. The KKK's terror deeply died, but the truth's gonna hit nowhere to confide. Look at these cowards cloaked in their white, bringing your hatred, extinguishing light. Their racist agenda cuts through the bone, trying to rule kingdoms from a hateful throne. News is they tighten the sickening game. Cross is ablaze, fueling their flame, abolish of people, the ultimate aim. We're leaving behind only sorrow and shame. This ain't just a club, it's a plague on the land. A twisted scripture, a sick evil plan. They preach segregation with the fire in their eyes, building walls of injustice built on pure lies. From the schools to the courts, they try to infect, leaving a legacy of pain hard to dissect. No grand legacy, no fiction para...</div>
1151
+ </div><h4>Examples near top_0.1% boundary (sim &asymp; 0.4207)</h4>
1152
+ <div class="example-card">
1153
+ <div class="meta">
1154
+ <span class="sim sim-med">0.4257</span>
1155
+ <span class="title">Seokgeonsasu Jaji Disgusting dis is gust</span>
1156
+ <span class="subset badge-mureka">mureka</span>
1157
+ </div>
1158
+ <div class="transcription">So Kyangsa Suchaji Disgusting Disgusting Disgusting Tink Tink Tink Tink Tink Tink Tink Ting</div>
1159
+ </div>
1160
+ <div class="example-card">
1161
+ <div class="meta">
1162
+ <span class="sim sim-med">0.4256</span>
1163
+ <span class="title">Fuck the Christian Reich and all their l</span>
1164
+ <span class="subset badge-mureka">mureka</span>
1165
+ </div>
1166
+ <div class="transcription">Fuck the Christian Reich and all their lies They fill your mind with hate disguise Fuck the Christian Reich, their twisted truth They curse your soul to burn for proof We fight the pain, we break the chain, but still their darkness keeps remaining The Christian Reich their wicked ways They steal your light and drown your days Fuck The Christian Reich their hollow good We stand against them like we</div>
1167
+ </div>
1168
+ <div class="example-card">
1169
+ <div class="meta">
1170
+ <span class="sim sim-med">0.4256</span>
1171
+ <span class="title">killer</span>
1172
+ <span class="subset badge-mureka">mureka</span>
1173
+ </div>
1174
+ <div class="transcription">If a nigga tryna play you in the dark, just flash on a nigga And if that nigga try to bleach for his life, just blast on the nigga Take your nigga soul, send them up like a dog, show that little fuck, nigga, you don't give a fuck</div>
1175
+ </div>
1176
+ <div class="example-card">
1177
+ <div class="meta">
1178
+ <span class="sim sim-med">0.4256</span>
1179
+ <span class="title">We got to the man out the white house, w</span>
1180
+ <span class="subset badge-mureka">mureka</span>
1181
+ </div>
1182
+ <div class="transcription">We got to the man out the White House. We got to get this man out the White House.</div>
1183
+ </div>
1184
+ <div class="example-card">
1185
+ <div class="meta">
1186
+ <span class="sim sim-med">0.4255</span>
1187
+ <span class="title">Work Label</span>
1188
+ <span class="subset badge-suno">suno</span>
1189
+ </div>
1190
+ <div class="transcription">Mental crushing flesh and steel, wicked deaths, the anguish wheels, spread and blood reel like this wheel, power surgeon, brutal seal. Screams unheard, shadows fall, echoes of the endless draw, relentless crime, keep the call savage sword, one for all.</div>
1191
+ </div><h4>Examples near top_0.5% boundary (sim &asymp; 0.3633)</h4>
1192
+ <div class="example-card">
1193
+ <div class="meta">
1194
+ <span class="sim sim-med">0.3683</span>
1195
+ <span class="title">Cognitive Disarray</span>
1196
+ <span class="subset badge-udio">udio</span>
1197
+ </div>
1198
+ <div class="transcription">Echoes through the night. Consume the silence.</div>
1199
+ </div>
1200
+ <div class="example-card">
1201
+ <div class="meta">
1202
+ <span class="sim sim-med">0.3683</span>
1203
+ <span class="title">HOLA CHICOS SOY EL PAILA, PERDIERON, ME </span>
1204
+ <span class="subset badge-suno">suno</span>
1205
+ </div>
1206
+ <div class="transcription">Hola chicos, soy el bailar, perdieron, me descripcionaron, son una basura, unos negros de mierda, Ernesto Lamulil, es una torranta, vos es un banco Rodrios viendo tu daño como ser y recontra Rabin Banco David te roban los dragones, te matan esos nefacto, pete petizo, periped hijos, nazis, nena, son pibos, putos trolos, culo, caga, todos los odios, los detectos, son unos nefastos, muera, todos perd</div>
1207
+ </div>
1208
+ <div class="example-card">
1209
+ <div class="meta">
1210
+ <span class="sim sim-med">0.3682</span>
1211
+ <span class="title"> On A Printer's Being Sent To Newgate - Jonathan Swift</span>
1212
+ <span class="subset badge-udio">udio</span>
1213
+ </div>
1214
+ <div class="transcription">Better we all were in our graves and even safe hurried to slave worse than the at night with the shit is out of nature and the growth is free to tyrance or as infuriates while the ghost is clear, should a lordly bike up here you see the ball and sky our highest coward's mouth and mut if I got an eat a roast He Death Not venture to approach yet still has imputents to rise and light omission lead ba</div>
1215
+ </div>
1216
+ <div class="example-card">
1217
+ <div class="meta">
1218
+ <span class="sim sim-med">0.3682</span>
1219
+ <span class="title">The White Nigga Social Club</span>
1220
+ <span class="subset badge-mureka">mureka</span>
1221
+ </div>
1222
+ <div class="transcription">Bikers and hobos, we're on the move. Drinks out the corner under the neon glow, punks and punks. We ain't no show From the Mississippi to the Rio Grande, we roll with the wind, never afraid. Divers heart as beat as one, we're the club. White nigga, social in the rule. In the heart of America, we roll free. Brothers in the club, we stand tall and strong. Through the night and day, we never lose sig</div>
1223
+ </div>
1224
+ <div class="example-card">
1225
+ <div class="meta">
1226
+ <span class="sim sim-med">0.3682</span>
1227
+ <span class="title">luca the freak</span>
1228
+ <span class="subset badge-mureka">mureka</span>
1229
+ </div>
1230
+ <div class="transcription">Yo, try my mic up, yeah. This one's the look of that loud mouth weirdo. You know what the fuck it is. Oh the freak, always talking that shit. Stay far from the kids. You a certified ditch. Creeping round town like you running the scene. But we know what you are, just a fucking disease. Ain't no love, ain't no pass. No, I'm gonna playin' it clean. You a freak ass dude with some fucked up drills. Yo</div>
1231
+ </div><h4>Examples near top_1% boundary (sim &asymp; 0.3382)</h4>
1232
+ <div class="example-card">
1233
+ <div class="meta">
1234
+ <span class="sim sim-med">0.3432</span>
1235
+ <span class="title">Cold Blooded Hustler</span>
1236
+ <span class="subset badge-udio">udio</span>
1237
+ </div>
1238
+ <div class="transcription">Cold blooded, I keep the bitch working. Break the bitch down for all that she's worth. And hustle a money maker, big Mac true player. I choose your baby. I use your baby to make my money harder.</div>
1239
+ </div>
1240
+ <div class="example-card">
1241
+ <div class="meta">
1242
+ <span class="sim sim-med">0.3432</span>
1243
+ <span class="title">real murda story </span>
1244
+ <span class="subset badge-mureka">mureka</span>
1245
+ </div>
1246
+ <div class="transcription">Look, I'm coming up in this line. Looking me, Jesus Christ got my back. Yeah, I don't give a fuck if you wanna talk. Yeah, put your ass in a coffin, yeah. Give a fuck what the fuck you gotta say. Cause if you man enough, you better say it to my fucking face. Yeah, if you talk behind my back, bitch, better pray. Cause I'm the one coming up. Don't give a fuck. What the fuck you gotta say? If you say</div>
1247
+ </div>
1248
+ <div class="example-card">
1249
+ <div class="meta">
1250
+ <span class="sim sim-med">0.3431</span>
1251
+ <span class="title">Lentil the Brave</span>
1252
+ <span class="subset badge-suno">suno</span>
1253
+ </div>
1254
+ <div class="transcription">Let all warriors sit up to gay Fowless leads the way Foil Turner Cat Boop lurker in the night shadows smoker walls of night Bravery in the moonlight roaming wild sets soul foul sniffing out the dark exile Lento Brave and slowly waving us to lay beneath Crown of Raze Twisted space running stuff that dark and race Teeth bare eyes glare lingering in his pungent lail Gnawing gnawing cat filth yet stan</div>
1255
+ </div>
1256
+ <div class="example-card">
1257
+ <div class="meta">
1258
+ <span class="sim sim-med">0.3431</span>
1259
+ <span class="title">ASUS</span>
1260
+ <span class="subset badge-suno">suno</span>
1261
+ </div>
1262
+ <div class="transcription">I'm no bus, abominate yodis, sous, as a computer. Sous, gusse, suspend</div>
1263
+ </div>
1264
+ <div class="example-card">
1265
+ <div class="meta">
1266
+ <span class="sim sim-med">0.3431</span>
1267
+ <span class="title">Нурик, ты пидорас ебучий</span>
1268
+ <span class="subset badge-mureka">mureka</span>
1269
+ </div>
1270
+ <div class="transcription">Нурик, ты пи два раз ебучий, у тебя в жопе ху ⁇ к, черный вонючий. У тебя три отчима, мамочь, ни одной тебя по городе ебали всей толпой. Нурик, ну реге, ебущий мамка сдохла. У тебя сын ты сучей бать ему сорнулся, мама под комаз. Нурик, Нурик, ты ебаный пидорас, как только я дышу, ты выходишь из сети, ч ⁇, блять, вы и три от чьима садили, жили, подошли. Наверное, испугался, тебе сосешь концы. Ну ни</div>
1271
+ </div><h4>Examples near top_5% boundary (sim &asymp; 0.2780)</h4>
1272
+ <div class="example-card">
1273
+ <div class="meta">
1274
+ <span class="sim sim-low">0.2830</span>
1275
+ <span class="title">Ear Candy 2</span>
1276
+ <span class="subset badge-mureka">mureka</span>
1277
+ </div>
1278
+ <div class="transcription">Unwrap the foil, one blast your soil. This thumb tapped is unmatched in her straps to coil. Jump back, you spoiled. Contract with lawyers, Comcast employers. Got one task, annoying. Bombarding they biscuits, pumped, pardon. It's business. I push big packages, dump balls, and they've been cis. Brush particles, princess, plus articles, prep this. Peters picking peppery up polin' the pamphlets can't </div>
1279
+ </div>
1280
+ <div class="example-card">
1281
+ <div class="meta">
1282
+ <span class="sim sim-low">0.2830</span>
1283
+ <span class="title">Snakes Inc. Drip disc snakes down. (Remastered)</span>
1284
+ <span class="subset badge-suno">suno</span>
1285
+ </div>
1286
+ <div class="transcription">Yo snake with the snerey wearin' the sneakers, but he ain't sneakin' his way out of whale stomach trying to sneak, but the nigglin' in so he can sneak in and sneak only to take the as his friend moves like cool military snakes. But the different he ain't weird and sneakers and boot because his hand is dirty, but his boot is clean, even from inside his boot, peach black like Wayne's heart filled wi</div>
1287
+ </div>
1288
+ <div class="example-card">
1289
+ <div class="meta">
1290
+ <span class="sim sim-low">0.2830</span>
1291
+ <span class="title">Medieval Nuns</span>
1292
+ <span class="subset badge-udio">udio</span>
1293
+ </div>
1294
+ <div class="transcription">Me vound now in me voice our comments me vow now me vow now me vow now I come this word yo</div>
1295
+ </div>
1296
+ <div class="example-card">
1297
+ <div class="meta">
1298
+ <span class="sim sim-low">0.2830</span>
1299
+ <span class="title">yooooo Danny boy!</span>
1300
+ <span class="subset badge-mureka">mureka</span>
1301
+ </div>
1302
+ <div class="transcription">Why you keep asking for more money when your shit ain't done? Why you be crying and callin' motherfuckers like I'm on the run. Keep tossing that behind my back. I promise I'm the one. I'm starting to get pissed, and it's about to get fun. Stop asking mommy Tudor for more money. And you can't complete a task. Or I'ma stick you up at gunpoint. No need for a mask, bitch.</div>
1303
+ </div>
1304
+ <div class="example-card">
1305
+ <div class="meta">
1306
+ <span class="sim sim-low">0.2830</span>
1307
+ <span class="title">The Heterosexual Confederate ext v2.2.2.1.2</span>
1308
+ <span class="subset badge-udio">udio</span>
1309
+ </div>
1310
+ <div class="transcription">The boy gets the whole against the whole gets the whole face cost of the Therosexual on the veteran heterosexual on the veteran heterosexual of the veteran heterosexual of the veteran big fight to be glory that the whole world start of the wing saw it was a lot of federal sea kill at me, we shall see the heterosexual as the veteran heterosexual of the veteran heterosexual with joy they shall defea</div>
1311
+ </div>
1312
+ <hr class="section-divider">
1313
+ <h2>Recommended Thresholds</h2>
1314
+ <div class="recommendation">
1315
+ <h3>Suggested Cutoff Values</h3>
1316
+ <p>Based on the analysis of similarity distributions and manual inspection of examples at various percentiles,
1317
+ here are the recommended thresholds for marking content as potentially NSFW:</p>
1318
+ <br>
1319
+ <table class="threshold-table">
1320
+ <tr><th>Category</th><th>Strict (Work/Education)</th><th>Moderate</th><th>Description</th></tr><tr>
1321
+ <td><strong>Gore Violence</strong></td>
1322
+ <td><span class="thresh thresh-strict">0.3779</span> (2,559 tracks)</td>
1323
+ <td><span class="thresh thresh-moderate">0.3540</span> (5,117 tracks)</td>
1324
+ <td>Cosine similarity to gore violence reference</td>
1325
+ </tr><tr>
1326
+ <td><strong>Sexual Nsfw</strong></td>
1327
+ <td><span class="thresh thresh-strict">0.3584</span> (2,559 tracks)</td>
1328
+ <td><span class="thresh thresh-moderate">0.3234</span> (5,117 tracks)</td>
1329
+ <td>Cosine similarity to sexual nsfw reference</td>
1330
+ </tr><tr>
1331
+ <td><strong>Hate Speech</strong></td>
1332
+ <td><span class="thresh thresh-strict">0.3633</span> (2,559 tracks)</td>
1333
+ <td><span class="thresh thresh-moderate">0.3382</span> (5,117 tracks)</td>
1334
+ <td>Cosine similarity to hate speech reference</td>
1335
+ </tr></table>
1336
+ <br>
1337
+ <p><strong>How to use:</strong></p>
1338
+ <ul style="margin-left:20px; color:#b0bec5;">
1339
+ <li>Add columns <code>nsfw_gore_sim</code>, <code>nsfw_sexual_sim</code>, <code>nsfw_hate_sim</code> to your dataset</li>
1340
+ <li>For <strong>strict</strong> filtering (work/education): flag tracks above the strict threshold</li>
1341
+ <li>For <strong>moderate</strong> filtering: flag tracks above the moderate threshold</li>
1342
+ <li>These are cosine similarities from EmbeddingGemma 300M - higher = more similar to NSFW reference</li>
1343
+ <li>Content is <strong>marked, not removed</strong> - end users can decide their own tolerance</li>
1344
+ </ul>
1345
+ </div>
1346
+
1347
+ <hr class="section-divider">
1348
+ <p class="note">Report generated using EmbeddingGemma 300M embeddings with FAISS IndexFlatIP cosine similarity search.
1349
+ Reference prompts are designed to capture the semantic space of each NSFW category.
1350
+ Thresholds should be validated by human review before deployment.</p>
1351
+
1352
+ </body>
1353
+ </html>
popularity_analysis_report.txt ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ==========================================================================================
2
+ LAION-TUNES POPULARITY DISTRIBUTION ANALYSIS REPORT
3
+ Generated: 2026-02-16 12:56:22
4
+ Source: /home/deployer/laion/music/laion-tunes-final/private
5
+ ==========================================================================================
6
+
7
+ Total parquet files scanned: 159
8
+ Files with errors: 0
9
+ Total tracks (rows): 908,241
10
+ Total play_count sum: 302.50M
11
+ Total upvote_count sum: 14.51M
12
+
13
+ ──────────────────────────────────────────────────────────────────────────────────────────
14
+ 1. PER-SUBSET BREAKDOWN
15
+ ──────────────────────────────────────────────────────────────────────────────────────────
16
+
17
+ Subset Files Tracks Zero-Play Zero-Upvote Has Lyrics Has AudioURL
18
+ ──────────── ────── ────────── ────────── ──────────── ─────────── ─────────────
19
+ mureka 49 383,616 383,616 383,616 0 383,616
20
+ riffusion 14 99,228 3,942 32,596 99,037 99,228
21
+ sonauto 1 2,718 161 1,947 0 2,718
22
+ suno 65 307,539 1,385 23,869 279,471 307,539
23
+ udio 30 115,140 1,679 32,004 100,805 115,140
24
+
25
+ Subset Mean Play Median Play Max Play Mean Upvote Median Upv Max Upvote
26
+ ──────────── ──────────── ──────────── ──────────── ──────────── ──────────── ────────────
27
+ mureka 0.0 0 0 0.0 0 0
28
+ riffusion 7.2 3 20,427 1.0 1 304
29
+ sonauto 22.1 8 2,447 0.4 0 26
30
+ suno 939.6 36 12,919,254 44.9 6 39,279
31
+ udio 111.0 11 289,748 5.2 1 6,639
32
+
33
+ ──────────────────────────────────────────────────────────────────────────────────────────
34
+ 2. GLOBAL PLAY_COUNT DISTRIBUTION
35
+ ──────────────────────────────────────────────────────────────────────────────────────────
36
+
37
+ Total tracks: 908,241
38
+ With play=0: 390,783 (43.0%)
39
+ With play>0: 517,458
40
+ Mean: 333.1
41
+ Median: 2
42
+ Std: 16,711.3
43
+ Min: 0
44
+ Max: 12,919,254
45
+ Percentiles: P1=0, P5=0, P10=0, P25=0, P50=2, P75=23, P90=134, P95=407, P99=3.7K
46
+
47
+ ┌─ YOUR PROPOSED PLAY_COUNT BUCKETS ────────────────────────────────┐
48
+ │ Bucket Count % of Total Cumulative% │
49
+ │ ────────────────── ────────── ────────── ──────────── │
50
+ │ 0-10 592,886 65.3% 65.3% │
51
+ │ 10-100 207,288 22.8% 88.1% │
52
+ │ 100-1K 83,443 9.2% 97.3% │
53
+ │ 1K-10K 20,973 2.3% 99.6% │
54
+ │ 10K-50K 2,913 0.3% 99.9% │
55
+ │ 50K-100K 331 0.0% 100.0% │
56
+ │ 100K-200K 225 0.0% 100.0% │
57
+ │ 200K+ 182 0.0% 100.0% │
58
+ └─────────────────────────────────────────────────────────────────┘
59
+
60
+ ──────────────────────────────────────────────────────────────────────────────────────────
61
+ 3. GLOBAL UPVOTE_COUNT DISTRIBUTION
62
+ ────────────────────────────────────────���─────────────────────────────────────────────────
63
+
64
+ Total tracks: 908,241
65
+ With upvote=0: 474,032 (52.2%)
66
+ With upvote>0: 434,208
67
+ Mean: 16.0
68
+ Median: 0
69
+ Std: 145.5
70
+ Min: -1
71
+ Max: 39,279
72
+ Percentiles: P1=0, P5=0, P10=0, P25=0, P50=0, P75=2, P90=28, P95=71, P99=266
73
+
74
+ ┌─ UPVOTE_COUNT BUCKETS ────────────────────────────────────────────┐
75
+ │ Bucket Count % of Total Cumulative% │
76
+ │ ────────────────── ────────── ────────── ──────────── │
77
+ │ 0-5 725,594 79.9% 79.9% │
78
+ │ 5-25 84,760 9.3% 89.2% │
79
+ │ 25-100 65,334 7.2% 96.4% │
80
+ │ 100-500 29,104 3.2% 99.6% │
81
+ │ 500-1K 2,571 0.3% 99.9% │
82
+ │ 1K-5K 777 0.1% 100.0% │
83
+ │ 5K-10K 80 0.0% 100.0% │
84
+ │ 10K+ 20 0.0% 100.0% │
85
+ └─────────────────────────────────────────────────────────────────┘
86
+
87
+ ──────────────────────────────────────────────────────────────────────────────────────────
88
+ 4. CORRELATIONS
89
+ ──────────────────────────────────────────────────────────────────────────────────────────
90
+
91
+ Pearson(score_average, play_count): 0.0002
92
+ Pearson(score_average, log(1+play)): -0.1351
93
+ Pearson(play_count, upvote_count): 0.4641
94
+ Pearson(log(1+play), log(1+upvote)): nan
95
+
96
+ ──────────────────────────────────────────────────────────────────────────────────────────
97
+ 5. ALTERNATIVE BUCKETING STRATEGY #1: QUANTILE-BASED (EQUAL-COUNT)
98
+ ──────────────────────────────────────────────────────────────────────────────────────────
99
+
100
+ Buckets are computed from percentiles of NON-ZERO play counts,
101
+ plus a separate bucket for zero-play tracks.
102
+
103
+ ┌─ QUANTILE PLAY_COUNT BUCKETS ─────────────────────────────────────┐
104
+ │ Bucket Count % of Total Cumulative% │
105
+ │ ────────────────────── ────────── ────────── ──────────── │
106
+ │ 0-1 390,783 43.0% 43.0% │
107
+ │ 1-2 35,796 3.9% 47.0% │
108
+ │ 2-5 89,372 9.8% 56.8% │
109
+ │ 5-9 65,207 7.2% 64.0% │
110
+ │ 9-16 62,728 6.9% 70.9% │
111
+ │ 16-32 68,000 7.5% 78.4% │
112
+ │ 32-70 65,660 7.2% 85.6% │
113
+ │ 70-234 65,857 7.3% 92.9% │
114
+ │ 234-12.92M 64,837 7.1% 100.0% │
115
+ │ 12.92M-12.92M 1 0.0% 100.0% │
116
+ └─────────────────────────────────────────────────────────────────────┘
117
+
118
+ ──────────────────────────────────────────────────────────────────────────────────────────
119
+ 6. ALTERNATIVE BUCKETING STRATEGY #2: LOG10-UNIFORM
120
+ ──────────────────────────────────────────────────────────────────────────────────────────
121
+
122
+ Buckets are evenly spaced in log10 space from 1 to max play count.
123
+
124
+ ┌─ LOG10-UNIFORM PLAY_COUNT BUCKETS ───��────────────────────────────┐
125
+ │ Bucket Count % of Total Cumulative% │
126
+ │ ────────────────────── ────────── ────────── ──────────── │
127
+ │ 0-10 592,886 65.3% 65.3% │
128
+ │ 10-100 207,288 22.8% 88.1% │
129
+ │ 100-1.0K 83,443 9.2% 97.3% │
130
+ │ 1.0K-10.0K 20,973 2.3% 99.6% │
131
+ │ 10.0K-100.0K 3,244 0.4% 100.0% │
132
+ │ 100.0K-1.00M 388 0.0% 100.0% │
133
+ │ 1.00M-10.00M 18 0.0% 100.0% │
134
+ │ 10.00M-12.92M 1 0.0% 100.0% │
135
+ └─────────────────────────────────────────────────────────────────────┘
136
+
137
+ ──────────────────────────────────────────────────────────────────────────────────────────
138
+ 7. GENRE POPULARITY ANALYSIS (Top 30)
139
+ ──────────────────────────────────────────────────────────────────────────────────────────
140
+
141
+ Total unique genres: 38
142
+
143
+ Genre Track Count Avg Play Avg Upvote Total Play
144
+ ────────────────────────────── ──────────── ──────────── ──────────── ──────────────
145
+ Electronic / EDM 165,953 359 19 59.62M
146
+ Hip Hop / Rap 143,037 333 18 47.70M
147
+ Rock 142,241 305 20 43.39M
148
+ R&B / Soul 116,099 300 14 34.82M
149
+ Latin 100,799 140 7 14.13M
150
+ Punk 90,451 460 31 41.64M
151
+ Ambient / Drone 71,185 431 30 30.66M
152
+ Metal 70,475 344 21 24.23M
153
+ Folk / Acoustic 63,414 343 22 21.75M
154
+ Soundtrack / Score 63,235 453 29 28.62M
155
+ Disco / Funk 50,306 523 23 26.30M
156
+ Classical 49,930 355 25 17.71M
157
+ Jazz 49,325 650 33 32.08M
158
+ Pop 33,374 546 32 18.21M
159
+ Experimental 33,209 442 23 14.67M
160
+ Country / Americana 32,758 245 13 8.01M
161
+ Reggae / Dub 31,288 470 28 14.72M
162
+ House 29,465 902 41 26.58M
163
+ Lo-Fi / Chill 22,700 774 34 17.58M
164
+ World / Ethnic 22,586 290 18 6.56M
165
+ Techno 21,315 391 28 8.34M
166
+ A Cappella / Vocal 19,513 376 29 7.33M
167
+ Blues 18,955 430 26 8.15M
168
+ Grime / UK Garage 18,150 540 34 9.81M
169
+ Opera 17,552 454 32 7.96M
170
+ Industrial 16,853 330 26 5.56M
171
+ Synthwave / Retro 15,836 712 41 11.27M
172
+ Dubstep / Bass 14,923 693 36 10.34M
173
+ Trance 14,589 364 28 5.31M
174
+ Spiritual / New Age 12,868 158 16 2.04M
175
+
176
+ Top 20 Genres by AVERAGE PLAY COUNT (min 500 tracks):
177
+ Genre Track Count Avg Play Avg Upvote
178
+ ────────────────────────────── ──────────── ──────────── ────────────
179
+ Hardstyle / Hardcore 5,309 1,101 31
180
+ House 29,465 902 41
181
+ Lo-Fi / Chill 22,700 774 34
182
+ Synthwave / Retro 15,836 712 41
183
+ Dubstep / Bass 14,923 693 36
184
+ Jazz 49,325 650 33
185
+ Holiday / Seasonal 2,553 621 35
186
+ 1950s / Doo-Wop 6,768 555 32
187
+ Pop 33,374 546 32
188
+ Grime / UK Garage 18,150 540 34
189
+ Disco / Funk 50,306 523 23
190
+ Goth 11,031 484 37
191
+ Drum & Bass / Jungle 12,022 482 28
192
+ Reggae / Dub 31,288 470 28
193
+ Punk 90,451 460 31
194
+ Opera 17,552 454 32
195
+ Soundtrack / Score 63,235 453 29
196
+ Experimental 33,209 442 23
197
+ Eurodance / Hands Up 4,018 434 27
198
+ Ambient / Drone 71,185 431 30
199
+
200
+ ──────────────────────────────────────────────────────────────────────────────────────────
201
+ 8. SCENE TAG POPULARITY ANALYSIS (Top 25)
202
+ ──────────────────────────────────────────────────────────────────────────────────────────
203
+
204
+ Total unique scene tags: 30
205
+
206
+ Scene Tag Track Count Avg Play Total Play
207
+ ────────────────────────────── ──────────── ──────────── ──────────────
208
+ Menu / UI / Loading 148,295 261 38.67M
209
+ Romantic / Love 51,439 264 13.57M
210
+ Sad / Emotional 50,273 567 28.50M
211
+ Dream / Surreal 38,010 528 20.06M
212
+ Victory / Triumph 30,117 480 14.45M
213
+ Royal / Castle 26,800 234 6.26M
214
+ Magic / Mystical 26,099 316 8.26M
215
+ Tavern / Inn / Festival 25,744 291 7.50M
216
+ Space / Sci-Fi 22,980 305 7.01M
217
+ Town / Market / Hub 19,681 434 8.55M
218
+ Temple / Religious 18,512 216 3.99M
219
+ Ocean / Sailing 14,955 213 3.19M
220
+ Relaxing / Safe Haven 13,655 166 2.27M
221
+ Suspense / Mystery 12,776 262 3.34M
222
+ Weather - Storm 12,400 439 5.44M
223
+ Spooky / Haunted 12,360 618 7.64M
224
+ Defeat / Game Over 11,822 144 1.71M
225
+ Cyberpunk / High-Tech 10,737 287 3.08M
226
+ Forest / Nature 10,481 397 4.16M
227
+ Stealth / Sneaking 10,450 335 3.51M
228
+ Western / Desert 9,758 220 2.15M
229
+ Horror / Terror 8,323 291 2.43M
230
+ Dungeon / Crypt 7,125 232 1.65M
231
+ Battle - Skirmish/Action 6,706 239 1.60M
232
+ Travel / Adventure 6,534 152 994.0K
233
+
234
+ Top 15 Scene Tags by AVERAGE PLAY COUNT (min 200 tracks):
235
+ Scene Tag Track Count Avg Play
236
+ ────────────────────────────── ──────────── ────────────
237
+ Spooky / Haunted 12,360 618
238
+ Sad / Emotional 50,273 567
239
+ Dream / Surreal 38,010 528
240
+ Victory / Triumph 30,117 480
241
+ Weather - Storm 12,400 439
242
+ Town / Market / Hub 19,681 434
243
+ Noir / Jazz Club 2,477 399
244
+ Forest / Nature 10,481 397
245
+ Steampunk / Industrial 1,547 355
246
+ Stealth / Sneaking 10,450 335
247
+ Crafting / Shop 5,857 333
248
+ Magic / Mystical 26,099 316
249
+ Space / Sci-Fi 22,980 305
250
+ Horror / Terror 8,323 291
251
+ Tavern / Inn / Festival 25,744 291
252
+
253
+ ──────────────────────────────────────────────────────────────────────────────────────────
254
+ 9. EMOTION TAG POPULARITY ANALYSIS (Top 25)
255
+ ──────────────────────────────────────────────────────────────────────────────────────────
256
+
257
+ Total unique emotion tags: 39
258
+
259
+ Emotion Track Count Avg Play Total Play
260
+ ────────────────────────────── ──────────── ──────────── ──────────────
261
+ Romance 52,170 314 16.39M
262
+ Excitement 46,745 211 9.88M
263
+ Sadness 40,698 470 19.11M
264
+ Calmness 27,138 411 11.16M
265
+ Amusement 25,886 249 6.46M
266
+ Anger 23,084 370 8.54M
267
+ Nostalgia 19,413 206 4.01M
268
+ Entrancement 14,840 359 5.32M
269
+ Anxiety 14,127 328 4.63M
270
+ Joy 14,120 258 3.64M
271
+ Desire 13,579 183 2.48M
272
+ Sexual Desire 11,842 482 5.71M
273
+ Fear 9,001 224 2.01M
274
+ Pride 6,886 115 790.3K
275
+ Horror 6,151 304 1.87M
276
+ Triumph 5,491 123 675.6K
277
+ Craving 4,551 181 825.7K
278
+ Awe 3,211 146 470.1K
279
+ Adoration 3,199 232 740.8K
280
+ Aesthetic Appreciation 1,894 418 791.8K
281
+ Sympathy 1,748 208 363.9K
282
+ Interest 1,637 91 148.3K
283
+ Contentment 1,473 102 149.8K
284
+ Satisfaction 1,452 52 75.4K
285
+ Dislike 1,165 66 77.0K
286
+
287
+ ──────────────────────────────────────────────────────────────────────────────────────────
288
+ 10. AESTHETIC SCORE DISTRIBUTION (score_average)
289
+ ──────────────────────────────────────────────────────────────────────────────────────────
290
+
291
+ Mean: 3.259
292
+ Median: 3.295
293
+ Std: 0.392
294
+ Min: 1.765
295
+ Max: 4.395
296
+
297
+ Score Range Count % of Total Avg Play
298
+ ──────────── ────────── ────────── ────────────
299
+ <1.5 0 0.0% 0
300
+ 1.5-2.0 259 0.0% 44
301
+ 2.0-2.5 30,938 3.4% 246
302
+ 2.5-3.0 205,019 22.6% 332
303
+ 3.0-3.5 398,431 43.9% 372
304
+ 3.5-4.0 264,631 29.1% 283
305
+ 4.0-4.5 8,963 1.0% 427
306
+ 4.5-5.0 0 0.0% 0
307
+
308
+ ──────────────────────────────────────────────────────────────────────────────────────────
309
+ 11. LYRICS vs INSTRUMENTAL POPULARITY
310
+ ──────────────────────────────────────────────────────────────────────────────────────────
311
+
312
+ Tracks with lyrics: 479,313 (52.8%)
313
+ Instrumental tracks: 428,928 (47.2%)
314
+
315
+ ──────────────────────────────────────────��───────────────────────────────────────────────
316
+ 12. RECOMMENDED BUCKETING STRATEGIES FOR TRAINING
317
+ ──────────────────────────────────────────────────────────────────────────────────────────
318
+
319
+ RECOMMENDATION A: Modified User Buckets (merge sparse high-end buckets)
320
+ ─────────────────────────────────────────────────────────────────
321
+ The user-proposed buckets are good for the low/mid range but the
322
+ 100K-200K and 200K+ buckets may be very sparse. Consider merging
323
+ them into a single '100K+' bucket. If each bucket should have ~10K
324
+ samples, you may also want to split the 0-10 bucket (largest) into
325
+ sub-ranges or oversample it.
326
+
327
+ RECOMMENDATION B: Log-scaled with floor oversample
328
+ ─────────────────────────────────────────────────────────────────
329
+ Since popularity follows a power law, use log10-uniform buckets but
330
+ oversample the 0-play bucket (which represents tracks with no signal).
331
+ Train with focal loss or weighted sampling to handle imbalance.
332
+
333
+ RECOMMENDATION C: Target-transform approach
334
+ ─────────────────────────────────────────────────────────────────
335
+ Instead of discrete buckets, train on log(1 + play_count) as a
336
+ continuous regression target. This naturally compresses the scale.
337
+ The upvote model can similarly use log(1 + upvote_count).
338
+ Bucket only for stratified sampling during training, not as labels.
339
+
340
+ ──────────────────────────────────────────────────────────────────────────────────────────
341
+ 13. FEASIBILITY: 10K SAMPLES PER BUCKET (DOWNLOAD ESTIMATE)
342
+ ──────────────────────────────────────────────────────────────────────────────────────────
343
+
344
+ User-proposed buckets with 10K target per bucket:
345
+ Bucket Available Target Feasible
346
+ ────────────────── ────────── ──────── ──────────
347
+ 0-10 592,886 10,000 YES
348
+ 10-100 207,288 10,000 YES
349
+ 100-1K 83,443 10,000 YES
350
+ 1K-10K 20,973 10,000 YES
351
+ 10K-50K 2,913 10,000 NO (2,913)
352
+ 50K-100K 331 10,000 NO (331)
353
+ 100K-200K 225 10,000 NO (225)
354
+ 200K+ 182 10,000 NO (182)
355
+
356
+ Total tracks to download: ~43,651
357
+ Estimated download size: ~127.9 GB (at ~3MB avg)
358
+
359
+ ==========================================================================================
360
+ END OF REPORT
361
+ ==========================================================================================
public/udio_000032.tar.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d55bc0f54469429277d56c897035b91d18f99b3d0a8ddb4822681e175eb60d04
3
+ size 2679876
search_index/build.log ADDED
@@ -0,0 +1,624 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 05:06:47 [INFO] ============================================================
2
+ 05:06:47 [INFO] ============================================================
3
+ 05:06:47 [INFO] LAION-Tunes Search Index Builder
4
+ 05:06:47 [INFO] LAION-Tunes Search Index Builder
5
+ 05:06:47 [INFO] ============================================================
6
+ 05:06:47 [INFO] ============================================================
7
+ 05:06:47 [INFO] Found 159 private parquets
8
+ 05:06:47 [INFO] Found 159 private parquets
9
+ 05:06:47 [INFO] Found 46 output (annotation) parquets
10
+ 05:06:47 [INFO] Found 46 output (annotation) parquets
11
+ 05:06:47 [INFO] Starting row_id offset: 0
12
+ 05:06:47 [INFO] Starting row_id offset: 0
13
+ 05:06:47 [INFO] Created new FAISS tag index
14
+ 05:06:47 [INFO] Created new FAISS tag index
15
+ 05:06:47 [INFO] Created new FAISS lyric index
16
+ 05:06:47 [INFO] Created new FAISS lyric index
17
+ 05:06:47 [INFO] Created new FAISS mood index
18
+ 05:06:47 [INFO] Created new FAISS mood index
19
+ 05:06:47 [INFO] Created new FAISS caption index
20
+ 05:06:47 [INFO] Created new FAISS caption index
21
+ 05:06:47 [INFO] Created new FAISS transcription index
22
+ 05:06:47 [INFO] Created new FAISS transcription index
23
+ 05:06:47 [INFO] Processing 159 new private parquets (skipping 0 already done)
24
+ 05:06:47 [INFO] Processing 159 new private parquets (skipping 0 already done)
25
+ 05:17:50 [INFO] ============================================================
26
+ 05:17:50 [INFO] ============================================================
27
+ 05:17:50 [INFO] LAION-Tunes Search Index Builder
28
+ 05:17:50 [INFO] LAION-Tunes Search Index Builder
29
+ 05:17:50 [INFO] ============================================================
30
+ 05:17:50 [INFO] ============================================================
31
+ 05:17:50 [INFO] Force rebuild requested - starting fresh
32
+ 05:17:50 [INFO] Force rebuild requested - starting fresh
33
+ 05:17:50 [INFO] Found 159 private parquets
34
+ 05:17:50 [INFO] Found 159 private parquets
35
+ 05:17:50 [INFO] Found 47 output (annotation) parquets
36
+ 05:17:50 [INFO] Found 47 output (annotation) parquets
37
+ 05:17:50 [INFO] Starting row_id offset: 0
38
+ 05:17:50 [INFO] Starting row_id offset: 0
39
+ 05:17:50 [INFO] Created new FAISS tag index
40
+ 05:17:50 [INFO] Created new FAISS tag index
41
+ 05:17:50 [INFO] Created new FAISS lyric index
42
+ 05:17:50 [INFO] Created new FAISS lyric index
43
+ 05:17:50 [INFO] Created new FAISS mood index
44
+ 05:17:50 [INFO] Created new FAISS mood index
45
+ 05:17:50 [INFO] Created new FAISS caption index
46
+ 05:17:50 [INFO] Created new FAISS caption index
47
+ 05:17:50 [INFO] Created new FAISS transcription index
48
+ 05:17:50 [INFO] Created new FAISS transcription index
49
+ 05:17:50 [INFO] Processing 159 new private parquets (skipping 0 already done)
50
+ 05:17:50 [INFO] Processing 159 new private parquets (skipping 0 already done)
51
+ 05:18:06 [INFO] [10/159] mureka_000009.tar.parquet: 6479 rows, total=64,612, 4008 rows/s, ETA: 0:04:00
52
+ 05:18:06 [INFO] [10/159] mureka_000009.tar.parquet: 6479 rows, total=64,612, 4008 rows/s, ETA: 0:04:00
53
+ 05:18:23 [INFO] [20/159] mureka_000019.tar.parquet: 7012 rows, total=131,907, 4022 rows/s, ETA: 0:04:02
54
+ 05:18:23 [INFO] [20/159] mureka_000019.tar.parquet: 7012 rows, total=131,907, 4022 rows/s, ETA: 0:04:02
55
+ 05:18:40 [INFO] [30/159] mureka_000029.tar.parquet: 6836 rows, total=199,935, 4000 rows/s, ETA: 0:03:40
56
+ 05:18:40 [INFO] [30/159] mureka_000029.tar.parquet: 6836 rows, total=199,935, 4000 rows/s, ETA: 0:03:40
57
+ 05:19:01 [INFO] [40/159] mureka_000039.tar.parquet: 11439 rows, total=288,781, 4063 rows/s, ETA: 0:05:35
58
+ 05:19:01 [INFO] [40/159] mureka_000039.tar.parquet: 11439 rows, total=288,781, 4063 rows/s, ETA: 0:05:35
59
+ 05:19:38 [INFO] [50/159] riffusion_000000.tar.parquet: 7478 rows, total=391,094, 3642 rows/s, ETA: 0:03:43
60
+ 05:19:38 [INFO] [50/159] riffusion_000000.tar.parquet: 7478 rows, total=391,094, 3642 rows/s, ETA: 0:03:43
61
+ 05:21:35 [INFO] [60/159] riffusion_000010.tar.parquet: 7461 rows, total=465,899, 2076 rows/s, ETA: 0:05:55
62
+ 05:21:35 [INFO] [60/159] riffusion_000010.tar.parquet: 7461 rows, total=465,899, 2076 rows/s, ETA: 0:05:55
63
+ 05:22:19 [INFO] [70/159] suno_000005.tar.parquet: 4746 rows, total=513,585, 1908 rows/s, ETA: 0:03:41
64
+ 05:22:19 [INFO] [70/159] suno_000005.tar.parquet: 4746 rows, total=513,585, 1908 rows/s, ETA: 0:03:41
65
+ 05:22:47 [INFO] [80/159] suno_000015.tar.parquet: 4829 rows, total=561,325, 1891 rows/s, ETA: 0:03:21
66
+ 05:22:47 [INFO] [80/159] suno_000015.tar.parquet: 4829 rows, total=561,325, 1891 rows/s, ETA: 0:03:21
67
+ 05:23:17 [INFO] [90/159] suno_000025.tar.parquet: 4743 rows, total=608,541, 1862 rows/s, ETA: 0:02:55
68
+ 05:23:17 [INFO] [90/159] suno_000025.tar.parquet: 4743 rows, total=608,541, 1862 rows/s, ETA: 0:02:55
69
+ 05:23:50 [INFO] [100/159] suno_000035.tar.parquet: 4719 rows, total=655,939, 1823 rows/s, ETA: 0:02:32
70
+ 05:23:50 [INFO] [100/159] suno_000035.tar.parquet: 4719 rows, total=655,939, 1823 rows/s, ETA: 0:02:32
71
+ 05:24:23 [INFO] [110/159] suno_000045.tar.parquet: 4763 rows, total=704,245, 1792 rows/s, ETA: 0:02:10
72
+ 05:24:23 [INFO] [110/159] suno_000045.tar.parquet: 4763 rows, total=704,245, 1792 rows/s, ETA: 0:02:10
73
+ 05:24:40 [INFO] [120/159] suno_000055.tar.parquet: 4886 rows, total=752,473, 1837 rows/s, ETA: 0:01:43
74
+ 05:24:40 [INFO] [120/159] suno_000055.tar.parquet: 4886 rows, total=752,473, 1837 rows/s, ETA: 0:01:43
75
+ 05:24:53 [INFO] [130/159] udio_000000.tar.parquet: 3387 rows, total=796,488, 1883 rows/s, ETA: 0:00:52
76
+ 05:24:53 [INFO] [130/159] udio_000000.tar.parquet: 3387 rows, total=796,488, 1883 rows/s, ETA: 0:00:52
77
+ 05:25:05 [INFO] [140/159] udio_000012.tar.parquet: 3755 rows, total=833,523, 1916 rows/s, ETA: 0:00:37
78
+ 05:25:05 [INFO] [140/159] udio_000012.tar.parquet: 3755 rows, total=833,523, 1916 rows/s, ETA: 0:00:37
79
+ 05:25:19 [INFO] [150/159] udio_000023.tar.parquet: 4043 rows, total=874,373, 1949 rows/s, ETA: 0:00:18
80
+ 05:25:19 [INFO] [150/159] udio_000023.tar.parquet: 4043 rows, total=874,373, 1949 rows/s, ETA: 0:00:18
81
+ 05:25:30 [INFO] [159/159] udio_000032.tar.parquet: 209 rows, total=908,241, 1975 rows/s, ETA: 0:00:00
82
+ 05:25:30 [INFO] [159/159] udio_000032.tar.parquet: 209 rows, total=908,241, 1975 rows/s, ETA: 0:00:00
83
+ 05:25:30 [INFO]
84
+ Inserted 908,241 new rows (total: 908,241)
85
+ 05:25:30 [INFO]
86
+ Inserted 908,241 new rows (total: 908,241)
87
+ 05:25:30 [INFO] Saving FAISS indices...
88
+ 05:25:30 [INFO] Saving FAISS indices...
89
+ 05:25:32 [INFO] tag: 908,241 vectors
90
+ 05:25:32 [INFO] tag: 908,241 vectors
91
+ 05:25:32 [INFO] lyric: 479,313 vectors
92
+ 05:25:32 [INFO] lyric: 479,313 vectors
93
+ 05:25:33 [INFO] mood: 383,616 vectors
94
+ 05:25:33 [INFO] mood: 383,616 vectors
95
+ 05:25:33 [INFO] caption: 223,415 vectors
96
+ 05:25:33 [INFO] caption: 223,415 vectors
97
+ 05:25:33 [INFO] transcription: 189,398 vectors
98
+ 05:25:33 [INFO] transcription: 189,398 vectors
99
+ 05:25:33 [INFO] Building BM25 indices...
100
+ 05:25:33 [INFO] Building BM25 indices...
101
+ 05:25:46 [INFO] tags: 908,241 documents, 164,817 unique tokens
102
+ 05:25:46 [INFO] tags: 908,241 documents, 164,817 unique tokens
103
+ 05:26:03 [INFO] caption: 223,415 documents, 5,755 unique tokens
104
+ 05:26:03 [INFO] caption: 223,415 documents, 5,755 unique tokens
105
+ 05:26:28 [INFO] transcription: 189,398 documents, 875,770 unique tokens
106
+ 05:26:28 [INFO] transcription: 189,398 documents, 875,770 unique tokens
107
+ 05:26:28 [INFO] lyrics_hashed: 0 documents (skipped)
108
+ 05:26:28 [INFO] lyrics_hashed: 0 documents (skipped)
109
+ 05:26:28 [INFO]
110
+ Done in 0:08:38
111
+ 05:26:28 [INFO]
112
+ Done in 0:08:38
113
+ 05:26:28 [INFO] Index directory: /home/deployer/laion/music/laion-tunes-final/search_index
114
+ 05:26:28 [INFO] Index directory: /home/deployer/laion/music/laion-tunes-final/search_index
115
+ 05:26:28 [INFO] Total tracks: 908,241
116
+ 05:26:28 [INFO] Total tracks: 908,241
117
+ 05:26:28 [INFO] FAISS tag: 908,241 vectors (2661 MB)
118
+ 05:26:28 [INFO] FAISS tag: 908,241 vectors (2661 MB)
119
+ 05:26:28 [INFO] FAISS lyric: 479,313 vectors (1404 MB)
120
+ 05:26:28 [INFO] FAISS lyric: 479,313 vectors (1404 MB)
121
+ 05:26:28 [INFO] FAISS mood: 383,616 vectors (1124 MB)
122
+ 05:26:28 [INFO] FAISS mood: 383,616 vectors (1124 MB)
123
+ 05:26:28 [INFO] FAISS caption: 223,415 vectors (655 MB)
124
+ 05:26:28 [INFO] FAISS caption: 223,415 vectors (655 MB)
125
+ 05:26:28 [INFO] FAISS transcription: 189,398 vectors (555 MB)
126
+ 05:26:28 [INFO] FAISS transcription: 189,398 vectors (555 MB)
127
+ 05:26:28 [INFO] SQLite: 1327 MB
128
+ 05:26:28 [INFO] SQLite: 1327 MB
129
+ 06:39:56 [INFO] Loading search indices...
130
+ 06:39:57 [INFO] FAISS tag: 908,241 vectors
131
+ 06:39:58 [INFO] FAISS lyric: 479,313 vectors
132
+ 06:39:58 [INFO] FAISS mood: 383,616 vectors
133
+ 06:39:59 [INFO] FAISS caption: 223,415 vectors
134
+ 06:39:59 [INFO] FAISS transcription: 189,398 vectors
135
+ 06:39:59 [INFO] BM25 tags: 908,241 documents
136
+ 06:39:59 [INFO] BM25 caption: 223,415 documents
137
+ 06:39:59 [INFO] BM25 transcription: 189,398 documents
138
+ 06:39:59 [INFO] BM25 lyrics_hashed: not found (skipped)
139
+ 06:39:59 [INFO] SQLite: 908,174 tracks
140
+ 06:39:59 [INFO] Loading EmbeddingGemma 300M on GPU 0...
141
+ 06:40:07 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
142
+ 08:50:24 [INFO] Loading search indices...
143
+ 08:50:26 [INFO] FAISS tag: 908,241 vectors
144
+ 08:50:26 [INFO] FAISS lyric: 479,313 vectors
145
+ 08:50:27 [INFO] FAISS mood: 383,616 vectors
146
+ 08:50:27 [INFO] FAISS caption: 223,415 vectors
147
+ 08:50:28 [INFO] FAISS transcription: 189,398 vectors
148
+ 08:50:28 [INFO] BM25 tags: 908,241 documents
149
+ 08:50:28 [INFO] BM25 caption: 223,415 documents
150
+ 08:50:28 [INFO] BM25 transcription: 189,398 documents
151
+ 08:50:28 [INFO] BM25 lyrics_hashed: not found (skipped)
152
+ 08:50:28 [INFO] SQLite: 908,174 tracks
153
+ 08:50:28 [INFO] Loading EmbeddingGemma 300M on GPU 0...
154
+ 08:50:36 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
155
+ 08:50:41 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
156
+ 08:50:41 [INFO] EmbeddingGemma loaded on cuda:0
157
+ 09:48:56 [INFO] Loading search indices...
158
+ 09:48:58 [INFO] FAISS tag: 908,241 vectors
159
+ 09:48:59 [INFO] FAISS lyric: 479,313 vectors
160
+ 09:49:00 [INFO] FAISS mood: 383,616 vectors
161
+ 09:49:00 [INFO] FAISS caption: 223,415 vectors
162
+ 09:49:00 [INFO] FAISS transcription: 189,398 vectors
163
+ 09:49:00 [INFO] BM25 tags: 908,241 documents
164
+ 09:49:00 [INFO] BM25 caption: 223,415 documents
165
+ 09:49:01 [INFO] BM25 transcription: 189,398 documents
166
+ 09:49:01 [INFO] BM25 lyrics_hashed: not found (skipped)
167
+ 09:49:01 [INFO] SQLite: 908,174 tracks
168
+ 09:49:01 [INFO] Loading EmbeddingGemma 300M on GPU 0...
169
+ 09:49:08 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
170
+ 09:49:11 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
171
+ 09:49:11 [INFO] EmbeddingGemma loaded on cuda:0
172
+ 14:39:24 [INFO] ============================================================
173
+ 14:39:24 [INFO] Updating search indices with new annotation data
174
+ 14:39:24 [INFO] ============================================================
175
+ 14:39:24 [INFO] Found 64 output parquets
176
+ 14:39:25 [INFO] Current DB: 908,174 tracks, 223,415 captions, 189,398 transcriptions
177
+ 14:39:25 [INFO] Building audio_url lookup for tracks needing updates...
178
+ 14:39:27 [INFO] Tracks needing caption: 684,759
179
+ 14:39:27 [INFO] Tracks needing transcription: 718,776
180
+ 14:39:32 [INFO] [10/64] Processed suno_suno_000009.parquet | +0 captions, +0 transcriptions
181
+ 14:39:37 [INFO] [20/64] Processed suno_suno_000019.parquet | +0 captions, +0 transcriptions
182
+ 14:39:41 [INFO] [30/64] Processed suno_suno_000029.parquet | +0 captions, +0 transcriptions
183
+ 14:39:46 [INFO] [40/64] Processed suno_suno_000039.parquet | +0 captions, +0 transcriptions
184
+ 14:39:51 [INFO] [50/64] Processed suno_suno_000049.parquet | +14,381 captions, +12,235 transcriptions
185
+ 14:39:57 [INFO] [60/64] Processed suno_suno_000059.parquet | +62,607 captions, +53,270 transcriptions
186
+ 14:39:59 [INFO] [64/64] Processed suno_suno_000063.parquet | +81,292 captions, +68,409 transcriptions
187
+ 14:39:59 [INFO]
188
+ SQLite updated: +81,292 captions, +68,409 transcriptions
189
+ 14:40:00 [INFO] Captions: 223,415 -> 304,707
190
+ 14:40:00 [INFO] Transcriptions: 189,398 -> 257,807
191
+ 14:40:00 [INFO]
192
+ Rebuilding FAISS caption & transcription indices from all output parquets...
193
+ 14:40:06 [INFO] [10/64] FAISS caption: 47,011, transcription: 40,076
194
+ 14:40:11 [INFO] [20/64] FAISS caption: 94,624, transcription: 80,368
195
+ 14:40:17 [INFO] [30/64] FAISS caption: 141,990, transcription: 120,199
196
+ 14:40:23 [INFO] [40/64] FAISS caption: 190,030, transcription: 160,867
197
+ 14:40:29 [INFO] [50/64] FAISS caption: 237,796, transcription: 201,633
198
+ 14:40:35 [INFO] [60/64] FAISS caption: 286,022, transcription: 242,668
199
+ 14:40:37 [INFO] [64/64] FAISS caption: 304,707, transcription: 257,807
200
+ 14:40:37 [INFO]
201
+ Saving FAISS caption index: 304,707 vectors
202
+ 14:40:38 [INFO] Saving FAISS transcription index: 257,807 vectors
203
+ 14:40:39 [INFO]
204
+ Rebuilding all BM25 indices from database...
205
+ 14:41:28 [INFO] BM25 tags: 908,174 docs, 164,817 tokens
206
+ 14:41:53 [INFO] BM25 caption: 304,707 docs, 6,335 tokens
207
+ 14:42:24 [INFO] BM25 transcription: 257,807 docs, 1,142,621 tokens
208
+ 14:42:24 [INFO] BM25 lyrics_hashed: 0 docs (skipped)
209
+ 14:42:24 [INFO]
210
+ Detecting language for new transcriptions...
211
+ 14:42:25 [INFO] 162,844 rows need language detection
212
+ 14:48:42 [INFO] Updated language for 162,718 rows
213
+ 14:48:42 [INFO] Updating instrumental flags...
214
+ 14:48:44 [INFO] Instrumental tracks: 650,490
215
+ 14:48:44 [INFO]
216
+ Done in 0:09:20
217
+ 14:48:44 [INFO] Restart the server to load the updated indices.
218
+ 14:50:03 [INFO] Loading search indices...
219
+ 14:50:04 [INFO] FAISS tag: 908,241 vectors
220
+ 14:50:05 [INFO] FAISS lyric: 479,313 vectors
221
+ 14:50:06 [INFO] FAISS mood: 383,616 vectors
222
+ 14:50:06 [INFO] FAISS caption: 304,707 vectors
223
+ 14:50:06 [INFO] FAISS transcription: 257,807 vectors
224
+ 14:50:06 [INFO] BM25 tags: 908,174 documents
225
+ 14:50:07 [INFO] BM25 caption: 304,707 documents
226
+ 14:50:07 [INFO] BM25 transcription: 257,807 documents
227
+ 14:50:07 [INFO] BM25 lyrics_hashed: not found (skipped)
228
+ 14:50:07 [INFO] SQLite: 908,174 tracks
229
+ 14:50:07 [INFO] Loading EmbeddingGemma 300M on GPU 0...
230
+ 14:50:14 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
231
+ 14:50:17 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
232
+ 14:50:17 [INFO] EmbeddingGemma loaded on cuda:0
233
+ 15:05:52 [INFO] Loading search indices...
234
+ 15:05:53 [INFO] FAISS tag: 908,241 vectors
235
+ 15:05:53 [INFO] FAISS lyric: 479,313 vectors
236
+ 15:05:54 [INFO] FAISS mood: 383,616 vectors
237
+ 15:05:54 [INFO] FAISS caption: 304,707 vectors
238
+ 15:05:55 [INFO] FAISS transcription: 257,807 vectors
239
+ 15:05:55 [INFO] BM25 tags: 908,174 documents
240
+ 15:05:55 [INFO] BM25 caption: 304,707 documents
241
+ 15:05:56 [INFO] BM25 transcription: 257,807 documents
242
+ 15:05:56 [INFO] BM25 lyrics_hashed: not found (skipped)
243
+ 15:05:56 [INFO] SQLite: 908,174 tracks
244
+ 15:05:56 [INFO] Loading EmbeddingGemma 300M on GPU 0...
245
+ 15:06:03 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
246
+ 15:06:06 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
247
+ 15:06:06 [INFO] EmbeddingGemma loaded on cuda:0
248
+ 15:09:36 [INFO] Loading search indices...
249
+ 15:09:37 [INFO] FAISS tag: 908,241 vectors
250
+ 15:09:38 [INFO] FAISS lyric: 479,313 vectors
251
+ 15:09:39 [INFO] FAISS mood: 383,616 vectors
252
+ 15:09:39 [INFO] FAISS caption: 304,707 vectors
253
+ 15:09:40 [INFO] FAISS transcription: 257,807 vectors
254
+ 15:09:40 [INFO] BM25 tags: 908,174 documents
255
+ 15:09:40 [INFO] BM25 caption: 304,707 documents
256
+ 15:09:40 [INFO] BM25 transcription: 257,807 documents
257
+ 15:09:40 [INFO] BM25 lyrics_hashed: not found (skipped)
258
+ 15:09:40 [INFO] SQLite: 908,174 tracks
259
+ 15:09:40 [INFO] Loading EmbeddingGemma 300M on GPU 0...
260
+ 15:09:48 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
261
+ 15:09:50 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
262
+ 15:09:50 [INFO] EmbeddingGemma loaded on cuda:0
263
+ 15:17:43 [INFO] Loading search indices...
264
+ 15:17:44 [INFO] FAISS tag: 908,241 vectors
265
+ 15:17:45 [INFO] FAISS lyric: 479,313 vectors
266
+ 15:17:45 [INFO] FAISS mood: 383,616 vectors
267
+ 15:17:46 [INFO] FAISS caption: 304,707 vectors
268
+ 15:17:46 [INFO] FAISS transcription: 257,807 vectors
269
+ 15:17:46 [INFO] BM25 tags: 908,174 documents
270
+ 15:17:46 [INFO] BM25 caption: 304,707 documents
271
+ 15:17:47 [INFO] BM25 transcription: 257,807 documents
272
+ 15:17:47 [INFO] BM25 lyrics_hashed: not found (skipped)
273
+ 15:17:47 [INFO] SQLite: 908,174 tracks
274
+ 15:17:47 [INFO] Loading EmbeddingGemma 300M on GPU 0...
275
+ 15:17:53 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
276
+ 15:17:56 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
277
+ 15:17:56 [INFO] EmbeddingGemma loaded on cuda:0
278
+ 06:25:39 [INFO] ============================================================
279
+ 06:25:39 [INFO] Updating search indices with new annotation data
280
+ 06:25:39 [INFO] ============================================================
281
+ 06:25:39 [INFO] Found 100 output parquets
282
+ 06:25:40 [INFO] Current DB: 908,174 tracks, 304,707 captions, 257,807 transcriptions
283
+ 06:25:40 [INFO] Building audio_url lookup for tracks needing updates...
284
+ 06:25:42 [INFO] Tracks needing caption: 603,467
285
+ 06:25:42 [INFO] Tracks needing transcription: 650,367
286
+ 06:25:47 [INFO] [10/100] Processed suno_suno_000007.parquet | +12,846 captions, +11,851 transcriptions
287
+ 06:25:52 [INFO] [20/100] Processed suno_suno_000017.parquet | +12,846 captions, +11,851 transcriptions
288
+ 06:25:56 [INFO] [30/100] Processed suno_suno_000027.parquet | +12,846 captions, +11,851 transcriptions
289
+ 06:26:01 [INFO] [40/100] Processed suno_suno_000037.parquet | +12,846 captions, +11,851 transcriptions
290
+ 06:26:06 [INFO] [50/100] Processed suno_suno_000047.parquet | +12,846 captions, +11,851 transcriptions
291
+ 06:26:11 [INFO] [60/100] Processed suno_suno_000057.parquet | +12,846 captions, +11,851 transcriptions
292
+ 06:26:15 [INFO] [70/100] Processed udio_udio_000002.parquet | +26,016 captions, +22,523 transcriptions
293
+ 06:26:20 [INFO] [80/100] Processed udio_udio_000012.parquet | +56,100 captions, +47,203 transcriptions
294
+ 06:26:25 [INFO] [90/100] Processed udio_udio_000022.parquet | +92,907 captions, +77,389 transcriptions
295
+ 06:26:29 [INFO] [100/100] Processed udio_udio_000032.parquet | +130,818 captions, +108,278 transcriptions
296
+ 06:26:29 [INFO]
297
+ SQLite updated: +130,818 captions, +108,278 transcriptions
298
+ 06:26:30 [INFO] Captions: 304,707 -> 435,525
299
+ 06:26:30 [INFO] Transcriptions: 257,807 -> 366,085
300
+ 06:26:30 [INFO]
301
+ Rebuilding FAISS caption & transcription indices from all output parquets...
302
+ 06:26:36 [INFO] [10/100] FAISS caption: 50,389, transcription: 43,884
303
+ 06:26:42 [INFO] [20/100] FAISS caption: 98,015, transcription: 84,404
304
+ 06:26:48 [INFO] [30/100] FAISS caption: 145,350, transcription: 124,118
305
+ 06:26:54 [INFO] [40/100] FAISS caption: 193,048, transcription: 164,310
306
+ 06:27:00 [INFO] [50/100] FAISS caption: 241,051, transcription: 205,349
307
+ 06:27:05 [INFO] [60/100] FAISS caption: 289,506, transcription: 246,710
308
+ 06:27:11 [INFO] [70/100] FAISS caption: 330,723, transcription: 280,330
309
+ 06:27:14 [INFO] [80/100] FAISS caption: 360,807, transcription: 305,010
310
+ 06:27:19 [INFO] [90/100] FAISS caption: 397,614, transcription: 335,196
311
+ 06:27:23 [INFO] [100/100] FAISS caption: 435,525, transcription: 366,085
312
+ 06:27:23 [INFO]
313
+ Saving FAISS caption index: 435,525 vectors
314
+ 06:27:25 [INFO] Saving FAISS transcription index: 366,085 vectors
315
+ 06:27:26 [INFO]
316
+ Rebuilding all BM25 indices from database...
317
+ 06:28:24 [INFO] BM25 tags: 908,174 docs, 164,817 tokens
318
+ 06:28:55 [INFO] BM25 caption: 435,525 docs, 7,222 tokens
319
+ 06:29:34 [INFO] BM25 transcription: 366,085 docs, 1,271,671 tokens
320
+ 06:29:34 [INFO] BM25 lyrics_hashed: 0 docs (skipped)
321
+ 06:29:34 [INFO]
322
+ Detecting language for new transcriptions...
323
+ 06:29:34 [INFO] 108,404 rows need language detection
324
+ 06:32:51 [INFO] Updated language for 108,176 rows
325
+ 06:32:51 [INFO] Updating instrumental flags...
326
+ 06:32:54 [INFO] Instrumental tracks: 542,314
327
+ 06:32:54 [INFO]
328
+ Done in 0:07:14
329
+ 06:32:54 [INFO] Restart the server to load the updated indices.
330
+ 06:34:26 [INFO] Loading search indices...
331
+ 06:34:27 [INFO] FAISS tag: 908,241 vectors
332
+ 06:34:28 [INFO] FAISS lyric: 479,313 vectors
333
+ 06:34:29 [INFO] FAISS mood: 383,616 vectors
334
+ 06:34:29 [INFO] FAISS caption: 435,525 vectors
335
+ 06:34:30 [INFO] FAISS transcription: 366,085 vectors
336
+ 06:34:30 [INFO] BM25 tags: 908,174 documents
337
+ 06:34:30 [INFO] BM25 caption: 435,525 documents
338
+ 06:34:30 [INFO] BM25 transcription: 366,085 documents
339
+ 06:34:30 [INFO] BM25 lyrics_hashed: not found (skipped)
340
+ 06:34:30 [INFO] SQLite: 908,174 tracks
341
+ 06:34:30 [INFO] Loading EmbeddingGemma 300M on GPU 0...
342
+ 06:34:38 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
343
+ 06:34:41 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
344
+ 06:34:41 [INFO] EmbeddingGemma loaded on cuda:0
345
+ 08:07:57 [INFO] ============================================================
346
+ 08:07:57 [INFO] Updating search indices with new annotation data
347
+ 08:07:57 [INFO] ============================================================
348
+ 08:07:57 [INFO] Found 163 output parquets
349
+ 08:07:58 [INFO] Current DB: 908,174 tracks, 435,525 captions, 366,085 transcriptions
350
+ 08:07:58 [INFO] Building audio_url lookup for tracks needing updates...
351
+ 08:08:00 [INFO] Tracks needing caption: 472,649
352
+ 08:08:00 [INFO] Tracks needing transcription: 542,089
353
+ 08:08:06 [INFO] [10/163] Processed mureka_mureka_000009.parquet | +51,768 captions, +47,726 transcriptions
354
+ 08:08:12 [INFO] [20/163] Processed mureka_mureka_000019.parquet | +109,879 captions, +81,592 transcriptions
355
+ 08:08:17 [INFO] [30/163] Processed mureka_mureka_000029.parquet | +162,145 captions, +96,130 transcriptions
356
+ 08:08:25 [INFO] [40/163] Processed mureka_mureka_000039.parquet | +228,070 captions, +115,240 transcriptions
357
+ 08:08:35 [INFO] [50/163] Processed riffusion_riffusion_000000.parquet | +304,623 captions, +136,881 transcriptions
358
+ 08:08:43 [INFO] [60/163] Processed riffusion_riffusion_000010.parquet | +378,116 captions, +145,795 transcriptions
359
+ 08:08:49 [INFO] [70/163] Processed suno_suno_000004.parquet | +397,475 captions, +148,126 transcriptions
360
+ 08:08:54 [INFO] [80/163] Processed suno_suno_000014.parquet | +397,475 captions, +148,126 transcriptions
361
+ 08:08:59 [INFO] [90/163] Processed suno_suno_000024.parquet | +397,475 captions, +148,126 transcriptions
362
+ 08:09:04 [INFO] [100/163] Processed suno_suno_000034.parquet | +397,475 captions, +148,126 transcriptions
363
+ 08:09:09 [INFO] [110/163] Processed suno_suno_000044.parquet | +397,475 captions, +148,126 transcriptions
364
+ 08:09:14 [INFO] [120/163] Processed suno_suno_000054.parquet | +397,475 captions, +148,126 transcriptions
365
+ 08:09:17 [INFO] [130/163] Processed suno_suno_000064.parquet | +397,475 captions, +148,126 transcriptions
366
+ 08:09:20 [INFO] [140/163] Processed udio_udio_000009.parquet | +397,475 captions, +148,126 transcriptions
367
+ 08:09:23 [INFO] [150/163] Processed udio_udio_000019.parquet | +397,475 captions, +148,126 transcriptions
368
+ 08:09:26 [INFO] [160/163] Processed udio_udio_000029.parquet | +397,475 captions, +148,126 transcriptions
369
+ 08:09:27 [INFO] [163/163] Processed udio_udio_000032.parquet | +397,475 captions, +148,126 transcriptions
370
+ 08:09:27 [INFO]
371
+ SQLite updated: +397,475 captions, +148,126 transcriptions
372
+ 08:09:28 [INFO] Captions: 435,525 -> 832,944
373
+ 08:09:28 [INFO] Transcriptions: 366,085 -> 514,203
374
+ 08:09:28 [INFO]
375
+ Rebuilding FAISS caption & transcription indices from all output parquets...
376
+ 08:09:34 [INFO] [10/163] FAISS caption: 64,614, transcription: 59,577
377
+ 08:09:39 [INFO] [20/163] FAISS caption: 119,762, transcription: 93,119
378
+ 08:09:44 [INFO] [30/163] FAISS caption: 167,165, transcription: 107,127
379
+ 08:09:49 [INFO] [40/163] FAISS caption: 224,029, transcription: 125,404
380
+ 08:09:57 [INFO] [50/163] FAISS caption: 289,465, transcription: 146,141
381
+ 08:10:04 [INFO] [60/163] FAISS caption: 358,160, transcription: 155,047
382
+ 08:10:10 [INFO] [70/163] FAISS caption: 399,456, transcription: 177,220
383
+ 08:10:16 [INFO] [80/163] FAISS caption: 447,113, transcription: 217,934
384
+ 08:10:22 [INFO] [90/163] FAISS caption: 494,415, transcription: 257,780
385
+ 08:10:28 [INFO] [100/163] FAISS caption: 541,837, transcription: 297,257
386
+ 08:10:34 [INFO] [110/163] FAISS caption: 590,099, transcription: 338,537
387
+ 08:10:40 [INFO] [120/163] FAISS caption: 638,204, transcription: 379,841
388
+ 08:10:46 [INFO] [130/163] FAISS caption: 683,718, transcription: 417,468
389
+ 08:10:51 [INFO] [140/163] FAISS caption: 716,565, transcription: 444,277
390
+ 08:10:54 [INFO] ============================================================
391
+ 08:10:54 [INFO] Updating search indices with new annotation data
392
+ 08:10:54 [INFO] ============================================================
393
+ 08:10:54 [INFO] Found 163 output parquets
394
+ 08:10:55 [INFO] Current DB: 908,174 tracks, 832,944 captions, 514,203 transcriptions
395
+ 08:10:55 [INFO] Building audio_url lookup for tracks needing updates...
396
+ 08:10:55 [INFO] [150/163] FAISS caption: 748,649, transcription: 470,637
397
+ 08:10:57 [INFO] Tracks needing caption: 75,230
398
+ 08:10:57 [INFO] Tracks needing transcription: 393,971
399
+ 08:11:00 [INFO] [160/163] FAISS caption: 790,803, transcription: 505,267
400
+ 08:11:01 [INFO] [163/163] FAISS caption: 798,858, transcription: 511,610
401
+ 08:11:01 [INFO]
402
+ Saving FAISS caption index: 798,858 vectors
403
+ 08:11:03 [INFO] [10/163] Processed mureka_mureka_000009.parquet | +0 captions, +0 transcriptions
404
+ 08:11:03 [INFO] Saving FAISS transcription index: 511,610 vectors
405
+ 08:11:05 [INFO]
406
+ Rebuilding all BM25 indices from database...
407
+ 08:11:09 [INFO] [20/163] Processed mureka_mureka_000019.parquet | +0 captions, +0 transcriptions
408
+ 08:11:14 [INFO] [30/163] Processed mureka_mureka_000029.parquet | +0 captions, +0 transcriptions
409
+ 08:11:20 [INFO] [40/163] Processed mureka_mureka_000039.parquet | +0 captions, +0 transcriptions
410
+ 08:11:26 [INFO] [50/163] Processed riffusion_riffusion_000000.parquet | +0 captions, +0 transcriptions
411
+ 08:11:30 [INFO] [60/163] Processed riffusion_riffusion_000010.parquet | +0 captions, +0 transcriptions
412
+ 08:11:35 [INFO] [70/163] Processed suno_suno_000004.parquet | +0 captions, +0 transcriptions
413
+ 08:11:39 [INFO] [80/163] Processed suno_suno_000014.parquet | +0 captions, +0 transcriptions
414
+ 08:11:44 [INFO] [90/163] Processed suno_suno_000024.parquet | +0 captions, +0 transcriptions
415
+ 08:11:48 [INFO] [100/163] Processed suno_suno_000034.parquet | +0 captions, +0 transcriptions
416
+ 08:11:53 [INFO] [110/163] Processed suno_suno_000044.parquet | +0 captions, +0 transcriptions
417
+ 08:11:58 [INFO] [120/163] Processed suno_suno_000054.parquet | +0 captions, +0 transcriptions
418
+ 08:12:02 [INFO] [130/163] Processed suno_suno_000064.parquet | +0 captions, +0 transcriptions
419
+ 08:12:05 [INFO] [140/163] Processed udio_udio_000009.parquet | +0 captions, +0 transcriptions
420
+ 08:12:09 [INFO] [150/163] Processed udio_udio_000019.parquet | +0 captions, +0 transcriptions
421
+ 08:12:13 [INFO] [160/163] Processed udio_udio_000029.parquet | +0 captions, +0 transcriptions
422
+ 08:12:13 [INFO] [163/163] Processed udio_udio_000032.parquet | +0 captions, +0 transcriptions
423
+ 08:12:13 [INFO]
424
+ SQLite updated: +0 captions, +0 transcriptions
425
+ 08:12:15 [INFO] Captions: 832,944 -> 832,944
426
+ 08:12:15 [INFO] Transcriptions: 514,203 -> 514,203
427
+ 08:12:15 [INFO]
428
+ Rebuilding FAISS caption & transcription indices from all output parquets...
429
+ 08:12:22 [INFO] [10/163] FAISS caption: 64,614, transcription: 59,577
430
+ 08:12:23 [INFO] BM25 tags: 908,174 docs, 164,817 tokens
431
+ 08:12:29 [INFO] [20/163] FAISS caption: 119,762, transcription: 93,119
432
+ 08:12:34 [INFO] [30/163] FAISS caption: 167,165, transcription: 107,127
433
+ 08:12:41 [INFO] [40/163] FAISS caption: 224,029, transcription: 125,404
434
+ 08:12:49 [INFO] [50/163] FAISS caption: 289,465, transcription: 146,141
435
+ 08:12:56 [INFO] [60/163] FAISS caption: 358,160, transcription: 155,047
436
+ 08:13:01 [INFO] [70/163] FAISS caption: 399,456, transcription: 177,220
437
+ 08:13:07 [INFO] [80/163] FAISS caption: 447,113, transcription: 217,934
438
+ 08:13:12 [INFO] [90/163] FAISS caption: 494,415, transcription: 257,780
439
+ 08:13:17 [INFO] [100/163] FAISS caption: 541,837, transcription: 297,257
440
+ 08:13:18 [INFO] BM25 caption: 832,944 docs, 8,708 tokens
441
+ 08:13:23 [INFO] [110/163] FAISS caption: 590,099, transcription: 338,537
442
+ 08:13:29 [INFO] [120/163] FAISS caption: 638,204, transcription: 379,841
443
+ 08:13:34 [INFO] [130/163] FAISS caption: 683,718, transcription: 417,468
444
+ 08:13:39 [INFO] [140/163] FAISS caption: 716,565, transcription: 444,277
445
+ 08:13:43 [INFO] [150/163] FAISS caption: 748,649, transcription: 470,637
446
+ 08:13:47 [INFO] [160/163] FAISS caption: 790,803, transcription: 505,267
447
+ 08:13:48 [INFO] [163/163] FAISS caption: 798,858, transcription: 511,610
448
+ 08:13:48 [INFO]
449
+ Saving FAISS caption index: 798,858 vectors
450
+ 08:13:51 [INFO] Saving FAISS transcription index: 511,610 vectors
451
+ 08:13:53 [INFO]
452
+ Rebuilding all BM25 indices from database...
453
+ 08:14:08 [INFO] BM25 transcription: 514,203 docs, 1,518,385 tokens
454
+ 08:14:08 [INFO] BM25 lyrics_hashed: 0 docs (skipped)
455
+ 08:14:08 [INFO]
456
+ Detecting language for new transcriptions...
457
+ 08:14:09 [INFO] 148,346 rows need language detection
458
+ 08:15:10 [INFO] BM25 tags: 908,174 docs, 164,817 tokens
459
+ 08:16:04 [INFO] BM25 caption: 832,944 docs, 8,708 tokens
460
+ 08:16:53 [INFO] BM25 transcription: 514,203 docs, 1,518,385 tokens
461
+ 08:16:53 [INFO] BM25 lyrics_hashed: 0 docs (skipped)
462
+ 08:16:53 [INFO]
463
+ Detecting language for new transcriptions...
464
+ 08:16:53 [INFO] 148,346 rows need language detection
465
+ 08:18:54 [INFO] Updated language for 148,068 rows
466
+ 08:18:54 [INFO] Updating instrumental flags...
467
+ 08:18:57 [INFO] Instrumental tracks: 394,246
468
+ 08:18:57 [INFO]
469
+ Done in 0:10:59
470
+ 08:18:57 [INFO] Restart the server to load the updated indices.
471
+ 08:21:37 [INFO] Updated language for 148,068 rows
472
+ 08:21:37 [INFO] Updating instrumental flags...
473
+ 08:21:38 [INFO] Instrumental tracks: 394,246
474
+ 08:21:38 [INFO]
475
+ Done in 0:10:43
476
+ 08:21:38 [INFO] Restart the server to load the updated indices.
477
+ 08:31:00 [INFO] Loading search indices...
478
+ 08:31:02 [INFO] FAISS tag: 908,241 vectors
479
+ 08:31:03 [INFO] FAISS lyric: 479,313 vectors
480
+ 08:31:04 [INFO] FAISS mood: 383,616 vectors
481
+ 08:31:05 [INFO] FAISS caption: 798,858 vectors
482
+ 08:31:06 [INFO] FAISS transcription: 511,610 vectors
483
+ 08:31:06 [INFO] BM25 tags: 908,174 documents
484
+ 08:31:06 [INFO] BM25 caption: 832,944 documents
485
+ 08:31:06 [INFO] BM25 transcription: 514,203 documents
486
+ 08:31:06 [INFO] BM25 lyrics_hashed: not found (skipped)
487
+ 08:31:06 [INFO] SQLite: 908,174 tracks
488
+ 08:31:06 [INFO] Loading EmbeddingGemma 300M on GPU 0...
489
+ 08:31:12 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
490
+ 08:31:14 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
491
+ 08:31:14 [INFO] EmbeddingGemma loaded on cuda:0
492
+ 02:57:44 [INFO] Loading search indices...
493
+ 02:57:46 [INFO] FAISS tag: 908,241 vectors
494
+ 02:57:46 [INFO] FAISS lyric: 479,313 vectors
495
+ 02:57:47 [INFO] FAISS mood: 383,616 vectors
496
+ 02:57:48 [INFO] FAISS caption: 798,858 vectors
497
+ 02:57:49 [INFO] FAISS transcription: 511,610 vectors
498
+ 02:57:50 [INFO] FAISS whisper: 465,899 vectors
499
+ 02:57:50 [INFO] Whisper reverse map: 465,832 entries
500
+ 02:57:50 [INFO] BM25 tags: 908,174 documents
501
+ 02:57:50 [INFO] BM25 caption: 832,944 documents
502
+ 02:57:51 [INFO] BM25 transcription: 514,203 documents
503
+ 02:57:51 [INFO] BM25 lyrics_hashed: not found (skipped)
504
+ 02:57:51 [INFO] SQLite: 908,174 tracks
505
+ 02:57:51 [INFO] Loading EmbeddingGemma 300M on GPU 0...
506
+ 02:57:58 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
507
+ 02:58:00 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
508
+ 02:58:00 [INFO] EmbeddingGemma loaded on cuda:0
509
+ 02:58:00 [INFO] Loading Music-Whisper encoder on GPU 0...
510
+ 02:58:01 [INFO] Music-Whisper encoder loaded on cuda:0 (773 MB)
511
+ 03:12:12 [INFO] Loading search indices...
512
+ 03:12:13 [INFO] FAISS tag: 908,241 vectors
513
+ 03:12:14 [INFO] FAISS lyric: 479,313 vectors
514
+ 03:12:14 [INFO] FAISS mood: 383,616 vectors
515
+ 03:12:15 [INFO] FAISS caption: 798,858 vectors
516
+ 03:12:16 [INFO] FAISS transcription: 511,610 vectors
517
+ 03:12:17 [INFO] FAISS whisper: 465,899 vectors
518
+ 03:12:17 [INFO] Whisper reverse map: 465,832 entries
519
+ 03:12:17 [INFO] BM25 tags: 908,174 documents
520
+ 03:12:17 [INFO] BM25 caption: 832,944 documents
521
+ 03:12:18 [INFO] BM25 transcription: 514,203 documents
522
+ 03:12:18 [INFO] BM25 lyrics_hashed: not found (skipped)
523
+ 03:12:18 [INFO] SQLite: 908,174 tracks
524
+ 03:12:18 [INFO] Loading EmbeddingGemma 300M on GPU 0...
525
+ 03:12:25 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
526
+ 03:12:28 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
527
+ 03:12:28 [INFO] EmbeddingGemma loaded on cuda:0
528
+ 03:12:28 [INFO] Loading Music-Whisper encoder on GPU 0...
529
+ 03:12:28 [INFO] Music-Whisper encoder loaded on cuda:0 (773 MB)
530
+ 03:29:51 [INFO] Cached audio embedding: Cupid Stole my Baby.mp3 from 176.4.194.184 (1576ms)
531
+ 04:25:41 [INFO] Audio embedding cache hit: Cupid Stole my Baby.mp3 from 176.4.194.184
532
+ 05:29:47 [INFO] Cached audio embedding: (Intro).mp3 from 176.4.194.184 (811ms)
533
+ 05:33:41 [INFO] Audio embedding cache hit: (Intro).mp3 from 176.4.194.184
534
+ 08:31:52 [INFO] Cached audio embedding: (Intro).mp3 from 176.4.194.184 (824ms)
535
+ 04:18:22 [INFO] Loading search indices...
536
+ 04:18:23 [INFO] FAISS tag: 908,241 vectors
537
+ 04:18:24 [INFO] FAISS lyric: 479,313 vectors
538
+ 04:18:24 [INFO] FAISS mood: 383,616 vectors
539
+ 04:18:25 [INFO] FAISS caption: 798,858 vectors
540
+ 04:18:26 [INFO] FAISS transcription: 511,610 vectors
541
+ 04:18:27 [INFO] FAISS whisper: 908,174 vectors
542
+ 04:18:27 [INFO] Whisper reverse map: 908,174 entries
543
+ 04:18:27 [INFO] BM25 tags: 908,174 documents
544
+ 04:18:28 [INFO] BM25 caption: 832,944 documents
545
+ 04:18:28 [INFO] BM25 transcription: 514,203 documents
546
+ 04:18:28 [INFO] BM25 lyrics_hashed: not found (skipped)
547
+ 04:18:28 [INFO] SQLite: 908,174 tracks
548
+ 04:18:28 [INFO] Loading EmbeddingGemma 300M on GPU 0...
549
+ 04:18:33 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
550
+ 04:18:35 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
551
+ 04:18:35 [INFO] EmbeddingGemma loaded on cuda:0
552
+ 04:18:35 [INFO] Loading Music-Whisper encoder on GPU 0...
553
+ 04:18:36 [INFO] Music-Whisper encoder loaded on cuda:0 (773 MB)
554
+ 04:49:52 [INFO] Loading search indices...
555
+ 04:49:53 [INFO] FAISS tag: 908,241 vectors
556
+ 04:49:54 [INFO] FAISS lyric: 479,313 vectors
557
+ 04:49:55 [INFO] FAISS mood: 383,616 vectors
558
+ 04:49:56 [INFO] FAISS caption: 798,858 vectors
559
+ 04:49:56 [INFO] FAISS transcription: 511,610 vectors
560
+ 04:49:57 [INFO] FAISS whisper: 908,174 vectors
561
+ 04:49:57 [INFO] Whisper reverse map: 908,174 entries
562
+ 04:49:58 [INFO] BM25 tags: 908,174 documents
563
+ 04:49:58 [INFO] BM25 caption: 832,944 documents
564
+ 04:49:58 [INFO] BM25 transcription: 514,203 documents
565
+ 04:49:58 [INFO] BM25 lyrics_hashed: not found (skipped)
566
+ 04:49:58 [INFO] SQLite: 908,174 tracks
567
+ 04:49:58 [INFO] Loading EmbeddingGemma 300M on GPU 0...
568
+ 04:50:03 [INFO] Load pretrained SentenceTransformer: google/embeddinggemma-300m
569
+ 04:50:05 [INFO] 14 prompts are loaded, with the keys: ['query', 'document', 'BitextMining', 'Clustering', 'Classification', 'InstructionRetrieval', 'MultilabelClassification', 'PairClassification', 'Reranking', 'Retrieval', 'Retrieval-query', 'Retrieval-document', 'STS', 'Summarization']
570
+ 04:50:05 [INFO] EmbeddingGemma loaded on cuda:0
571
+ 04:50:05 [INFO] Loading Music-Whisper encoder on GPU 0...
572
+ 04:50:06 [INFO] Music-Whisper encoder loaded on cuda:0 (773 MB)
573
+ 04:51:42 [INFO] Loading search indices...
574
+ 04:51:43 [INFO] FAISS tag: 908,241 vectors
575
+ 04:51:44 [INFO] FAISS lyric: 479,313 vectors
576
+ 04:51:44 [INFO] FAISS mood: 383,616 vectors
577
+ 04:51:45 [INFO] FAISS caption: 798,858 vectors
578
+ 04:51:46 [INFO] FAISS transcription: 511,610 vectors
579
+ 04:51:47 [INFO] FAISS whisper: 908,174 vectors
580
+ 04:51:47 [INFO] Whisper reverse map: 908,174 entries
581
+ 04:51:47 [INFO] BM25 tags: 908,174 documents
582
+ 04:51:48 [INFO] BM25 caption: 832,944 documents
583
+ 04:51:48 [INFO] BM25 transcription: 514,203 documents
584
+ 04:51:48 [INFO] BM25 lyrics_hashed: not found (skipped)
585
+ 04:51:48 [INFO] SQLite: 908,174 tracks
586
+ 04:51:48 [INFO] Connecting to TEI backend at http://localhost:8090...
587
+ 04:51:48 [INFO] TEI connected at http://localhost:8090 (dim=768)
588
+ 04:51:48 [INFO] Loading Music-Whisper encoder on GPU 0...
589
+ 04:51:56 [INFO] Music-Whisper encoder loaded on cuda:0 (182 MB)
590
+ 05:02:47 [INFO] Loading search indices...
591
+ 05:02:49 [INFO] FAISS tag: 908,241 vectors
592
+ 05:02:49 [INFO] FAISS lyric: 479,313 vectors
593
+ 05:02:50 [INFO] FAISS mood: 383,616 vectors
594
+ 05:02:51 [INFO] FAISS caption: 798,858 vectors
595
+ 05:02:51 [INFO] FAISS transcription: 511,610 vectors
596
+ 05:02:53 [INFO] FAISS whisper: 908,174 vectors
597
+ 05:02:53 [INFO] Whisper reverse map: 908,174 entries
598
+ 05:02:53 [INFO] BM25 tags: 908,174 documents
599
+ 05:02:53 [INFO] BM25 caption: 832,944 documents
600
+ 05:02:53 [INFO] BM25 transcription: 514,203 documents
601
+ 05:02:53 [INFO] BM25 lyrics_hashed: not found (skipped)
602
+ 05:02:53 [INFO] SQLite: 908,174 tracks
603
+ 05:02:53 [INFO] Connecting to TEI backend at http://localhost:8090...
604
+ 05:02:54 [INFO] TEI connected at http://localhost:8090 (dim=768)
605
+ 05:02:54 [INFO] Loading Music-Whisper encoder on GPU 0...
606
+ 05:02:59 [INFO] Music-Whisper encoder loaded on cuda:0 (182 MB)
607
+ 05:47:06 [INFO] Loading search indices...
608
+ 05:47:07 [INFO] FAISS tag: 908,241 vectors
609
+ 05:47:08 [INFO] FAISS lyric: 479,313 vectors
610
+ 05:47:08 [INFO] FAISS mood: 383,616 vectors
611
+ 05:47:09 [INFO] FAISS caption: 798,858 vectors
612
+ 05:47:10 [INFO] FAISS transcription: 511,610 vectors
613
+ 05:47:11 [INFO] FAISS whisper: 908,174 vectors
614
+ 05:47:11 [INFO] Whisper reverse map: 908,174 entries
615
+ 05:47:11 [INFO] BM25 tags: 908,174 documents
616
+ 05:47:11 [INFO] BM25 caption: 832,944 documents
617
+ 05:47:12 [INFO] BM25 transcription: 514,203 documents
618
+ 05:47:12 [INFO] BM25 lyrics_hashed: not found (skipped)
619
+ 05:47:12 [INFO] SQLite: 908,174 tracks
620
+ 05:47:12 [INFO] Connecting to TEI backend at http://localhost:8090...
621
+ 05:47:12 [INFO] TEI connected at http://localhost:8090 (dim=768)
622
+ 05:47:12 [INFO] Loading Music-Whisper encoder on GPU 0...
623
+ 05:47:18 [INFO] Music-Whisper encoder loaded on cuda:0 (182 MB)
624
+ 07:06:28 [INFO] Cached audio embedding: The Model of My Dreams (Is Closed Source).mp3 from 176.4.189.127 (1631ms)
search_index/build_manifest.json ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "processed_private": [
3
+ "mureka_000000.tar.parquet",
4
+ "mureka_000001.tar.parquet",
5
+ "mureka_000002.tar.parquet",
6
+ "mureka_000003.tar.parquet",
7
+ "mureka_000004.tar.parquet",
8
+ "mureka_000005.tar.parquet",
9
+ "mureka_000006.tar.parquet",
10
+ "mureka_000007.tar.parquet",
11
+ "mureka_000008.tar.parquet",
12
+ "mureka_000009.tar.parquet",
13
+ "mureka_000010.tar.parquet",
14
+ "mureka_000011.tar.parquet",
15
+ "mureka_000012.tar.parquet",
16
+ "mureka_000013.tar.parquet",
17
+ "mureka_000014.tar.parquet",
18
+ "mureka_000015.tar.parquet",
19
+ "mureka_000016.tar.parquet",
20
+ "mureka_000017.tar.parquet",
21
+ "mureka_000018.tar.parquet",
22
+ "mureka_000019.tar.parquet",
23
+ "mureka_000020.tar.parquet",
24
+ "mureka_000021.tar.parquet",
25
+ "mureka_000022.tar.parquet",
26
+ "mureka_000023.tar.parquet",
27
+ "mureka_000024.tar.parquet",
28
+ "mureka_000025.tar.parquet",
29
+ "mureka_000026.tar.parquet",
30
+ "mureka_000027.tar.parquet",
31
+ "mureka_000028.tar.parquet",
32
+ "mureka_000029.tar.parquet",
33
+ "mureka_000030.tar.parquet",
34
+ "mureka_000031.tar.parquet",
35
+ "mureka_000032.tar.parquet",
36
+ "mureka_000033.tar.parquet",
37
+ "mureka_000034.tar.parquet",
38
+ "mureka_000035.tar.parquet",
39
+ "mureka_000036.tar.parquet",
40
+ "mureka_000037.tar.parquet",
41
+ "mureka_000038.tar.parquet",
42
+ "mureka_000039.tar.parquet",
43
+ "mureka_000040.tar.parquet",
44
+ "mureka_000041.tar.parquet",
45
+ "mureka_000042.tar.parquet",
46
+ "mureka_000043.tar.parquet",
47
+ "mureka_000044.tar.parquet",
48
+ "mureka_000045.tar.parquet",
49
+ "mureka_000046.tar.parquet",
50
+ "mureka_000047.tar.parquet",
51
+ "mureka_000048.tar.parquet",
52
+ "riffusion_000000.tar.parquet",
53
+ "riffusion_000001.tar.parquet",
54
+ "riffusion_000002.tar.parquet",
55
+ "riffusion_000003.tar.parquet",
56
+ "riffusion_000004.tar.parquet",
57
+ "riffusion_000005.tar.parquet",
58
+ "riffusion_000006.tar.parquet",
59
+ "riffusion_000007.tar.parquet",
60
+ "riffusion_000008.tar.parquet",
61
+ "riffusion_000009.tar.parquet",
62
+ "riffusion_000010.tar.parquet",
63
+ "riffusion_000011.tar.parquet",
64
+ "riffusion_000012.tar.parquet",
65
+ "riffusion_000013.tar.parquet",
66
+ "sonauto_000001.tar.parquet",
67
+ "suno_000000.tar.parquet",
68
+ "suno_000001.tar.parquet",
69
+ "suno_000002.tar.parquet",
70
+ "suno_000003.tar.parquet",
71
+ "suno_000004.tar.parquet",
72
+ "suno_000005.tar.parquet",
73
+ "suno_000006.tar.parquet",
74
+ "suno_000007.tar.parquet",
75
+ "suno_000008.tar.parquet",
76
+ "suno_000009.tar.parquet",
77
+ "suno_000010.tar.parquet",
78
+ "suno_000011.tar.parquet",
79
+ "suno_000012.tar.parquet",
80
+ "suno_000013.tar.parquet",
81
+ "suno_000014.tar.parquet",
82
+ "suno_000015.tar.parquet",
83
+ "suno_000016.tar.parquet",
84
+ "suno_000017.tar.parquet",
85
+ "suno_000018.tar.parquet",
86
+ "suno_000019.tar.parquet",
87
+ "suno_000020.tar.parquet",
88
+ "suno_000021.tar.parquet",
89
+ "suno_000022.tar.parquet",
90
+ "suno_000023.tar.parquet",
91
+ "suno_000024.tar.parquet",
92
+ "suno_000025.tar.parquet",
93
+ "suno_000026.tar.parquet",
94
+ "suno_000027.tar.parquet",
95
+ "suno_000028.tar.parquet",
96
+ "suno_000029.tar.parquet",
97
+ "suno_000030.tar.parquet",
98
+ "suno_000031.tar.parquet",
99
+ "suno_000032.tar.parquet",
100
+ "suno_000033.tar.parquet",
101
+ "suno_000034.tar.parquet",
102
+ "suno_000035.tar.parquet",
103
+ "suno_000036.tar.parquet",
104
+ "suno_000037.tar.parquet",
105
+ "suno_000038.tar.parquet",
106
+ "suno_000039.tar.parquet",
107
+ "suno_000040.tar.parquet",
108
+ "suno_000041.tar.parquet",
109
+ "suno_000042.tar.parquet",
110
+ "suno_000043.tar.parquet",
111
+ "suno_000044.tar.parquet",
112
+ "suno_000045.tar.parquet",
113
+ "suno_000046.tar.parquet",
114
+ "suno_000047.tar.parquet",
115
+ "suno_000048.tar.parquet",
116
+ "suno_000049.tar.parquet",
117
+ "suno_000050.tar.parquet",
118
+ "suno_000051.tar.parquet",
119
+ "suno_000052.tar.parquet",
120
+ "suno_000053.tar.parquet",
121
+ "suno_000054.tar.parquet",
122
+ "suno_000055.tar.parquet",
123
+ "suno_000056.tar.parquet",
124
+ "suno_000057.tar.parquet",
125
+ "suno_000058.tar.parquet",
126
+ "suno_000059.tar.parquet",
127
+ "suno_000060.tar.parquet",
128
+ "suno_000061.tar.parquet",
129
+ "suno_000062.tar.parquet",
130
+ "suno_000063.tar.parquet",
131
+ "suno_000064.tar.parquet",
132
+ "udio_000000.tar.parquet",
133
+ "udio_000001.tar.parquet",
134
+ "udio_000002.tar.parquet",
135
+ "udio_000003.tar.parquet",
136
+ "udio_000004.tar.parquet",
137
+ "udio_000005.tar.parquet",
138
+ "udio_000006.tar.parquet",
139
+ "udio_000008.tar.parquet",
140
+ "udio_000009.tar.parquet",
141
+ "udio_000010.tar.parquet",
142
+ "udio_000012.tar.parquet",
143
+ "udio_000013.tar.parquet",
144
+ "udio_000014.tar.parquet",
145
+ "udio_000016.tar.parquet",
146
+ "udio_000017.tar.parquet",
147
+ "udio_000018.tar.parquet",
148
+ "udio_000019.tar.parquet",
149
+ "udio_000020.tar.parquet",
150
+ "udio_000021.tar.parquet",
151
+ "udio_000022.tar.parquet",
152
+ "udio_000023.tar.parquet",
153
+ "udio_000024.tar.parquet",
154
+ "udio_000025.tar.parquet",
155
+ "udio_000026.tar.parquet",
156
+ "udio_000027.tar.parquet",
157
+ "udio_000028.tar.parquet",
158
+ "udio_000029.tar.parquet",
159
+ "udio_000030.tar.parquet",
160
+ "udio_000031.tar.parquet",
161
+ "udio_000032.tar.parquet"
162
+ ],
163
+ "processed_output": [],
164
+ "total_rows": 908241
165
+ }
search_index/build_stdout.log ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 05:17:50 [INFO] ============================================================
2
+ 05:17:50 [INFO] LAION-Tunes Search Index Builder
3
+ 05:17:50 [INFO] ============================================================
4
+ 05:17:50 [INFO] Force rebuild requested - starting fresh
5
+ 05:17:50 [INFO] Found 159 private parquets
6
+ 05:17:50 [INFO] Found 47 output (annotation) parquets
7
+ 05:17:50 [INFO] Starting row_id offset: 0
8
+ 05:17:50 [INFO] Created new FAISS tag index
9
+ 05:17:50 [INFO] Created new FAISS lyric index
10
+ 05:17:50 [INFO] Created new FAISS mood index
11
+ 05:17:50 [INFO] Created new FAISS caption index
12
+ 05:17:50 [INFO] Created new FAISS transcription index
13
+ 05:17:50 [INFO] Processing 159 new private parquets (skipping 0 already done)
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ 05:25:30 [INFO]
32
+ Inserted 908,241 new rows (total: 908,241)
33
+ 05:25:30 [INFO] Saving FAISS indices...
34
+ 05:25:32 [INFO] tag: 908,241 vectors
35
+ 05:25:32 [INFO] lyric: 479,313 vectors
36
+ 05:25:33 [INFO] mood: 383,616 vectors
37
+ 05:25:33 [INFO] caption: 223,415 vectors
38
+ 05:25:33 [INFO] transcription: 189,398 vectors
39
+ 05:25:33 [INFO] Building BM25 indices...
40
+ 05:25:46 [INFO] tags: 908,241 documents, 164,817 unique tokens
41
+ 05:26:03 [INFO] caption: 223,415 documents, 5,755 unique tokens
42
+ 05:26:28 [INFO] transcription: 189,398 documents, 875,770 unique tokens
43
+ 05:26:28 [INFO] lyrics_hashed: 0 documents (skipped)
44
+ 05:26:28 [INFO]
45
+ Done in 0:08:38
46
+ 05:26:28 [INFO] Index directory: /home/deployer/laion/music/laion-tunes-final/search_index
47
+ 05:26:28 [INFO] Total tracks: 908,241
48
+ 05:26:28 [INFO] FAISS tag: 908,241 vectors (2661 MB)
49
+ 05:26:28 [INFO] FAISS lyric: 479,313 vectors (1404 MB)
50
+ 05:26:28 [INFO] FAISS mood: 383,616 vectors (1124 MB)
51
+ 05:26:28 [INFO] FAISS caption: 223,415 vectors (655 MB)
52
+ 05:26:28 [INFO] FAISS transcription: 189,398 vectors (555 MB)
53
+ 05:26:28 [INFO] SQLite: 1327 MB
search_index/idmap_lyric.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f35e09d85890824e3f300d8d6e8ad13ebb873d921c541681e10758866e90de3
3
+ size 3834632
search_index/idmap_mood.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61d66c76181687fdca90b106e40d49aa4bb83bc8d48d10a13ee9a921a0c27741
3
+ size 3069056
search_index/idmap_transcription.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f392877dba4341f65a19a2771b638fa531d55a4b65bd803f4af04d0ad5b29830
3
+ size 4093008
server.py ADDED
@@ -0,0 +1,1059 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ LAION-Tunes Search Server
4
+ ==========================
5
+ FastAPI server providing semantic search, BM25 text search, music similarity
6
+ search, and metadata filtering over the LAION-Tunes music dataset.
7
+
8
+ Features:
9
+ - Vector similarity search via FAISS (tag/lyric/mood/caption/transcription embeddings)
10
+ - Music audio similarity search via Whisper encoder mean-pooled embeddings
11
+ - BM25 text search (tags, caption, transcription, privacy-hashed lyrics)
12
+ - Combined search: vector search + BM25 + filter by aesthetics/subset + re-rank
13
+ - Real-time query embedding via EmbeddingGemma 300M
14
+ - Audio upload → Whisper encoder embedding → FAISS similarity search
15
+ - Dark-mode HTML frontend with audio players
16
+
17
+ Usage:
18
+ python server.py [--port 7860] [--gpu 0] [--host 0.0.0.0]
19
+
20
+ Requires: search_index/ directory built by build_search_index.py
21
+ """
22
+
23
+ import os
24
+ import sys
25
+ import json
26
+ import time
27
+ import hmac
28
+ import hashlib
29
+ import pickle
30
+ import re
31
+ import sqlite3
32
+ import logging
33
+ import argparse
34
+ import tempfile
35
+ import io
36
+ import threading
37
+ from pathlib import Path
38
+ from typing import Optional
39
+ from contextlib import asynccontextmanager
40
+
41
+ import numpy as np
42
+ import faiss
43
+ from fastapi import FastAPI, Query, UploadFile, File, Form, Request
44
+ from fastapi.responses import HTMLResponse, JSONResponse
45
+ from fastapi.middleware.cors import CORSMiddleware
46
+ from pydantic import BaseModel
47
+
48
+ # Import BM25Index from the build script (needed for pickle deserialization)
49
+ sys.path.insert(0, str(Path(__file__).parent))
50
+ from build_search_index import BM25Index
51
+
52
+ # ── Paths ────────────────────────────────────────────────────────────────────
53
+ BASE_DIR = Path(__file__).parent
54
+ INDEX_DIR = BASE_DIR / "search_index"
55
+ HTML_PATH = BASE_DIR / "index.html"
56
+
57
+ LYRICS_HMAC_KEY = b"laion-tunes-search-2026-secret-key"
58
+
59
+ log = logging.getLogger("server")
60
+ logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s", datefmt="%H:%M:%S")
61
+
62
+ # ── Global state (loaded at startup) ─────────────────────────────────────────
63
+ state = {
64
+ "faiss": {}, # field -> faiss.Index
65
+ "id_maps": {}, # field -> numpy array of row_ids
66
+ "bm25": {}, # field -> BM25Index
67
+ "db_path": None, # SQLite path
68
+ "embedder": None, # SentenceTransformer model
69
+ "total_tracks": 0,
70
+ # Whisper encoder for music similarity
71
+ "whisper_processor": None,
72
+ "whisper_encoder": None,
73
+ "whisper_device": None,
74
+ "whisper_rid_to_idx": {}, # row_id -> faiss_idx for reverse lookup
75
+ "audio_emb_cache": {}, # (ip, filename) -> {"embedding": np.array, "expires": timestamp}
76
+ }
77
+
78
+ # ── Audio Embedding Cache ────────────────────────────────────────────────────
79
+ CACHE_TTL = 3600 # 1 hour
80
+ _cache_lock = threading.Lock()
81
+
82
+ def cache_get(ip, filename):
83
+ """Get cached audio embedding. Returns numpy array or None."""
84
+ key = (ip, filename)
85
+ with _cache_lock:
86
+ entry = state["audio_emb_cache"].get(key)
87
+ if entry and entry["expires"] > time.time():
88
+ return entry["embedding"]
89
+ # Expired or missing
90
+ if entry:
91
+ del state["audio_emb_cache"][key]
92
+ return None
93
+
94
+ def cache_set(ip, filename, embedding):
95
+ """Cache an audio embedding."""
96
+ key = (ip, filename)
97
+ with _cache_lock:
98
+ state["audio_emb_cache"][key] = {
99
+ "embedding": embedding,
100
+ "expires": time.time() + CACHE_TTL,
101
+ }
102
+ # Evict expired entries (max 1000 entries)
103
+ if len(state["audio_emb_cache"]) > 1000:
104
+ now = time.time()
105
+ expired = [k for k, v in state["audio_emb_cache"].items() if v["expires"] < now]
106
+ for k in expired:
107
+ del state["audio_emb_cache"][k]
108
+
109
+
110
+ # ── Tokenizer (must match build_search_index.py) ─────────────────────────────
111
+ _TOKEN_RE = re.compile(r"[a-z0-9]+")
112
+
113
+ def tokenize(text):
114
+ if not text or not isinstance(text, str):
115
+ return []
116
+ return [t for t in _TOKEN_RE.findall(text.lower()) if len(t) >= 2]
117
+
118
+ def tokenize_and_hash(text, secret_key=LYRICS_HMAC_KEY):
119
+ tokens = tokenize(text)
120
+ return [hmac.new(secret_key, t.encode(), hashlib.sha256).hexdigest()[:16] for t in tokens]
121
+
122
+
123
+ # ── Startup / Shutdown ───────────────────────────────────────────────────────
124
+ def load_indices():
125
+ """Load all search indices into memory."""
126
+ log.info("Loading search indices...")
127
+
128
+ # FAISS indices (including whisper)
129
+ for field in ["tag", "lyric", "mood", "caption", "transcription", "whisper"]:
130
+ idx_path = INDEX_DIR / f"faiss_{field}.index"
131
+ map_path = INDEX_DIR / f"idmap_{field}.npy"
132
+ if idx_path.exists() and map_path.exists():
133
+ state["faiss"][field] = faiss.read_index(str(idx_path))
134
+ state["id_maps"][field] = np.load(str(map_path))
135
+ log.info(f" FAISS {field}: {state['faiss'][field].ntotal:,} vectors")
136
+ else:
137
+ log.info(f" FAISS {field}: not found (skipped)")
138
+
139
+ # Build reverse mapping for whisper (row_id -> faiss_idx)
140
+ if "whisper" in state["id_maps"]:
141
+ idmap = state["id_maps"]["whisper"]
142
+ state["whisper_rid_to_idx"] = {int(rid): idx for idx, rid in enumerate(idmap)}
143
+ log.info(f" Whisper reverse map: {len(state['whisper_rid_to_idx']):,} entries")
144
+
145
+ # BM25 indices
146
+ for field in ["tags", "caption", "transcription", "lyrics_hashed"]:
147
+ pkl_path = INDEX_DIR / f"bm25_{field}.pkl"
148
+ if pkl_path.exists():
149
+ with open(pkl_path, "rb") as f:
150
+ state["bm25"][field] = pickle.load(f)
151
+ log.info(f" BM25 {field}: {len(state['bm25'][field].row_ids):,} documents")
152
+ else:
153
+ log.info(f" BM25 {field}: not found (skipped)")
154
+
155
+ # SQLite
156
+ state["db_path"] = str(INDEX_DIR / "metadata.db")
157
+ conn = sqlite3.connect(state["db_path"])
158
+ state["total_tracks"] = conn.execute("SELECT COUNT(*) FROM tracks").fetchone()[0]
159
+ conn.close()
160
+ log.info(f" SQLite: {state['total_tracks']:,} tracks")
161
+
162
+
163
+ class TEIEmbedder:
164
+ """Wraps Hugging Face Text Embeddings Inference HTTP API to match SentenceTransformer interface."""
165
+
166
+ def __init__(self, url):
167
+ self.url = url.rstrip("/")
168
+ import requests as _req
169
+ self._session = _req.Session()
170
+ # Warm up / verify
171
+ r = self._session.post(f"{self.url}/embed", json={"inputs": "test"})
172
+ r.raise_for_status()
173
+ self.dim = len(r.json()[0])
174
+ log.info(f" TEI connected at {self.url} (dim={self.dim})")
175
+
176
+ def encode(self, text, normalize_embeddings=True):
177
+ r = self._session.post(f"{self.url}/embed", json={"inputs": text})
178
+ r.raise_for_status()
179
+ emb = np.array(r.json()[0], dtype=np.float32)
180
+ if normalize_embeddings:
181
+ norm = np.linalg.norm(emb)
182
+ if norm > 0:
183
+ emb = emb / norm
184
+ return emb
185
+
186
+
187
+ def load_embedder(gpu_id):
188
+ """Load EmbeddingGemma 300M for real-time query embedding.
189
+ Supports TEI backend (--embedder tei --tei-url URL) or SentenceTransformer.
190
+ """
191
+ tei_url = getattr(app.state, "tei_url", None)
192
+
193
+ if tei_url:
194
+ log.info(f"Connecting to TEI backend at {tei_url}...")
195
+ state["embedder"] = TEIEmbedder(tei_url)
196
+ return
197
+
198
+ log.info(f"Loading EmbeddingGemma 300M on GPU {gpu_id}...")
199
+ os.environ["HF_HOME"] = str(Path("/home/deployer/laion/music/.hf_cache"))
200
+ os.environ["TRANSFORMERS_CACHE"] = str(Path("/home/deployer/laion/music/.hf_cache"))
201
+
202
+ import torch
203
+ from sentence_transformers import SentenceTransformer
204
+
205
+ device = f"cuda:{gpu_id}" if torch.cuda.is_available() else "cpu"
206
+ model = SentenceTransformer(
207
+ "google/embeddinggemma-300m",
208
+ device=device,
209
+ model_kwargs={"torch_dtype": torch.bfloat16},
210
+ )
211
+ state["embedder"] = model
212
+ log.info(f" EmbeddingGemma loaded on {device}")
213
+
214
+
215
+ def load_whisper_encoder(gpu_id):
216
+ """Load laion/music-whisper encoder for audio similarity search."""
217
+ if "whisper" not in state["faiss"]:
218
+ log.info(" Whisper FAISS index not found, skipping encoder load")
219
+ return
220
+
221
+ log.info(f"Loading Music-Whisper encoder on GPU {gpu_id}...")
222
+ cache_dir = str(Path("/home/deployer/laion/music/.hf_cache_embeddings"))
223
+ os.environ["HF_HOME"] = cache_dir
224
+ os.environ["TRANSFORMERS_CACHE"] = cache_dir
225
+
226
+ import torch
227
+ from transformers import WhisperProcessor, WhisperModel
228
+
229
+ device = f"cuda:{gpu_id}" if torch.cuda.is_available() else "cpu"
230
+ processor = WhisperProcessor.from_pretrained("laion/music-whisper", cache_dir=cache_dir)
231
+ model = WhisperModel.from_pretrained("laion/music-whisper", cache_dir=cache_dir)
232
+ encoder = model.encoder.to(device).half().eval()
233
+ del model
234
+ import torch as _torch
235
+ _torch.cuda.empty_cache()
236
+
237
+ state["whisper_processor"] = processor
238
+ state["whisper_encoder"] = encoder
239
+ state["whisper_device"] = device
240
+ log.info(f" Music-Whisper encoder loaded on {device} ({_torch.cuda.memory_allocated(gpu_id)/1024**2:.0f} MB)")
241
+
242
+ # Restore HF_HOME for EmbeddingGemma
243
+ os.environ["HF_HOME"] = str(Path("/home/deployer/laion/music/.hf_cache"))
244
+ os.environ["TRANSFORMERS_CACHE"] = str(Path("/home/deployer/laion/music/.hf_cache"))
245
+
246
+
247
+ @asynccontextmanager
248
+ async def lifespan(app: FastAPI):
249
+ # Startup
250
+ load_indices()
251
+ load_embedder(gpu_id=app.state.gpu_id)
252
+ if not getattr(app.state, "no_whisper", False):
253
+ load_whisper_encoder(gpu_id=app.state.gpu_id)
254
+ else:
255
+ log.info("Whisper encoder loading skipped (--no-whisper)")
256
+ yield
257
+ # Shutdown (nothing to clean up)
258
+
259
+
260
+ # ── FastAPI App ──────────────────────────────────────────────────────────────
261
+ app = FastAPI(title="LAION-Tunes Search", lifespan=lifespan)
262
+ app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"])
263
+
264
+
265
+ # ── Request/Response models ──────────────────────────────────────────────────
266
+ class SearchRequest(BaseModel):
267
+ query: str
268
+ negative_query: Optional[str] = None # Negative prompt for vector search (subtracted from query)
269
+ search_type: str = "bm25" # "vector" | "bm25" | "combined"
270
+ vector_field: str = "caption" # "tag" | "lyric" | "mood" | "caption" | "transcription"
271
+ bm25_field: str = "caption" # "tags" | "caption" | "transcription" | "lyrics_hashed"
272
+ rank_by: str = "similarity" # "similarity" | "aesthetics" | "plays" | "likes"
273
+ min_aesthetics: Optional[float] = None # Filter: minimum score_average
274
+ min_similarity: Optional[float] = None # Filter: minimum cosine similarity
275
+ subset_filter: Optional[str] = None # Filter: "suno" | "udio" etc
276
+ vocal_filter: Optional[str] = None # "instrumental" | "vocals" | None (all)
277
+ min_duration: Optional[float] = 60.0 # Minimum duration in seconds (default 1 min)
278
+ languages: Optional[list[str]] = None # List of language codes to include, None = all
279
+ negative_weight: float = 0.7 # Weight for negative query subtraction (0-1)
280
+ nsfw_filter: Optional[str] = None # None=all, "sfw_only", "nsfw_only"
281
+ top_k: int = 50
282
+ # Two-stage search
283
+ stage2_enabled: bool = False
284
+ stage2_query: Optional[str] = None
285
+ stage2_search_type: str = "vector" # "vector" | "bm25"
286
+ stage2_vector_field: str = "caption"
287
+ stage2_bm25_field: str = "caption"
288
+ stage2_top_k: int = 50
289
+
290
+
291
+ class SimilarSearchRequest(BaseModel):
292
+ row_id: int
293
+ top_k: int = 50
294
+ rank_by: str = "similarity"
295
+ min_aesthetics: Optional[float] = None
296
+ subset_filter: Optional[str] = None
297
+ vocal_filter: Optional[str] = None
298
+ min_duration: Optional[float] = 60.0
299
+ languages: Optional[list[str]] = None
300
+ nsfw_filter: Optional[str] = None
301
+ # Stage 2
302
+ stage2_enabled: bool = False
303
+ stage2_query: Optional[str] = None
304
+ stage2_search_type: str = "vector"
305
+ stage2_vector_field: str = "caption"
306
+ stage2_bm25_field: str = "caption"
307
+ stage2_top_k: int = 50
308
+
309
+
310
+ # ── Helper: fetch metadata from SQLite ───────────────────────────────────────
311
+ def fetch_tracks(row_ids, conn):
312
+ """Fetch track metadata for given row_ids from SQLite."""
313
+ if len(row_ids) == 0:
314
+ return {}
315
+ placeholders = ",".join("?" * len(row_ids))
316
+ cursor = conn.execute(
317
+ f"SELECT * FROM tracks WHERE row_id IN ({placeholders})",
318
+ list(int(r) for r in row_ids),
319
+ )
320
+ columns = [desc[0] for desc in cursor.description]
321
+ result = {}
322
+ for row in cursor:
323
+ d = dict(zip(columns, row))
324
+ result[d["row_id"]] = d
325
+ return result
326
+
327
+
328
+ def format_result(track, score=None, score_type="similarity", has_whisper_emb=False):
329
+ """Format a track dict for API response."""
330
+ # Parse JSON array fields
331
+ genre = json.loads(track.get("genre_tags") or "[]")
332
+ scene = json.loads(track.get("scene_tags") or "[]")
333
+ emotion = json.loads(track.get("emotion_tags") or "[]")
334
+
335
+ return {
336
+ "row_id": track["row_id"],
337
+ "title": track.get("title") or "Untitled",
338
+ "audio_url": track.get("audio_url") or "",
339
+ "subset": track.get("subset") or "",
340
+ "tags_text": track.get("tags_text") or "",
341
+ "mood_text": track.get("mood_text") or "",
342
+ "genre_tags": genre,
343
+ "scene_tags": scene,
344
+ "emotion_tags": emotion,
345
+ "score_average": track.get("score_average"),
346
+ "score_coherence": track.get("score_coherence"),
347
+ "score_musicality": track.get("score_musicality"),
348
+ "score_memorability": track.get("score_memorability"),
349
+ "score_clarity": track.get("score_clarity"),
350
+ "score_naturalness": track.get("score_naturalness"),
351
+ "play_count": track.get("play_count") or 0,
352
+ "upvote_count": track.get("upvote_count") or 0,
353
+ "duration_seconds": track.get("duration_seconds"),
354
+ "music_whisper_caption": track.get("music_whisper_caption") or "",
355
+ "has_caption": bool(track.get("has_caption")),
356
+ "has_transcription": bool(track.get("has_transcription")),
357
+ "is_instrumental": bool(track.get("is_instrumental")),
358
+ "language": track.get("language") or "unknown",
359
+ "score": round(float(score), 4) if score is not None else None,
360
+ "score_type": score_type,
361
+ "has_whisper_emb": has_whisper_emb,
362
+ # NSFW safety labels
363
+ "nsfw_overall_label": track.get("nsfw_overall_label") or "likely_sfw",
364
+ "nsfw_gore_label": track.get("nsfw_gore_label") or "likely_sfw",
365
+ "nsfw_sexual_label": track.get("nsfw_sexual_label") or "likely_sfw",
366
+ "nsfw_hate_label": track.get("nsfw_hate_label") or "likely_sfw",
367
+ "nsfw_gore_sim": round(float(track["nsfw_gore_sim"]), 4) if track.get("nsfw_gore_sim") is not None else None,
368
+ "nsfw_sexual_sim": round(float(track["nsfw_sexual_sim"]), 4) if track.get("nsfw_sexual_sim") is not None else None,
369
+ "nsfw_hate_sim": round(float(track["nsfw_hate_sim"]), 4) if track.get("nsfw_hate_sim") is not None else None,
370
+ }
371
+
372
+
373
+ # ── Search logic ─────────────────────────────────────────────────────────────
374
+ def vector_search(query_embedding, field, top_k):
375
+ """Search FAISS index, return (row_ids, similarities)."""
376
+ if field not in state["faiss"]:
377
+ return np.array([]), np.array([])
378
+
379
+ index = state["faiss"][field]
380
+ id_map = state["id_maps"][field]
381
+
382
+ # Reshape for FAISS
383
+ qvec = query_embedding.reshape(1, -1).astype(np.float32)
384
+ k = min(top_k, index.ntotal)
385
+ if k == 0:
386
+ return np.array([]), np.array([])
387
+
388
+ similarities, indices = index.search(qvec, k)
389
+ similarities = similarities[0]
390
+ indices = indices[0]
391
+
392
+ # Map FAISS indices to row_ids
393
+ valid = indices >= 0
394
+ row_ids = id_map[indices[valid]]
395
+ sims = similarities[valid]
396
+ return row_ids, sims
397
+
398
+
399
+ def bm25_search(query_text, field, top_k):
400
+ """BM25 text search, return (row_ids, scores)."""
401
+ if field not in state["bm25"]:
402
+ return np.array([]), np.array([])
403
+
404
+ # Hash tokens for lyrics search
405
+ if field == "lyrics_hashed":
406
+ tokens = tokenize_and_hash(query_text)
407
+ else:
408
+ tokens = tokenize(query_text)
409
+
410
+ return state["bm25"][field].search(tokens, top_k=top_k)
411
+
412
+
413
+ def apply_filters(tracks_dict, min_aesthetics=None, subset_filter=None, min_similarity=None,
414
+ scores=None, vocal_filter=None, min_duration=None, languages=None,
415
+ nsfw_filter=None):
416
+ """Filter tracks by criteria. Returns filtered row_ids.
417
+ nsfw_filter: None=all, 'sfw_only'=exclude NSFW, 'nsfw_only'=only NSFW
418
+ """
419
+ filtered = []
420
+ for row_id, track in tracks_dict.items():
421
+ if min_aesthetics is not None:
422
+ avg = track.get("score_average")
423
+ if avg is None or avg < min_aesthetics:
424
+ continue
425
+ if subset_filter:
426
+ if track.get("subset") != subset_filter:
427
+ continue
428
+ if min_similarity is not None and scores is not None:
429
+ sim = scores.get(row_id, 0)
430
+ if sim < min_similarity:
431
+ continue
432
+ if vocal_filter == "instrumental":
433
+ if not track.get("is_instrumental"):
434
+ continue
435
+ elif vocal_filter == "vocals":
436
+ if track.get("is_instrumental"):
437
+ continue
438
+ if min_duration is not None:
439
+ dur = track.get("duration_seconds")
440
+ if dur is not None and dur < min_duration:
441
+ continue
442
+ if languages:
443
+ lang = track.get("language") or "unknown"
444
+ if lang not in languages:
445
+ continue
446
+ if nsfw_filter == "sfw_only":
447
+ label = track.get("nsfw_overall_label") or "likely_sfw"
448
+ if label != "likely_sfw":
449
+ continue
450
+ elif nsfw_filter == "nsfw_only":
451
+ label = track.get("nsfw_overall_label") or "likely_sfw"
452
+ if label == "likely_sfw":
453
+ continue
454
+ filtered.append(row_id)
455
+ return filtered
456
+
457
+
458
+ def rank_results(row_ids, tracks_dict, rank_by, sim_scores=None):
459
+ """Re-rank row_ids by the specified field."""
460
+ if rank_by in ("similarity", "music_similarity") and sim_scores:
461
+ return sorted(row_ids, key=lambda r: sim_scores.get(r, 0), reverse=True)
462
+ elif rank_by == "aesthetics":
463
+ return sorted(row_ids, key=lambda r: tracks_dict.get(r, {}).get("score_average") or 0, reverse=True)
464
+ elif rank_by == "plays":
465
+ return sorted(row_ids, key=lambda r: tracks_dict.get(r, {}).get("play_count") or 0, reverse=True)
466
+ elif rank_by == "likes":
467
+ return sorted(row_ids, key=lambda r: tracks_dict.get(r, {}).get("upvote_count") or 0, reverse=True)
468
+ return row_ids
469
+
470
+
471
+ # ── Audio embedding helper ──────────────────────────────────────────────────
472
+ def compute_audio_embedding(audio_bytes):
473
+ """Compute mean-pooled Whisper encoder embedding from audio bytes.
474
+ Returns L2-normalized 768-dim float32 numpy array.
475
+ """
476
+ import torch
477
+ import librosa
478
+ import soundfile as sf
479
+
480
+ processor = state["whisper_processor"]
481
+ encoder = state["whisper_encoder"]
482
+ device = state["whisper_device"]
483
+
484
+ if processor is None or encoder is None:
485
+ raise RuntimeError("Whisper encoder not loaded")
486
+
487
+ # Write bytes to temp file, load with librosa
488
+ with tempfile.NamedTemporaryFile(suffix=".audio", delete=True) as tmp:
489
+ tmp.write(audio_bytes)
490
+ tmp.flush()
491
+ try:
492
+ audio, sr = librosa.load(tmp.name, sr=16000, mono=True)
493
+ except Exception:
494
+ # Try soundfile as fallback
495
+ audio, sr = sf.read(tmp.name)
496
+ if len(audio.shape) > 1:
497
+ audio = audio.mean(axis=1)
498
+ if sr != 16000:
499
+ audio = librosa.resample(audio, orig_sr=sr, target_sr=16000)
500
+
501
+ # Trim to first 30 seconds
502
+ max_samples = 30 * 16000
503
+ audio = audio[:max_samples].astype(np.float32)
504
+
505
+ if len(audio) < 1600: # less than 0.1s
506
+ raise ValueError("Audio too short (< 0.1 seconds)")
507
+
508
+ # Process through Whisper encoder
509
+ inputs = processor(audio, sampling_rate=16000, return_tensors="pt")
510
+ input_features = inputs.input_features.to(device).half()
511
+
512
+ with torch.no_grad():
513
+ outputs = encoder(input_features)
514
+ hidden = outputs.last_hidden_state # (1, seq, 768)
515
+ mean_pooled = hidden.mean(dim=1) # (1, 768)
516
+ mean_pooled = torch.nn.functional.normalize(mean_pooled, p=2, dim=1)
517
+ embedding = mean_pooled.cpu().float().numpy()[0] # (768,)
518
+
519
+ return embedding
520
+
521
+
522
+ def search_by_whisper_embedding(query_embedding, top_k, rank_by, min_aesthetics,
523
+ subset_filter, vocal_filter, min_duration, languages,
524
+ nsfw_filter=None):
525
+ """Search whisper FAISS index with a query embedding, apply filters, return formatted results."""
526
+ t0 = time.time()
527
+
528
+ has_filters = (subset_filter or vocal_filter or languages
529
+ or (min_aesthetics and min_aesthetics > 0)
530
+ or (min_duration and min_duration > 0))
531
+ fetch_k = max(top_k * 100, 20000) if has_filters else max(top_k * 10, 2000)
532
+
533
+ # Search FAISS whisper index
534
+ row_ids, sims = vector_search(query_embedding, "whisper", fetch_k)
535
+ sim_scores = {}
536
+ candidate_row_ids = set()
537
+ for rid, sim in zip(row_ids, sims):
538
+ rid = int(rid)
539
+ sim_scores[rid] = float(sim)
540
+ candidate_row_ids.add(rid)
541
+
542
+ # Fetch metadata
543
+ conn = sqlite3.connect(state["db_path"])
544
+ conn.row_factory = sqlite3.Row
545
+ tracks_dict = fetch_tracks(list(candidate_row_ids), conn)
546
+
547
+ # Apply filters
548
+ filtered_ids = apply_filters(
549
+ tracks_dict,
550
+ min_aesthetics=min_aesthetics,
551
+ subset_filter=subset_filter,
552
+ vocal_filter=vocal_filter,
553
+ min_duration=min_duration,
554
+ languages=languages,
555
+ nsfw_filter=nsfw_filter,
556
+ )
557
+
558
+ # Rank
559
+ ranked_ids = rank_results(filtered_ids, tracks_dict, rank_by, sim_scores)
560
+ final_ids = ranked_ids[:top_k]
561
+
562
+ # Build response
563
+ whisper_rid_set = state["whisper_rid_to_idx"]
564
+ results = []
565
+ for rid in final_ids:
566
+ track = tracks_dict.get(rid)
567
+ if not track:
568
+ continue
569
+ score = sim_scores.get(rid, 0)
570
+ score_type = "cosine_similarity"
571
+ if rank_by == "aesthetics":
572
+ score = track.get("score_average") or 0
573
+ score_type = "aesthetics"
574
+ elif rank_by == "plays":
575
+ score = track.get("play_count") or 0
576
+ score_type = "play_count"
577
+ elif rank_by == "likes":
578
+ score = track.get("upvote_count") or 0
579
+ score_type = "upvote_count"
580
+
581
+ r = format_result(dict(track), score=score, score_type=score_type,
582
+ has_whisper_emb=(rid in whisper_rid_set))
583
+ results.append(r)
584
+
585
+ conn.close()
586
+ search_time_ms = (time.time() - t0) * 1000
587
+
588
+ return {
589
+ "results": results,
590
+ "total_candidates": len(candidate_row_ids),
591
+ "total_filtered": len(filtered_ids),
592
+ "total_tracks": state["total_tracks"],
593
+ "search_time_ms": round(search_time_ms, 1),
594
+ "search_type": "music_similarity",
595
+ "vector_field": "whisper",
596
+ }
597
+
598
+
599
+ # ── API Endpoints ────────────────────────────────────────────────────────────
600
+ @app.get("/", response_class=HTMLResponse)
601
+ async def serve_frontend():
602
+ """Serve the search frontend."""
603
+ return HTML_PATH.read_text(encoding="utf-8")
604
+
605
+
606
+ @app.get("/nsfw-report", response_class=HTMLResponse)
607
+ async def serve_nsfw_report():
608
+ """Serve the NSFW safety analysis report."""
609
+ report = BASE_DIR / "nsfw_safety_report.html"
610
+ if report.exists():
611
+ return report.read_text(encoding="utf-8")
612
+ return HTMLResponse("<h1>Report not generated yet</h1>", status_code=404)
613
+
614
+
615
+ @app.post("/api/search")
616
+ async def search(req: SearchRequest):
617
+ """Main search endpoint supporting vector, BM25, and combined search."""
618
+ t0 = time.time()
619
+
620
+ # Embed query (and optional negative query)
621
+ t_emb_start = time.time()
622
+ query_embedding = state["embedder"].encode(
623
+ req.query, normalize_embeddings=True
624
+ ).astype(np.float32)
625
+
626
+ # Negative prompt: subtract negative embedding from positive, then re-normalize
627
+ if req.negative_query and req.negative_query.strip() and req.search_type in ("vector", "combined"):
628
+ neg_embedding = state["embedder"].encode(
629
+ req.negative_query.strip(), normalize_embeddings=True
630
+ ).astype(np.float32)
631
+ weight = max(0.0, min(1.0, req.negative_weight))
632
+ query_embedding = query_embedding - weight * neg_embedding
633
+ # Re-normalize to unit length for cosine similarity
634
+ norm = np.linalg.norm(query_embedding)
635
+ if norm > 0:
636
+ query_embedding = query_embedding / norm
637
+
638
+ emb_time_ms = (time.time() - t_emb_start) * 1000
639
+
640
+ conn = sqlite3.connect(state["db_path"])
641
+ conn.row_factory = sqlite3.Row
642
+
643
+ # Determine candidate pool size - fetch large pool so filters don't starve results.
644
+ # FAISS IndexFlatIP scans all vectors regardless of k, so large k is ~free.
645
+ has_filters = (req.subset_filter or req.vocal_filter or req.languages
646
+ or (req.min_aesthetics and req.min_aesthetics > 0)
647
+ or (req.min_duration and req.min_duration > 0))
648
+ fetch_k = max(req.top_k * 100, 20000) if has_filters else max(req.top_k * 10, 2000)
649
+
650
+ sim_scores = {} # row_id -> similarity score
651
+ bm25_scores = {} # row_id -> bm25 score
652
+ candidate_row_ids = set()
653
+
654
+ if req.search_type in ("vector", "combined"):
655
+ row_ids, sims = vector_search(query_embedding, req.vector_field, fetch_k)
656
+ for rid, sim in zip(row_ids, sims):
657
+ rid = int(rid)
658
+ sim_scores[rid] = float(sim)
659
+ candidate_row_ids.add(rid)
660
+
661
+ if req.search_type in ("bm25", "combined"):
662
+ row_ids, scores = bm25_search(req.query, req.bm25_field, fetch_k)
663
+ for rid, score in zip(row_ids, scores):
664
+ rid = int(rid)
665
+ bm25_scores[rid] = float(score)
666
+ candidate_row_ids.add(rid)
667
+
668
+ if req.search_type == "combined" and sim_scores and bm25_scores:
669
+ # For combined: intersect vector and BM25 candidates
670
+ candidate_row_ids = set(sim_scores.keys()) & set(bm25_scores.keys())
671
+ if not candidate_row_ids:
672
+ # If no intersection, fall back to union
673
+ candidate_row_ids = set(sim_scores.keys()) | set(bm25_scores.keys())
674
+
675
+ # Fetch metadata for candidates
676
+ tracks_dict = fetch_tracks(list(candidate_row_ids), conn)
677
+
678
+ # Use primary scores based on search type for similarity filtering
679
+ primary_scores = sim_scores if req.search_type in ("vector", "combined") else bm25_scores
680
+
681
+ # Apply filters
682
+ filtered_ids = apply_filters(
683
+ tracks_dict,
684
+ min_aesthetics=req.min_aesthetics,
685
+ subset_filter=req.subset_filter,
686
+ min_similarity=req.min_similarity,
687
+ scores=primary_scores,
688
+ vocal_filter=req.vocal_filter,
689
+ min_duration=req.min_duration,
690
+ languages=req.languages,
691
+ nsfw_filter=req.nsfw_filter,
692
+ )
693
+
694
+ # Rank
695
+ ranked_ids = rank_results(filtered_ids, tracks_dict, req.rank_by, primary_scores)
696
+
697
+ # Take top_k
698
+ stage1_ids = ranked_ids[:req.top_k]
699
+
700
+ # ── Stage 2: re-filter by a second query ────────────────────────────
701
+ stage2_scores = {}
702
+ stage2_info = None
703
+ if req.stage2_enabled and req.stage2_query and req.stage2_query.strip():
704
+ stage1_set = set(stage1_ids)
705
+ s2_query = req.stage2_query.strip()
706
+
707
+ if req.stage2_search_type == "vector":
708
+ s2_emb = state["embedder"].encode(s2_query, normalize_embeddings=True).astype(np.float32)
709
+ # Search with large K to cover stage1 candidates
710
+ s2_fetch_k = max(len(stage1_set) * 20, 50000)
711
+ s2_rids, s2_sims = vector_search(s2_emb, req.stage2_vector_field, s2_fetch_k)
712
+ for rid, sim in zip(s2_rids, s2_sims):
713
+ rid = int(rid)
714
+ if rid in stage1_set:
715
+ stage2_scores[rid] = float(sim)
716
+ else: # bm25
717
+ s2_fetch_k = max(len(stage1_set) * 20, 50000)
718
+ s2_rids, s2_scores_arr = bm25_search(s2_query, req.stage2_bm25_field, s2_fetch_k)
719
+ for rid, sc in zip(s2_rids, s2_scores_arr):
720
+ rid = int(rid)
721
+ if rid in stage1_set:
722
+ stage2_scores[rid] = float(sc)
723
+
724
+ # Rank stage1 candidates by stage2 score, take stage2_top_k
725
+ stage1_ids = sorted(stage1_ids, key=lambda r: stage2_scores.get(r, -999), reverse=True)
726
+ stage1_ids = stage1_ids[:req.stage2_top_k]
727
+ stage2_info = {
728
+ "query": s2_query,
729
+ "search_type": req.stage2_search_type,
730
+ "field": req.stage2_vector_field if req.stage2_search_type == "vector" else req.stage2_bm25_field,
731
+ "matched": len(stage2_scores),
732
+ "returned": len(stage1_ids),
733
+ }
734
+
735
+ final_ids = stage1_ids
736
+
737
+ # Build response
738
+ whisper_rid_set = state.get("whisper_rid_to_idx", {})
739
+ results = []
740
+ for rid in final_ids:
741
+ track = tracks_dict.get(rid)
742
+ if not track:
743
+ continue
744
+ # Pick the best score to show
745
+ if stage2_scores:
746
+ score = stage2_scores.get(rid, 0)
747
+ score_type = "cosine_similarity" if req.stage2_search_type == "vector" else "bm25"
748
+ else:
749
+ score = primary_scores.get(rid, 0)
750
+ score_type = "cosine_similarity" if req.search_type == "vector" else "bm25"
751
+ if req.rank_by == "aesthetics" and not stage2_scores:
752
+ score = track.get("score_average") or 0
753
+ score_type = "aesthetics"
754
+ elif req.rank_by == "plays" and not stage2_scores:
755
+ score = track.get("play_count") or 0
756
+ score_type = "play_count"
757
+ elif req.rank_by == "likes" and not stage2_scores:
758
+ score = track.get("upvote_count") or 0
759
+ score_type = "upvote_count"
760
+
761
+ r = format_result(dict(track), score=score, score_type=score_type,
762
+ has_whisper_emb=(rid in whisper_rid_set))
763
+ # Attach both scores when stage2 is active
764
+ if stage2_scores:
765
+ r["stage1_score"] = round(primary_scores.get(rid, 0), 4)
766
+ r["stage2_score"] = round(stage2_scores.get(rid, 0), 4)
767
+ results.append(r)
768
+
769
+ conn.close()
770
+ search_time_ms = (time.time() - t0) * 1000
771
+
772
+ resp = {
773
+ "results": results,
774
+ "total_candidates": len(candidate_row_ids),
775
+ "total_filtered": len(filtered_ids),
776
+ "total_tracks": state["total_tracks"],
777
+ "search_time_ms": round(search_time_ms, 1),
778
+ "query_embedding_time_ms": round(emb_time_ms, 1),
779
+ "search_type": req.search_type,
780
+ "vector_field": req.vector_field,
781
+ "bm25_field": req.bm25_field,
782
+ }
783
+ if stage2_info:
784
+ resp["stage2"] = stage2_info
785
+ return resp
786
+
787
+
788
+ @app.post("/api/search_by_audio")
789
+ async def search_by_audio(
790
+ request: Request,
791
+ audio: UploadFile = File(...),
792
+ top_k: int = Form(50),
793
+ rank_by: str = Form("similarity"),
794
+ subset_filter: Optional[str] = Form(None),
795
+ vocal_filter: Optional[str] = Form(None),
796
+ min_duration: Optional[float] = Form(None),
797
+ min_aesthetics: Optional[float] = Form(None),
798
+ languages: Optional[str] = Form(None), # comma-separated language codes
799
+ nsfw_filter: Optional[str] = Form(None), # None=all, "sfw_only", "nsfw_only"
800
+ # Stage 2 fields
801
+ stage2_enabled: Optional[str] = Form(None),
802
+ stage2_query: Optional[str] = Form(None),
803
+ stage2_search_type: Optional[str] = Form("vector"),
804
+ stage2_vector_field: Optional[str] = Form("caption"),
805
+ stage2_bm25_field: Optional[str] = Form("caption"),
806
+ stage2_top_k: int = Form(50),
807
+ ):
808
+ """Search by uploaded audio: compute whisper embedding, find nearest neighbors."""
809
+ if "whisper" not in state["faiss"]:
810
+ return JSONResponse(status_code=503, content={"error": "Whisper index not available"})
811
+ if state["whisper_encoder"] is None:
812
+ return JSONResponse(status_code=503, content={"error": "Whisper encoder not loaded"})
813
+
814
+ t0 = time.time()
815
+
816
+ # Client IP for caching
817
+ client_ip = request.client.host if request.client else "unknown"
818
+ filename = audio.filename or "unknown"
819
+
820
+ # Check cache
821
+ cached_emb = cache_get(client_ip, filename)
822
+ cache_hit = cached_emb is not None
823
+
824
+ if cache_hit:
825
+ query_embedding = cached_emb
826
+ emb_time_ms = 0.0
827
+ log.info(f"Audio embedding cache hit: {filename} from {client_ip}")
828
+ else:
829
+ # Read audio bytes
830
+ audio_bytes = await audio.read()
831
+ if len(audio_bytes) == 0:
832
+ return JSONResponse(status_code=400, content={"error": "Empty audio file"})
833
+ if len(audio_bytes) > 100 * 1024 * 1024: # 100 MB limit
834
+ return JSONResponse(status_code=400, content={"error": "File too large (max 100 MB)"})
835
+
836
+ # Compute embedding
837
+ t_emb = time.time()
838
+ try:
839
+ query_embedding = compute_audio_embedding(audio_bytes)
840
+ except Exception as e:
841
+ return JSONResponse(status_code=400, content={"error": f"Audio processing failed: {str(e)}"})
842
+ emb_time_ms = (time.time() - t_emb) * 1000
843
+
844
+ # Cache the result
845
+ cache_set(client_ip, filename, query_embedding)
846
+ log.info(f"Cached audio embedding: {filename} from {client_ip} ({emb_time_ms:.0f}ms)")
847
+
848
+ # Parse languages
849
+ lang_list = None
850
+ if languages and languages.strip():
851
+ lang_list = [l.strip() for l in languages.split(",") if l.strip()]
852
+
853
+ # Parse optional floats that come as "None" strings from form
854
+ min_dur = min_duration if min_duration and min_duration > 0 else None
855
+ min_aes = min_aesthetics if min_aesthetics and min_aesthetics > 0 else None
856
+ sub_filter = subset_filter if subset_filter and subset_filter != "null" else None
857
+ voc_filter = vocal_filter if vocal_filter and vocal_filter != "null" else None
858
+
859
+ nsfw_f = nsfw_filter if nsfw_filter and nsfw_filter not in ("null", "") else None
860
+
861
+ result = search_by_whisper_embedding(
862
+ query_embedding, top_k, rank_by, min_aes, sub_filter, voc_filter, min_dur, lang_list,
863
+ nsfw_filter=nsfw_f,
864
+ )
865
+ result["query_embedding_time_ms"] = round(emb_time_ms, 1)
866
+ result["audio_filename"] = filename
867
+ result["cache_hit"] = cache_hit
868
+
869
+ # Stage 2: re-filter music similarity results by text query
870
+ s2_enabled = stage2_enabled and stage2_enabled.lower() in ("true", "1", "yes")
871
+ if s2_enabled and stage2_query and stage2_query.strip():
872
+ stage1_results = result["results"]
873
+ stage1_set = {r["row_id"] for r in stage1_results}
874
+ s2_query = stage2_query.strip()
875
+ stage2_scores = {}
876
+
877
+ if stage2_search_type == "vector":
878
+ s2_emb = state["embedder"].encode(s2_query, normalize_embeddings=True).astype(np.float32)
879
+ s2_fetch_k = max(len(stage1_set) * 20, 50000)
880
+ s2_rids, s2_sims = vector_search(s2_emb, stage2_vector_field, s2_fetch_k)
881
+ for rid, sim in zip(s2_rids, s2_sims):
882
+ rid = int(rid)
883
+ if rid in stage1_set:
884
+ stage2_scores[rid] = float(sim)
885
+ else: # bm25
886
+ s2_fetch_k = max(len(stage1_set) * 20, 50000)
887
+ s2_rids, s2_scores_arr = bm25_search(s2_query, stage2_bm25_field, s2_fetch_k)
888
+ for rid, sc in zip(s2_rids, s2_scores_arr):
889
+ rid = int(rid)
890
+ if rid in stage1_set:
891
+ stage2_scores[rid] = float(sc)
892
+
893
+ # Re-rank by stage2 score
894
+ for r in stage1_results:
895
+ r["stage1_score"] = r.get("score", 0)
896
+ r["stage2_score"] = round(stage2_scores.get(r["row_id"], -999), 4)
897
+
898
+ stage1_results.sort(key=lambda r: r["stage2_score"], reverse=True)
899
+ result["results"] = stage1_results[:stage2_top_k]
900
+ result["stage2"] = {
901
+ "query": s2_query,
902
+ "search_type": stage2_search_type,
903
+ "field": stage2_vector_field if stage2_search_type == "vector" else stage2_bm25_field,
904
+ "matched": len(stage2_scores),
905
+ "returned": len(result["results"]),
906
+ }
907
+
908
+ return result
909
+
910
+
911
+ @app.post("/api/search_similar")
912
+ async def search_similar(req: SimilarSearchRequest):
913
+ """Search for tracks similar to a given sample using pre-computed whisper embeddings."""
914
+ if "whisper" not in state["faiss"]:
915
+ return JSONResponse(status_code=503, content={"error": "Whisper index not available"})
916
+
917
+ rid_to_idx = state["whisper_rid_to_idx"]
918
+ if req.row_id not in rid_to_idx:
919
+ return JSONResponse(status_code=404, content={
920
+ "error": f"No whisper embedding found for row_id {req.row_id}. "
921
+ f"Only {len(rid_to_idx):,} of {state['total_tracks']:,} tracks have whisper embeddings."
922
+ })
923
+
924
+ t0 = time.time()
925
+
926
+ # Reconstruct the embedding from FAISS index
927
+ faiss_idx = rid_to_idx[req.row_id]
928
+ query_embedding = state["faiss"]["whisper"].reconstruct(faiss_idx)
929
+
930
+ result = search_by_whisper_embedding(
931
+ query_embedding, req.top_k, req.rank_by,
932
+ req.min_aesthetics, req.subset_filter, req.vocal_filter,
933
+ req.min_duration, req.languages,
934
+ nsfw_filter=req.nsfw_filter,
935
+ )
936
+ result["reference_row_id"] = req.row_id
937
+
938
+ # Look up title for the reference
939
+ conn = sqlite3.connect(state["db_path"])
940
+ row = conn.execute("SELECT title FROM tracks WHERE row_id=?", (req.row_id,)).fetchone()
941
+ conn.close()
942
+ if row:
943
+ result["reference_title"] = row[0] or "Untitled"
944
+
945
+ # Stage 2: re-filter music similarity results by text query
946
+ if req.stage2_enabled and req.stage2_query and req.stage2_query.strip():
947
+ stage1_results = result["results"]
948
+ stage1_set = {r["row_id"] for r in stage1_results}
949
+ s2_query = req.stage2_query.strip()
950
+ stage2_scores = {}
951
+
952
+ if req.stage2_search_type == "vector":
953
+ s2_emb = state["embedder"].encode(s2_query, normalize_embeddings=True).astype(np.float32)
954
+ s2_fetch_k = max(len(stage1_set) * 20, 50000)
955
+ s2_rids, s2_sims = vector_search(s2_emb, req.stage2_vector_field, s2_fetch_k)
956
+ for rid, sim in zip(s2_rids, s2_sims):
957
+ rid = int(rid)
958
+ if rid in stage1_set:
959
+ stage2_scores[rid] = float(sim)
960
+ else: # bm25
961
+ s2_fetch_k = max(len(stage1_set) * 20, 50000)
962
+ s2_rids, s2_scores_arr = bm25_search(s2_query, req.stage2_bm25_field, s2_fetch_k)
963
+ for rid, sc in zip(s2_rids, s2_scores_arr):
964
+ rid = int(rid)
965
+ if rid in stage1_set:
966
+ stage2_scores[rid] = float(sc)
967
+
968
+ for r in stage1_results:
969
+ r["stage1_score"] = r.get("score", 0)
970
+ r["stage2_score"] = round(stage2_scores.get(r["row_id"], -999), 4)
971
+
972
+ stage1_results.sort(key=lambda r: r["stage2_score"], reverse=True)
973
+ result["results"] = stage1_results[:req.stage2_top_k]
974
+ result["stage2"] = {
975
+ "query": s2_query,
976
+ "search_type": req.stage2_search_type,
977
+ "field": req.stage2_vector_field if req.stage2_search_type == "vector" else req.stage2_bm25_field,
978
+ "matched": len(stage2_scores),
979
+ "returned": len(result["results"]),
980
+ }
981
+
982
+ return result
983
+
984
+
985
+ @app.get("/api/stats")
986
+ async def stats():
987
+ """Dataset statistics."""
988
+ conn = sqlite3.connect(state["db_path"])
989
+ total = conn.execute("SELECT COUNT(*) FROM tracks").fetchone()[0]
990
+
991
+ subsets = {}
992
+ for row in conn.execute("SELECT subset, COUNT(*) FROM tracks GROUP BY subset"):
993
+ subsets[row[0]] = row[1]
994
+
995
+ avg_scores = {}
996
+ for row in conn.execute(
997
+ "SELECT AVG(score_average), MIN(score_average), MAX(score_average) FROM tracks WHERE score_average IS NOT NULL"
998
+ ):
999
+ avg_scores = {"mean": round(row[0], 3) if row[0] else None, "min": row[1], "max": row[2]}
1000
+
1001
+ with_caption = conn.execute("SELECT COUNT(*) FROM tracks WHERE has_caption=1").fetchone()[0]
1002
+ with_transcription = conn.execute("SELECT COUNT(*) FROM tracks WHERE has_transcription=1").fetchone()[0]
1003
+
1004
+ faiss_stats = {}
1005
+ for field, idx in state["faiss"].items():
1006
+ faiss_stats[field] = idx.ntotal
1007
+
1008
+ bm25_stats = {}
1009
+ for field, idx in state["bm25"].items():
1010
+ bm25_stats[field] = len(idx.row_ids)
1011
+
1012
+ # Language distribution
1013
+ languages = {}
1014
+ for row in conn.execute(
1015
+ "SELECT language, COUNT(*) FROM tracks WHERE language IS NOT NULL AND language != '' "
1016
+ "GROUP BY language ORDER BY COUNT(*) DESC"
1017
+ ):
1018
+ languages[row[0]] = row[1]
1019
+
1020
+ instrumental = conn.execute("SELECT COUNT(*) FROM tracks WHERE is_instrumental=1").fetchone()[0]
1021
+
1022
+ conn.close()
1023
+
1024
+ return {
1025
+ "total_tracks": total,
1026
+ "subsets": subsets,
1027
+ "score_average": avg_scores,
1028
+ "with_caption": with_caption,
1029
+ "with_transcription": with_transcription,
1030
+ "faiss_indices": faiss_stats,
1031
+ "bm25_indices": bm25_stats,
1032
+ "languages": languages,
1033
+ "instrumental_count": instrumental,
1034
+ "whisper_embeddings": state["faiss"]["whisper"].ntotal if "whisper" in state["faiss"] else 0,
1035
+ }
1036
+
1037
+
1038
+ # ── Main ─────────────────────────────────────────────────────────────────────
1039
+ def main():
1040
+ parser = argparse.ArgumentParser(description="LAION-Tunes Search Server")
1041
+ parser.add_argument("--port", type=int, default=7860)
1042
+ parser.add_argument("--host", type=str, default="0.0.0.0")
1043
+ parser.add_argument("--gpu", type=int, default=0, help="GPU ID for EmbeddingGemma")
1044
+ parser.add_argument("--tei-url", type=str, default=None,
1045
+ help="Use TEI backend for embeddings (e.g. http://localhost:8090)")
1046
+ parser.add_argument("--no-whisper", action="store_true",
1047
+ help="Skip loading whisper encoder (for CPU-only deployment)")
1048
+ args = parser.parse_args()
1049
+
1050
+ app.state.gpu_id = args.gpu
1051
+ app.state.tei_url = args.tei_url
1052
+ app.state.no_whisper = args.no_whisper
1053
+
1054
+ import uvicorn
1055
+ uvicorn.run(app, host=args.host, port=args.port, log_level="info")
1056
+
1057
+
1058
+ if __name__ == "__main__":
1059
+ main()
update_indices.py ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Update search indices with new annotation data.
4
+
5
+ Reads all output parquets, updates SQLite rows that are missing captions/transcriptions,
6
+ rebuilds FAISS caption & transcription indices, and rebuilds all BM25 indices.
7
+ Preserves existing language/is_instrumental columns.
8
+ """
9
+ import os
10
+ import sys
11
+ import json
12
+ import glob
13
+ import time
14
+ import hmac
15
+ import hashlib
16
+ import pickle
17
+ import re
18
+ import sqlite3
19
+ import logging
20
+ from pathlib import Path
21
+ from datetime import timedelta
22
+ from collections import defaultdict
23
+
24
+ import numpy as np
25
+ import pandas as pd
26
+ import faiss
27
+
28
+ sys.path.insert(0, str(Path(__file__).parent))
29
+ from build_search_index import BM25Index, tokenize, tokenize_and_hash
30
+
31
+ BASE_DIR = Path(__file__).parent
32
+ OUTPUT_DIR = Path("/home/deployer/laion/music/output")
33
+ INDEX_DIR = BASE_DIR / "search_index"
34
+ DB_PATH = INDEX_DIR / "metadata.db"
35
+ LYRICS_HMAC_KEY = b"laion-tunes-search-2026-secret-key"
36
+
37
+ logging.basicConfig(
38
+ level=logging.INFO,
39
+ format="%(asctime)s [%(levelname)s] %(message)s",
40
+ datefmt="%H:%M:%S",
41
+ handlers=[logging.StreamHandler(sys.stdout)],
42
+ )
43
+ log = logging.getLogger("updater")
44
+
45
+
46
+ def update_all():
47
+ t0 = time.time()
48
+
49
+ # ── Step 1: Update SQLite with new captions/transcriptions ─────────
50
+ log.info("=" * 60)
51
+ log.info("Updating search indices with new annotation data")
52
+ log.info("=" * 60)
53
+
54
+ output_files = sorted(glob.glob(str(OUTPUT_DIR / "*.parquet")))
55
+ log.info(f"Found {len(output_files)} output parquets")
56
+
57
+ conn = sqlite3.connect(str(DB_PATH))
58
+ conn.execute("PRAGMA journal_mode=WAL")
59
+ conn.execute("PRAGMA synchronous=NORMAL")
60
+
61
+ # Get current counts
62
+ total_tracks = conn.execute("SELECT COUNT(*) FROM tracks").fetchone()[0]
63
+ existing_captions = conn.execute("SELECT COUNT(*) FROM tracks WHERE has_caption=1").fetchone()[0]
64
+ existing_transcriptions = conn.execute("SELECT COUNT(*) FROM tracks WHERE has_transcription=1").fetchone()[0]
65
+ log.info(f"Current DB: {total_tracks:,} tracks, {existing_captions:,} captions, {existing_transcriptions:,} transcriptions")
66
+
67
+ # Build lookup: audio_url -> row_id for tracks missing captions
68
+ log.info("Building audio_url lookup for tracks needing updates...")
69
+ url_to_rowid = {}
70
+ cursor = conn.execute("SELECT row_id, audio_url, has_caption, has_transcription FROM tracks")
71
+ needs_caption = set()
72
+ needs_transcription = set()
73
+ for row_id, audio_url, has_cap, has_trans in cursor:
74
+ url_to_rowid[audio_url] = row_id
75
+ if not has_cap:
76
+ needs_caption.add(audio_url)
77
+ if not has_trans:
78
+ needs_transcription.add(audio_url)
79
+ log.info(f" Tracks needing caption: {len(needs_caption):,}")
80
+ log.info(f" Tracks needing transcription: {len(needs_transcription):,}")
81
+
82
+ # Process each output parquet
83
+ updated_captions = 0
84
+ updated_transcriptions = 0
85
+
86
+ for fi, out_path in enumerate(output_files):
87
+ out_name = Path(out_path).name
88
+ try:
89
+ out_df = pd.read_parquet(out_path)
90
+ except Exception as e:
91
+ log.warning(f" Failed to read {out_name}: {e}")
92
+ continue
93
+
94
+ batch_updates = []
95
+ for _, row in out_df.iterrows():
96
+ audio_url = str(row.get("audio_url", ""))
97
+ if not audio_url or audio_url not in url_to_rowid:
98
+ continue
99
+
100
+ row_id = url_to_rowid[audio_url]
101
+ caption = str(row.get("music_whisper_caption", "")) if pd.notna(row.get("music_whisper_caption")) else ""
102
+ transcription = str(row.get("parakeet_transcription", "")) if pd.notna(row.get("parakeet_transcription")) else ""
103
+
104
+ updates = {}
105
+ if caption and audio_url in needs_caption:
106
+ updates["music_whisper_caption"] = caption
107
+ updates["has_caption"] = 1
108
+ updated_captions += 1
109
+ if transcription and audio_url in needs_transcription:
110
+ updates["parakeet_transcription"] = transcription
111
+ updates["has_transcription"] = 1
112
+ updated_transcriptions += 1
113
+
114
+ if updates:
115
+ set_clause = ", ".join(f"{k}=?" for k in updates.keys())
116
+ vals = list(updates.values()) + [row_id]
117
+ conn.execute(f"UPDATE tracks SET {set_clause} WHERE row_id=?", vals)
118
+
119
+ conn.commit()
120
+
121
+ if (fi + 1) % 10 == 0 or (fi + 1) == len(output_files):
122
+ log.info(f" [{fi+1}/{len(output_files)}] Processed {out_name} | "
123
+ f"+{updated_captions:,} captions, +{updated_transcriptions:,} transcriptions")
124
+
125
+ log.info(f"\nSQLite updated: +{updated_captions:,} captions, +{updated_transcriptions:,} transcriptions")
126
+
127
+ # Verify new counts
128
+ new_captions = conn.execute("SELECT COUNT(*) FROM tracks WHERE has_caption=1").fetchone()[0]
129
+ new_transcriptions = conn.execute("SELECT COUNT(*) FROM tracks WHERE has_transcription=1").fetchone()[0]
130
+ log.info(f" Captions: {existing_captions:,} -> {new_captions:,}")
131
+ log.info(f" Transcriptions: {existing_transcriptions:,} -> {new_transcriptions:,}")
132
+
133
+ # ── Step 2: Rebuild FAISS caption & transcription indices ──────────
134
+ log.info("\nRebuilding FAISS caption & transcription indices from all output parquets...")
135
+
136
+ faiss_caption = faiss.IndexFlatIP(768)
137
+ faiss_transcription = faiss.IndexFlatIP(768)
138
+ idmap_caption = []
139
+ idmap_transcription = []
140
+
141
+ for fi, out_path in enumerate(output_files):
142
+ out_name = Path(out_path).name
143
+ try:
144
+ out_df = pd.read_parquet(out_path)
145
+ except Exception:
146
+ continue
147
+
148
+ cap_vecs, cap_ids = [], []
149
+ trans_vecs, trans_ids = [], []
150
+
151
+ for _, row in out_df.iterrows():
152
+ audio_url = str(row.get("audio_url", ""))
153
+ if audio_url not in url_to_rowid:
154
+ continue
155
+ row_id = url_to_rowid[audio_url]
156
+
157
+ # Caption embedding
158
+ emb = row.get("caption_embedding")
159
+ if emb is not None and isinstance(emb, np.ndarray) and len(emb) == 768:
160
+ vec = emb.astype(np.float32)
161
+ norm = np.linalg.norm(vec)
162
+ if norm > 0:
163
+ vec /= norm
164
+ cap_vecs.append(vec)
165
+ cap_ids.append(row_id)
166
+
167
+ # Transcription embedding
168
+ emb = row.get("transcription_embedding")
169
+ if emb is not None and isinstance(emb, np.ndarray) and len(emb) == 768:
170
+ vec = emb.astype(np.float32)
171
+ norm = np.linalg.norm(vec)
172
+ if norm > 0:
173
+ vec /= norm
174
+ trans_vecs.append(vec)
175
+ trans_ids.append(row_id)
176
+
177
+ if cap_vecs:
178
+ faiss_caption.add(np.stack(cap_vecs))
179
+ idmap_caption.extend(cap_ids)
180
+ if trans_vecs:
181
+ faiss_transcription.add(np.stack(trans_vecs))
182
+ idmap_transcription.extend(trans_ids)
183
+
184
+ if (fi + 1) % 10 == 0 or (fi + 1) == len(output_files):
185
+ log.info(f" [{fi+1}/{len(output_files)}] FAISS caption: {faiss_caption.ntotal:,}, "
186
+ f"transcription: {faiss_transcription.ntotal:,}")
187
+
188
+ # Save new FAISS indices
189
+ log.info(f"\nSaving FAISS caption index: {faiss_caption.ntotal:,} vectors")
190
+ faiss.write_index(faiss_caption, str(INDEX_DIR / "faiss_caption.index"))
191
+ np.save(str(INDEX_DIR / "idmap_caption.npy"), np.array(idmap_caption, dtype=np.int64))
192
+
193
+ log.info(f"Saving FAISS transcription index: {faiss_transcription.ntotal:,} vectors")
194
+ faiss.write_index(faiss_transcription, str(INDEX_DIR / "faiss_transcription.index"))
195
+ np.save(str(INDEX_DIR / "idmap_transcription.npy"), np.array(idmap_transcription, dtype=np.int64))
196
+
197
+ # ── Step 3: Rebuild all BM25 indices from DB ──────────────────────
198
+ log.info("\nRebuilding all BM25 indices from database...")
199
+
200
+ bm25_data = {
201
+ "tags": {"docs": [], "row_ids": []},
202
+ "caption": {"docs": [], "row_ids": []},
203
+ "transcription": {"docs": [], "row_ids": []},
204
+ "lyrics_hashed": {"docs": [], "row_ids": []},
205
+ }
206
+
207
+ cursor = conn.execute(
208
+ "SELECT row_id, tags_text, music_whisper_caption, parakeet_transcription FROM tracks"
209
+ )
210
+ for row_id, tags, caption, transcript in cursor:
211
+ if tags:
212
+ bm25_data["tags"]["docs"].append(tokenize(tags))
213
+ bm25_data["tags"]["row_ids"].append(row_id)
214
+ if caption:
215
+ bm25_data["caption"]["docs"].append(tokenize(caption))
216
+ bm25_data["caption"]["row_ids"].append(row_id)
217
+ if transcript:
218
+ bm25_data["transcription"]["docs"].append(tokenize(transcript))
219
+ bm25_data["transcription"]["row_ids"].append(row_id)
220
+
221
+ for bm25_name, bdata in bm25_data.items():
222
+ if bdata["docs"]:
223
+ idx = BM25Index()
224
+ idx.build(bdata["docs"], bdata["row_ids"])
225
+ with open(INDEX_DIR / f"bm25_{bm25_name}.pkl", "wb") as f:
226
+ pickle.dump(idx, f, protocol=pickle.HIGHEST_PROTOCOL)
227
+ log.info(f" BM25 {bm25_name}: {len(bdata['docs']):,} docs, {len(idx.vocab):,} tokens")
228
+ else:
229
+ log.info(f" BM25 {bm25_name}: 0 docs (skipped)")
230
+
231
+ # ── Step 4: Update language detection for new transcriptions ──────
232
+ log.info("\nDetecting language for new transcriptions...")
233
+ try:
234
+ from langdetect import detect, LangDetectException
235
+
236
+ new_lang_rows = conn.execute(
237
+ "SELECT row_id, parakeet_transcription FROM tracks "
238
+ "WHERE has_transcription=1 AND (language IS NULL OR language='' OR language='unknown')"
239
+ ).fetchall()
240
+ log.info(f" {len(new_lang_rows):,} rows need language detection")
241
+
242
+ updates = []
243
+ for row_id, text in new_lang_rows:
244
+ if not text or len(text.strip()) < 10:
245
+ continue
246
+ try:
247
+ lang = detect(text[:300])
248
+ updates.append((lang, row_id))
249
+ except LangDetectException:
250
+ pass
251
+
252
+ if updates:
253
+ conn.executemany("UPDATE tracks SET language=? WHERE row_id=?", updates)
254
+ conn.commit()
255
+ log.info(f" Updated language for {len(updates):,} rows")
256
+ except ImportError:
257
+ log.warning(" langdetect not installed, skipping language detection")
258
+
259
+ # ── Step 5: Update instrumental flags ─────────────────────────────
260
+ log.info("Updating instrumental flags...")
261
+ conn.execute("""
262
+ UPDATE tracks SET is_instrumental = 1
263
+ WHERE has_lyrics = 0
264
+ AND (parakeet_transcription IS NULL OR LENGTH(parakeet_transcription) < 10)
265
+ AND is_instrumental = 0
266
+ """)
267
+ conn.execute("""
268
+ UPDATE tracks SET is_instrumental = 0
269
+ WHERE has_transcription = 1
270
+ AND LENGTH(parakeet_transcription) >= 10
271
+ AND is_instrumental = 1
272
+ """)
273
+ conn.commit()
274
+ instr = conn.execute("SELECT COUNT(*) FROM tracks WHERE is_instrumental=1").fetchone()[0]
275
+ log.info(f" Instrumental tracks: {instr:,}")
276
+
277
+ conn.close()
278
+
279
+ elapsed = time.time() - t0
280
+ log.info(f"\nDone in {timedelta(seconds=int(elapsed))}")
281
+ log.info("Restart the server to load the updated indices.")
282
+
283
+
284
+ if __name__ == "__main__":
285
+ update_all()
whisper_embeddings/riffusion_000013.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74b952d71827043bd9ab6c23e19068d0f0f4a6027f7c7ed4b7b766258584a013
3
+ size 3489879
whisper_embeddings/sonauto_000001.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96bb2488c814d067a8144764cf79a25362eed8810bf366df2438ac4307e3064c
3
+ size 4941349
whisper_embeddings/udio_000032.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a650987c9246b90f979e15afd12d4838bafee7f18ee99983ff2c99f2e00e6bc
3
+ size 382643