R-Kentaren cocktailpeanut commited on
Commit
e67dec7
·
0 Parent(s):

Duplicate from cocktailpeanut/muscriptor-large

Browse files

Co-authored-by: cocktail peanut <cocktailpeanut@users.noreply.huggingface.co>

Files changed (4) hide show
  1. .gitattributes +35 -0
  2. README.md +171 -0
  3. config.json +8 -0
  4. model.safetensors +3 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ library_name: muscriptor
4
+ tags:
5
+ - music
6
+ - music-transcription
7
+ - automatic-music-transcription
8
+ - amt
9
+ - audio-to-midi
10
+ - midi
11
+ - music-information-retrieval
12
+ - transformer
13
+ - pytorch
14
+ ---
15
+
16
+ # MuScriptor — large (≈1.3B)
17
+
18
+ **MuScriptor** is an open-weight model for **general-purpose, multi-instrument automatic music transcription (AMT)**: it converts a music recording (any genre, multiple simultaneous instruments) into a stream of notes played. This repository hosts the **large** variant (≈1.3B parameters) — the **flagship, best-quality checkpoint**.
19
+
20
+ For a smaller footprint use [`muscriptor-medium`](https://huggingface.co/MuScriptor/muscriptor-medium) (≈300M, good trade-off) or [`muscriptor-small`](https://huggingface.co/MuScriptor/muscriptor-small) (≈100M, fastest).
21
+
22
+ - Developed by [Mirelo](https://www.mirelo.ai/) x [kyutai](https://kyutai.org/)
23
+ - 📄 Paper: *MuScriptor: An Open Model for Multi-Instrument Music Transcription* — Rouard, Krause, Roebel, Simon-Gabriel, Défossez (2026). _<!-- TODO: add arXiv link once public; it will auto-cross-link on the Hub -->_
24
+ - 💻 Code: <https://github.com/muscriptor/muscriptor>
25
+ - 🔊 Audio samples: <https://muscriptor.github.io>
26
+
27
+ ## Table of contents
28
+
29
+ - [Quickstart](#quickstart)
30
+ - [Model description](#model-description)
31
+ - [Model variants](#model-variants)
32
+ - [Intended uses & limitations](#intended-uses--limitations)
33
+ - [Instrument conditioning](#instrument-conditioning)
34
+ - [Training](#training)
35
+ - [Evaluation](#evaluation)
36
+ - [Citation](#citation)
37
+ - [License](#license)
38
+
39
+ ## Quickstart
40
+
41
+ Install the `muscriptor` package (it uses `huggingface_hub` to fetch weights automatically):
42
+
43
+ ```bash
44
+ pip install git+https://github.com/muscriptor/muscriptor.git
45
+ # TODO (PyPI release forthcoming: pip install muscriptor)
46
+ ```
47
+
48
+ ### Python
49
+
50
+ ```python
51
+ from pathlib import Path
52
+ from muscriptor import TranscriptionModel
53
+
54
+ # "large" resolves to hf://MuScriptor/muscriptor-large and downloads on first use.
55
+ model = TranscriptionModel.load_model("large")
56
+
57
+ # Get a MIDI file directly:
58
+ Path("out.mid").write_bytes(model.transcribe_to_midi("audio.wav"))
59
+
60
+ # Or stream note events as they are transcribed:
61
+ for event in model.transcribe("audio.wav"):
62
+ print(event) # NoteStartEvent / NoteEndEvent / ProgressEvent
63
+ ```
64
+
65
+ `load_model` accepts a size keyword (`"small"`/`"medium"`/`"large"`), a local `.safetensors` path, or an `hf://` / `https://` URL. Weights loaded by size keyword (or any `hf://` URL) are cached in the standard Hugging Face cache (`~/.cache/huggingface/hub`, configurable via `HF_HOME`); weights fetched from a plain `http(s)://` URL are cached under `~/.cache/muscriptor/`. Input audio can be WAV or any format `libsndfile` reads (mp3, flac, ogg, m4a, …); it is resampled to 16 kHz mono internally.
66
+
67
+ ### CLI
68
+
69
+ ```bash
70
+ muscriptor transcribe --model large audio.wav -o out.mid
71
+ ```
72
+
73
+ ## Model description
74
+
75
+ MuScriptor performs transcription by **autoregressively predicting a MIDI-like token sequence** given the mel-spectrogram of a short audio segment, following the sequence-to-sequence AMT paradigm (cf. MT3). It deliberately avoids complex architectural tweaks in favor of a simple, decoder-only Transformer.
76
+
77
+ - **Architecture:** decoder-only Transformer (this variant: `dim=1536`, `num_heads=24`, `num_layers=48`).
78
+ - **Input:** raw waveform (16 kHz, mono) of a 5-second segment → mel-spectrogram (STFT `n_fft=2048`, hop 160 → 100 Hz frame rate, 512 mel bins). The spectrogram is projected to the model dimension and used as a prefix condition.
79
+ - **Output tokenization:** MT3-like note events; the 128 MIDI programs are mapped to **36 instrument subgroups** using the `MT3_FULL_PLUS` taxonomy. Decoding is greedy (argmax) by default, with optional classifier-free guidance (CFG).
80
+ - **Inference:** audio is processed in 5-second chunks; note events are emitted in temporal order. Optional **instrument conditioning** stabilizes predictions across chunk boundaries and lets you restrict/customize the transcription (see below).
81
+
82
+ **Note on the representation:** the tokenizer recovers onset/offset timing, pitch, and instrument, but **not velocity**. It also cannot represent two notes of the same pitch and instrument sounding at the same time. Drums are onset-only.
83
+
84
+ ## Model variants
85
+
86
+ | Repo | Params | `dim` | heads | layers | Notes |
87
+ |---|---|---|---|---|---|
88
+ | [`muscriptor-small`](https://huggingface.co/MuScriptor/muscriptor-small) | ≈100M | 768 | 12 | 14 | smallest / fastest |
89
+ | [`muscriptor-medium`](https://huggingface.co/MuScriptor/muscriptor-medium) | ≈300M | 1024 | 16 | 24 | good trade-off |
90
+ | [`muscriptor-large`](https://huggingface.co/MuScriptor/muscriptor-large) | ≈1.3B | 1536 | 24 | 48 | **this model** · best quality |
91
+
92
+ All variants share the same input pipeline, tokenizer, and training recipe; they differ only in latent dimension, attention heads, and depth.
93
+
94
+ ## Intended uses & limitations
95
+
96
+ **Intended uses**
97
+ - General-purpose transcription of real, multi-instrument music across genres (classical → heavy metal) into MIDI.
98
+ - A building block for music information retrieval (chord/key recognition), musicological analysis, generative-modeling data pipelines, and tools for musicians.
99
+
100
+ **Out of scope / use with care**
101
+ - Not a substitute for a hand-annotated score; expect errors, especially on dense mixes, unusual timbres, and heavily processed audio.
102
+ - Velocity/dynamics are **not** produced (see note above).
103
+ - Onset/offset precision is lower for some styles (e.g. choral music), and exact offsets are inherently harder than onsets.
104
+
105
+ **Limitations & biases**
106
+ - Training data skews toward pop and Western classical music, and the instrument distribution is long-tailed (piano/guitar/bass/drums are most frequent). Rare instruments and underrepresented genres may be transcribed less reliably.
107
+ - The fixed `MT3_FULL_PLUS` 36-group instrument taxonomy limits instrument granularity.
108
+ - Simultaneous same-pitch/same-instrument notes cannot be represented by the tokenizer.
109
+
110
+ ## Instrument conditioning
111
+
112
+ The model can be told which instrument groups are present in the track. Supplying the correct set improves quantitative scores and produces more coherent instrument assignments across segments.
113
+
114
+ ```python
115
+ from muscriptor.tokenizer.mt3 import MT3_FULL_PLUS_GROUP_NAMES
116
+
117
+ # `instrument_group` is a space-separated string of MT3_FULL_PLUS group IDs.
118
+ # Convert readable group names to IDs:
119
+ names = ["acoustic_piano", "acoustic_guitar", "acoustic_bass"]
120
+ instrument_group = " ".join(str(MT3_FULL_PLUS_GROUP_NAMES[n]) for n in names) # -> "0 4 7"
121
+
122
+ # Only expect piano, acoustic guitar and bass in this track:
123
+ model.transcribe_to_midi("audio.wav", instrument_group=instrument_group)
124
+ ```
125
+
126
+ ```bash
127
+ muscriptor transcribe --model large --instruments "acoustic_piano,acoustic_guitar,acoustic_bass" audio.wav -o out.mid
128
+ muscriptor list-instruments # show all available group names
129
+ ```
130
+
131
+ ## Evaluation
132
+
133
+ Metrics are instrument-agnostic F1 scores computed with [`mir_eval`](https://github.com/craffel/mir_eval).
134
+
135
+ ### Headline results on `D_Test`
136
+
137
+ `D_Test` is the authors' held-out test set of 372 multi-instrument tracks. Results below are for this 1.3B model with the full training pipeline (`D_Synth` + `D_Real` + `D_RL`), CFG = 2:
138
+
139
+ | Model | Onset F1 | Frame F1 | Offset F1 | Drums F1 | Multi F1 |
140
+ |---|---|---|---|---|---|
141
+ | YourMT3+ (baseline) | 32.5 | 45.5 | 17.8 | 41.4 | 21.9 |
142
+ | **MuScriptor 1.3B** | **60.4** | **72.4** | **48.6** | **49.6** | **47.8** |
143
+
144
+ ### Model-size comparison
145
+
146
+ F1 ↑ on `D_Test` from the paper's scaling study (models trained on `D_Real` only, CFG = 2). Note these ablation numbers omit synthetic pre-training and RL, so they are **lower** than the full-pipeline results above:
147
+
148
+ | Variant | Params | Onset | Frame | Offset | Drums | Multi |
149
+ |---|---|---|---|---|---|---|
150
+ | `muscriptor-small` | 100M | 51.2 | 67.2 | 38.7 | 41.5 | 38.2 |
151
+ | `muscriptor-medium` | 300M | 52.4 | 68.0 | 40.3 | 42.0 | 39.7 |
152
+ | **`muscriptor-large`** | **1.3B** | **53.2** | **68.7** | **41.0** | **42.5** | **40.5** |
153
+
154
+
155
+ ## Citation
156
+
157
+ ```bibtex
158
+ @inproceedings{muscriptor2026,
159
+ title = {MuScriptor: An Open Model for Multi-Instrument Music Transcription},
160
+ author = {Rouard, Simon and Krause, Michael and Roebel, Axel and
161
+ Simon-Gabriel, Carl-Johann and D{\'e}fossez, Alexandre},
162
+ year = {2026},
163
+ note = {Kyutai, Mirelo AI, IRCAM}
164
+ }
165
+ ```
166
+
167
+ <!-- TODO: replace with the final published citation (venue / arXiv id) once available. -->
168
+
169
+ ## License
170
+
171
+ Code released under the [MIT License](https://github.com/muscriptor/muscriptor/blob/main/LICENSE). Weights released under CC-BY-NC.
config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "muscriptor",
3
+ "variant": "large",
4
+ "dim": 1536,
5
+ "num_heads": 24,
6
+ "num_layers": 48,
7
+ "card": 1395
8
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac4eb6ea87dfc26b6ca6b954c6b967ab87ad4c7d08e078b25214f13ed051f397
3
+ size 5465642136