Files changed (1) hide show
  1. README.md +190 -0
README.md CHANGED
@@ -1,3 +1,193 @@
1
  ---
2
  license: cc-by-nc-4.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-nc-4.0
3
+ library_name: muscriptor
4
+ extra_gated_prompt: >-
5
+ MuScriptor is the result of a research collaboration between Mirelo and Kyutai
6
+ whose purpose is to transcribe audio to MIDI/music sheet. It is provided
7
+ primarily for research purposes under the CC BY-NC 4.0 licence supplemented by
8
+ the below specific conditions of use.
9
+
10
+ Specific conditions of use: MuScriptor and any generated content by MuScriptor
11
+ are provided as is without any warranty of any kind, including but not limited
12
+ to any warranty of non-infringement. Use of MuScriptor and its output must
13
+ comply with all applicable laws and must not result in, involve, or facilitate
14
+ any illegal or unauthorized activity. Prohibited uses include, without
15
+ limitation, inputting music files and transcribing them to MIDI/music sheet
16
+ without having all the necessary rights, including intellectual property
17
+ rights, under applicable laws. Accordingly, users of MuScriptor undertake and
18
+ warrant to have all the necessary rights, including intellectual property
19
+ rights, in connection with their use of MuScriptor and its output. We disclaim
20
+ all liability for any non-compliant use and users of MuScriptor shall
21
+ indemnify, defend, and hold harmless Mirelo and Kyutai from and against any
22
+ and all claims, damages, losses, liabilities, and expenses (including
23
+ reasonable attorneys' fees) incurred by Mirelo and/or Kyutai arising out of or
24
+ resulting from their failure to comply with the terms of the CC BY-NC 4.0
25
+ licence and/or these specific conditions of use.
26
+ extra_gated_fields:
27
+ Company or university if applicable: text
28
+ I am a:
29
+ type: select
30
+ options:
31
+ - Musician
32
+ - AI Researcher
33
+ - Other
34
+ tags:
35
+ - music
36
+ - music-transcription
37
+ - automatic-music-transcription
38
+ - amt
39
+ - audio-to-midi
40
+ - midi
41
+ - music-information-retrieval
42
+ - transformer
43
+ - pytorch
44
+ base_model:
45
+ - MuScriptor/muscriptor-medium
46
  ---
47
+
48
+ # MuScriptor β€” medium (β‰ˆ300M)
49
+
50
+ **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 **medium** variant (β‰ˆ300M parameters), the default checkpoint downloaded by the `muscriptor` library.
51
+
52
+ `muscriptor-medium` balances quality and footprint. For the best transcription quality use [`muscriptor-large`](https://huggingface.co/MuScriptor/muscriptor-large) (β‰ˆ1.3B); for the smallest/fastest option use [`muscriptor-small`](https://huggingface.co/MuScriptor/muscriptor-small) (β‰ˆ100M).
53
+
54
+ - Developed by [Mirelo](https://www.mirelo.ai/) x [kyutai](https://kyutai.org/)
55
+ - πŸ“„ 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 -->_
56
+ - πŸ’» Code: <https://github.com/muscriptor/muscriptor>
57
+ - πŸ”Š Audio samples: <https://muscriptor.github.io>
58
+
59
+ ## Table of contents
60
+
61
+ - [Quickstart](#quickstart)
62
+ - [Model description](#model-description)
63
+ - [Model variants](#model-variants)
64
+ - [Intended uses & limitations](#intended-uses--limitations)
65
+ - [Instrument conditioning](#instrument-conditioning)
66
+ - [Training](#training)
67
+ - [Evaluation](#evaluation)
68
+ - [Citation](#citation)
69
+ - [License](#license)
70
+
71
+ ## Quickstart
72
+
73
+ Install the `muscriptor` package (it uses `huggingface_hub` to fetch weights automatically):
74
+
75
+ ```bash
76
+ pip install git+https://github.com/muscriptor/muscriptor.git
77
+ # TODO (PyPI release forthcoming: pip install muscriptor)
78
+ ```
79
+
80
+ ### Python
81
+
82
+ ```python
83
+ from pathlib import Path
84
+ from muscriptor import TranscriptionModel
85
+
86
+ # "medium" resolves to hf://MuScriptor/muscriptor-medium and downloads on first use.
87
+ model = TranscriptionModel.load_model("medium")
88
+
89
+ # Get a MIDI file directly:
90
+ Path("out.mid").write_bytes(model.transcribe_to_midi("audio.wav"))
91
+
92
+ # Or stream note events as they are transcribed:
93
+ for event in model.transcribe("audio.wav"):
94
+ print(event) # NoteStartEvent / NoteEndEvent / ProgressEvent
95
+ ```
96
+
97
+ `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.
98
+
99
+ ### CLI
100
+
101
+ ```bash
102
+ muscriptor transcribe --model medium audio.wav -o out.mid
103
+ ```
104
+
105
+ ## Model description
106
+
107
+ 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.
108
+
109
+ - **Architecture:** decoder-only Transformer (this variant: `dim=1024`, `num_heads=16`, `num_layers=24`).
110
+ - **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.
111
+ - **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).
112
+ - **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).
113
+
114
+ **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.
115
+
116
+ ## Model variants
117
+
118
+ | Repo | Params | `dim` | heads | layers | Notes |
119
+ |---|---|---|---|---|---|
120
+ | [`muscriptor-small`](https://huggingface.co/MuScriptor/muscriptor-small) | β‰ˆ100M | 768 | 12 | 14 | smallest / fastest |
121
+ | [`muscriptor-medium`](https://huggingface.co/MuScriptor/muscriptor-medium) | β‰ˆ300M | 1024 | 16 | 24 | **this model** Β· good trade-off |
122
+ | [`muscriptor-large`](https://huggingface.co/MuScriptor/muscriptor-large) | β‰ˆ1.3B | 1536 | 24 | 48 | best quality |
123
+
124
+ All variants share the same input pipeline, tokenizer, and training recipe; they differ only in latent dimension, attention heads, and depth.
125
+
126
+ ## Intended uses & limitations
127
+
128
+ **Intended uses**
129
+ - General-purpose transcription of real, multi-instrument music across genres (classical β†’ heavy metal) into MIDI.
130
+ - A building block for music information retrieval (chord/key recognition), musicological analysis, generative-modeling data pipelines, and tools for musicians.
131
+
132
+ **Out of scope / use with care**
133
+ - Not a substitute for a hand-annotated score; expect errors, especially on dense mixes, unusual timbres, and heavily processed audio.
134
+ - Velocity/dynamics are **not** produced (see note above).
135
+ - Onset/offset precision is lower for some styles (e.g. choral music), and exact offsets are inherently harder than onsets.
136
+
137
+ **Limitations & biases**
138
+ - 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.
139
+ - The fixed `MT3_FULL_PLUS` 36-group instrument taxonomy limits instrument granularity.
140
+ - Simultaneous same-pitch/same-instrument notes cannot be represented by the tokenizer.
141
+
142
+ ## Instrument conditioning
143
+
144
+ 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.
145
+
146
+ ```python
147
+ from muscriptor.tokenizer.mt3 import MT3_FULL_PLUS_GROUP_NAMES
148
+
149
+ # `instrument_group` is a space-separated string of MT3_FULL_PLUS group IDs.
150
+ # Convert readable group names to IDs:
151
+ names = ["acoustic_piano", "acoustic_guitar", "acoustic_bass"]
152
+ instrument_group = " ".join(str(MT3_FULL_PLUS_GROUP_NAMES[n]) for n in names) # -> "0 4 7"
153
+
154
+ # Only expect piano, acoustic guitar and bass in this track:
155
+ model.transcribe_to_midi("audio.wav", instrument_group=instrument_group)
156
+ ```
157
+
158
+ ```bash
159
+ muscriptor transcribe --model medium --instruments "acoustic_piano,acoustic_guitar,acoustic_bass" audio.wav -o out.mid
160
+ muscriptor list-instruments # show all available group names
161
+ ```
162
+
163
+ ## Evaluation
164
+
165
+ Metrics are instrument-agnostic F1 scores computed with [`mir_eval`](https://github.com/craffel/mir_eval) on `D_Test`, the authors' held-out test set of 372 multi-instrument tracks.
166
+
167
+ **Model-size comparison** (F1 ↑; from the paper's scaling study, models trained on `D_Real` only, CFG = 2):
168
+
169
+ | Variant | Params | Onset | Frame | Offset | Drums | Multi |
170
+ |---|---|---|---|---|---|---|
171
+ | `muscriptor-small` | 100M | 51.2 | 67.2 | 38.7 | 41.5 | 38.2 |
172
+ | **`muscriptor-medium`** | **300M** | **52.4** | **68.0** | **40.3** | **42.0** | **39.7** |
173
+ | `muscriptor-large` | 1.3B | 53.2 | 68.7 | 41.0 | 42.5 | 40.5 |
174
+
175
+ These numbers come from the model-size ablation, which trains on real audio **only**. The **released checkpoints additionally use synthetic pre-training and RL post-training**, which improve real-world quality substantially beyond these figures. See [`muscriptor-large`](https://huggingface.co/MuScriptor/muscriptor-large) and the paper for per-dataset results.
176
+
177
+ ## Citation
178
+
179
+ ```bibtex
180
+ @inproceedings{muscriptor2026,
181
+ title = {MuScriptor: An Open Model for Multi-Instrument Music Transcription},
182
+ author = {Rouard, Simon and Krause, Michael and Roebel, Axel and
183
+ Simon-Gabriel, Carl-Johann and D{\'e}fossez, Alexandre},
184
+ year = {2026},
185
+ note = {Kyutai, Mirelo AI, IRCAM}
186
+ }
187
+ ```
188
+
189
+ <!-- TODO: replace with the final published citation (venue / arXiv id) once available. -->
190
+
191
+ ## License
192
+
193
+ Code released under the [MIT License](https://github.com/muscriptor/muscriptor/blob/main/LICENSE). Weights released under CC-BY-NC.