fpp-ableton commited on
Commit
bedfc1d
·
verified ·
1 Parent(s): 7df68ac

Add MuScriptor small + medium ONNX (INT8), tools, notice

Browse files
LICENSE ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Attribution-NonCommercial 4.0 International
2
+
3
+ =======================================================================
4
+
5
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
6
+ does not provide legal services or legal advice. Distribution of
7
+ Creative Commons public licenses does not create a lawyer-client or
8
+ other relationship. Creative Commons makes its licenses and related
9
+ information available on an "as-is" basis. Creative Commons gives no
10
+ warranties regarding its licenses, any material licensed under their
11
+ terms and conditions, or any related information. Creative Commons
12
+ disclaims all liability for damages resulting from their use to the
13
+ fullest extent possible.
14
+
15
+ Using Creative Commons Public Licenses
16
+
17
+ Creative Commons public licenses provide a standard set of terms and
18
+ conditions that creators and other rights holders may use to share
19
+ original works of authorship and other material subject to copyright
20
+ and certain other rights specified in the public license below. The
21
+ following considerations are for informational purposes only, are not
22
+ exhaustive, and do not form part of our licenses.
23
+
24
+ Considerations for licensors: Our public licenses are
25
+ intended for use by those authorized to give the public
26
+ permission to use material in ways otherwise restricted by
27
+ copyright and certain other rights. Our licenses are
28
+ irrevocable. Licensors should read and understand the terms
29
+ and conditions of the license they choose before applying it.
30
+ Licensors should also secure all rights necessary before
31
+ applying our licenses so that the public can reuse the
32
+ material as expected. Licensors should clearly mark any
33
+ material not subject to the license. This includes other CC-
34
+ licensed material, or material used under an exception or
35
+ limitation to copyright. More considerations for licensors:
36
+ wiki.creativecommons.org/Considerations_for_licensors
37
+
38
+ Considerations for the public: By using one of our public
39
+ licenses, a licensor grants the public permission to use the
40
+ licensed material under specified terms and conditions. If
41
+ the licensor's permission is not necessary for any reason--for
42
+ example, because of any applicable exception or limitation to
43
+ copyright--then that use is not regulated by the license. Our
44
+ licenses grant only permissions under copyright and certain
45
+ other rights that a licensor has authority to grant. Use of
46
+ the licensed material may still be restricted for other
47
+ reasons, including because others have copyright or other
48
+ rights in the material. A licensor may make special requests,
49
+ such as asking that all changes be marked or described.
50
+ Although not required by our licenses, you are encouraged to
51
+ respect those requests where reasonable. More considerations
52
+ for the public:
53
+ wiki.creativecommons.org/Considerations_for_licensees
54
+
55
+ =======================================================================
56
+
57
+ Creative Commons Attribution-NonCommercial 4.0 International Public
58
+ License
59
+
60
+ By exercising the Licensed Rights (defined below), You accept and agree
61
+ to be bound by the terms and conditions of this Creative Commons
62
+ Attribution-NonCommercial 4.0 International Public License ("Public
63
+ License"). To the extent this Public License may be interpreted as a
64
+ contract, You are granted the Licensed Rights in consideration of Your
65
+ acceptance of these terms and conditions, and the Licensor grants You
66
+ such rights in consideration of benefits the Licensor receives from
67
+ making the Licensed Material available under these terms and
68
+ conditions.
69
+
70
+
71
+ Section 1 -- Definitions.
72
+
73
+ a. Adapted Material means material subject to Copyright and Similar
74
+ Rights that is derived from or based upon the Licensed Material
75
+ and in which the Licensed Material is translated, altered,
76
+ arranged, transformed, or otherwise modified in a manner requiring
77
+ permission under the Copyright and Similar Rights held by the
78
+ Licensor. For purposes of this Public License, where the Licensed
79
+ Material is a musical work, performance, or sound recording,
80
+ Adapted Material is always produced where the Licensed Material is
81
+ synched in timed relation with a moving image.
82
+
83
+ b. Adapter's License means the license You apply to Your Copyright
84
+ and Similar Rights in Your contributions to Adapted Material in
85
+ accordance with the terms and conditions of this Public License.
86
+
87
+ c. Copyright and Similar Rights means copyright and/or similar rights
88
+ closely related to copyright including, without limitation,
89
+ performance, broadcast, sound recording, and Sui Generis Database
90
+ Rights, without regard to how the rights are labeled or
91
+ categorized. For purposes of this Public License, the rights
92
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
93
+ Rights.
94
+ d. Effective Technological Measures means those measures that, in the
95
+ absence of proper authority, may not be circumvented under laws
96
+ fulfilling obligations under Article 11 of the WIPO Copyright
97
+ Treaty adopted on December 20, 1996, and/or similar international
98
+ agreements.
99
+
100
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
101
+ any other exception or limitation to Copyright and Similar Rights
102
+ that applies to Your use of the Licensed Material.
103
+
104
+ f. Licensed Material means the artistic or literary work, database,
105
+ or other material to which the Licensor applied this Public
106
+ License.
107
+
108
+ g. Licensed Rights means the rights granted to You subject to the
109
+ terms and conditions of this Public License, which are limited to
110
+ all Copyright and Similar Rights that apply to Your use of the
111
+ Licensed Material and that the Licensor has authority to license.
112
+
113
+ h. Licensor means the individual(s) or entity(ies) granting rights
114
+ under this Public License.
115
+
116
+ i. NonCommercial means not primarily intended for or directed towards
117
+ commercial advantage or monetary compensation. For purposes of
118
+ this Public License, the exchange of the Licensed Material for
119
+ other material subject to Copyright and Similar Rights by digital
120
+ file-sharing or similar means is NonCommercial provided there is
121
+ no payment of monetary compensation in connection with the
122
+ exchange.
123
+
124
+ j. Share means to provide material to the public by any means or
125
+ process that requires permission under the Licensed Rights, such
126
+ as reproduction, public display, public performance, distribution,
127
+ dissemination, communication, or importation, and to make material
128
+ available to the public including in ways that members of the
129
+ public may access the material from a place and at a time
130
+ individually chosen by them.
131
+
132
+ k. Sui Generis Database Rights means rights other than copyright
133
+ resulting from Directive 96/9/EC of the European Parliament and of
134
+ the Council of 11 March 1996 on the legal protection of databases,
135
+ as amended and/or succeeded, as well as other essentially
136
+ equivalent rights anywhere in the world.
137
+
138
+ l. You means the individual or entity exercising the Licensed Rights
139
+ under this Public License. Your has a corresponding meaning.
140
+
141
+
142
+ Section 2 -- Scope.
143
+
144
+ a. License grant.
145
+
146
+ 1. Subject to the terms and conditions of this Public License,
147
+ the Licensor hereby grants You a worldwide, royalty-free,
148
+ non-sublicensable, non-exclusive, irrevocable license to
149
+ exercise the Licensed Rights in the Licensed Material to:
150
+
151
+ a. reproduce and Share the Licensed Material, in whole or
152
+ in part, for NonCommercial purposes only; and
153
+
154
+ b. produce, reproduce, and Share Adapted Material for
155
+ NonCommercial purposes only.
156
+
157
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
158
+ Exceptions and Limitations apply to Your use, this Public
159
+ License does not apply, and You do not need to comply with
160
+ its terms and conditions.
161
+
162
+ 3. Term. The term of this Public License is specified in Section
163
+ 6(a).
164
+
165
+ 4. Media and formats; technical modifications allowed. The
166
+ Licensor authorizes You to exercise the Licensed Rights in
167
+ all media and formats whether now known or hereafter created,
168
+ and to make technical modifications necessary to do so. The
169
+ Licensor waives and/or agrees not to assert any right or
170
+ authority to forbid You from making technical modifications
171
+ necessary to exercise the Licensed Rights, including
172
+ technical modifications necessary to circumvent Effective
173
+ Technological Measures. For purposes of this Public License,
174
+ simply making modifications authorized by this Section 2(a)
175
+ (4) never produces Adapted Material.
176
+
177
+ 5. Downstream recipients.
178
+
179
+ a. Offer from the Licensor -- Licensed Material. Every
180
+ recipient of the Licensed Material automatically
181
+ receives an offer from the Licensor to exercise the
182
+ Licensed Rights under the terms and conditions of this
183
+ Public License.
184
+
185
+ b. No downstream restrictions. You may not offer or impose
186
+ any additional or different terms or conditions on, or
187
+ apply any Effective Technological Measures to, the
188
+ Licensed Material if doing so restricts exercise of the
189
+ Licensed Rights by any recipient of the Licensed
190
+ Material.
191
+
192
+ 6. No endorsement. Nothing in this Public License constitutes or
193
+ may be construed as permission to assert or imply that You
194
+ are, or that Your use of the Licensed Material is, connected
195
+ with, or sponsored, endorsed, or granted official status by,
196
+ the Licensor or others designated to receive attribution as
197
+ provided in Section 3(a)(1)(A)(i).
198
+
199
+ b. Other rights.
200
+
201
+ 1. Moral rights, such as the right of integrity, are not
202
+ licensed under this Public License, nor are publicity,
203
+ privacy, and/or other similar personality rights; however, to
204
+ the extent possible, the Licensor waives and/or agrees not to
205
+ assert any such rights held by the Licensor to the limited
206
+ extent necessary to allow You to exercise the Licensed
207
+ Rights, but not otherwise.
208
+
209
+ 2. Patent and trademark rights are not licensed under this
210
+ Public License.
211
+
212
+ 3. To the extent possible, the Licensor waives any right to
213
+ collect royalties from You for the exercise of the Licensed
214
+ Rights, whether directly or through a collecting society
215
+ under any voluntary or waivable statutory or compulsory
216
+ licensing scheme. In all other cases the Licensor expressly
217
+ reserves any right to collect such royalties, including when
218
+ the Licensed Material is used other than for NonCommercial
219
+ purposes.
220
+
221
+
222
+ Section 3 -- License Conditions.
223
+
224
+ Your exercise of the Licensed Rights is expressly made subject to the
225
+ following conditions.
226
+
227
+ a. Attribution.
228
+
229
+ 1. If You Share the Licensed Material (including in modified
230
+ form), You must:
231
+
232
+ a. retain the following if it is supplied by the Licensor
233
+ with the Licensed Material:
234
+
235
+ i. identification of the creator(s) of the Licensed
236
+ Material and any others designated to receive
237
+ attribution, in any reasonable manner requested by
238
+ the Licensor (including by pseudonym if
239
+ designated);
240
+
241
+ ii. a copyright notice;
242
+
243
+ iii. a notice that refers to this Public License;
244
+
245
+ iv. a notice that refers to the disclaimer of
246
+ warranties;
247
+
248
+ v. a URI or hyperlink to the Licensed Material to the
249
+ extent reasonably practicable;
250
+
251
+ b. indicate if You modified the Licensed Material and
252
+ retain an indication of any previous modifications; and
253
+
254
+ c. indicate the Licensed Material is licensed under this
255
+ Public License, and include the text of, or the URI or
256
+ hyperlink to, this Public License.
257
+
258
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
259
+ reasonable manner based on the medium, means, and context in
260
+ which You Share the Licensed Material. For example, it may be
261
+ reasonable to satisfy the conditions by providing a URI or
262
+ hyperlink to a resource that includes the required
263
+ information.
264
+
265
+ 3. If requested by the Licensor, You must remove any of the
266
+ information required by Section 3(a)(1)(A) to the extent
267
+ reasonably practicable.
268
+
269
+ 4. If You Share Adapted Material You produce, the Adapter's
270
+ License You apply must not prevent recipients of the Adapted
271
+ Material from complying with this Public License.
272
+
273
+
274
+ Section 4 -- Sui Generis Database Rights.
275
+
276
+ Where the Licensed Rights include Sui Generis Database Rights that
277
+ apply to Your use of the Licensed Material:
278
+
279
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
280
+ to extract, reuse, reproduce, and Share all or a substantial
281
+ portion of the contents of the database for NonCommercial purposes
282
+ only;
283
+
284
+ b. if You include all or a substantial portion of the database
285
+ contents in a database in which You have Sui Generis Database
286
+ Rights, then the database in which You have Sui Generis Database
287
+ Rights (but not its individual contents) is Adapted Material; and
288
+
289
+ c. You must comply with the conditions in Section 3(a) if You Share
290
+ all or a substantial portion of the contents of the database.
291
+
292
+ For the avoidance of doubt, this Section 4 supplements and does not
293
+ replace Your obligations under this Public License where the Licensed
294
+ Rights include other Copyright and Similar Rights.
295
+
296
+
297
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
298
+
299
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
300
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
301
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
302
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
303
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
304
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
305
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
306
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
307
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
308
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
309
+
310
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
311
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
312
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
313
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
314
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
315
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
316
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
317
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
318
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
319
+
320
+ c. The disclaimer of warranties and limitation of liability provided
321
+ above shall be interpreted in a manner that, to the extent
322
+ possible, most closely approximates an absolute disclaimer and
323
+ waiver of all liability.
324
+
325
+
326
+ Section 6 -- Term and Termination.
327
+
328
+ a. This Public License applies for the term of the Copyright and
329
+ Similar Rights licensed here. However, if You fail to comply with
330
+ this Public License, then Your rights under this Public License
331
+ terminate automatically.
332
+
333
+ b. Where Your right to use the Licensed Material has terminated under
334
+ Section 6(a), it reinstates:
335
+
336
+ 1. automatically as of the date the violation is cured, provided
337
+ it is cured within 30 days of Your discovery of the
338
+ violation; or
339
+
340
+ 2. upon express reinstatement by the Licensor.
341
+
342
+ For the avoidance of doubt, this Section 6(b) does not affect any
343
+ right the Licensor may have to seek remedies for Your violations
344
+ of this Public License.
345
+
346
+ c. For the avoidance of doubt, the Licensor may also offer the
347
+ Licensed Material under separate terms or conditions or stop
348
+ distributing the Licensed Material at any time; however, doing so
349
+ will not terminate this Public License.
350
+
351
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
352
+ License.
353
+
354
+
355
+ Section 7 -- Other Terms and Conditions.
356
+
357
+ a. The Licensor shall not be bound by any additional or different
358
+ terms or conditions communicated by You unless expressly agreed.
359
+
360
+ b. Any arrangements, understandings, or agreements regarding the
361
+ Licensed Material not stated herein are separate from and
362
+ independent of the terms and conditions of this Public License.
363
+
364
+
365
+ Section 8 -- Interpretation.
366
+
367
+ a. For the avoidance of doubt, this Public License does not, and
368
+ shall not be interpreted to, reduce, limit, restrict, or impose
369
+ conditions on any use of the Licensed Material that could lawfully
370
+ be made without permission under this Public License.
371
+
372
+ b. To the extent possible, if any provision of this Public License is
373
+ deemed unenforceable, it shall be automatically reformed to the
374
+ minimum extent necessary to make it enforceable. If the provision
375
+ cannot be reformed, it shall be severed from this Public License
376
+ without affecting the enforceability of the remaining terms and
377
+ conditions.
378
+
379
+ c. No term or condition of this Public License will be waived and no
380
+ failure to comply consented to unless expressly agreed to by the
381
+ Licensor.
382
+
383
+ d. Nothing in this Public License constitutes or may be interpreted
384
+ as a limitation upon, or waiver of, any privileges and immunities
385
+ that apply to the Licensor or You, including from the legal
386
+ processes of any jurisdiction or authority.
387
+
388
+ =======================================================================
389
+
390
+ Creative Commons is not a party to its public
391
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
392
+ its public licenses to material it publishes and in those instances
393
+ will be considered the “Licensor.” The text of the Creative Commons
394
+ public licenses is dedicated to the public domain under the CC0 Public
395
+ Domain Dedication. Except for the limited purpose of indicating that
396
+ material is shared under a Creative Commons public license or as
397
+ otherwise permitted by the Creative Commons policies published at
398
+ creativecommons.org/policies, Creative Commons does not authorize the
399
+ use of the trademark "Creative Commons" or any other trademark or logo
400
+ of Creative Commons without its prior written consent including,
401
+ without limitation, in connection with any unauthorized modifications
402
+ to any of its public licenses or any other arrangements,
403
+ understandings, or agreements concerning use of licensed material. For
404
+ the avoidance of doubt, this paragraph does not form part of the
405
+ public licenses.
406
+
407
+ Creative Commons may be contacted at creativecommons.org.
408
+
NOTICE.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Notice
2
+
3
+ These ONNX files are a **format conversion** of the MuScriptor weights
4
+ ([MuScriptor/muscriptor-small](https://huggingface.co/MuScriptor/muscriptor-small) and
5
+ [MuScriptor/muscriptor-medium](https://huggingface.co/MuScriptor/muscriptor-medium)) by
6
+ **Mirelo** and **Kyutai** (with IRCAM). Nothing was retrained or fine-tuned. All credit for the model
7
+ belongs to its authors:
8
+
9
+ > Rouard, Krause, Roebel, Simon-Gabriel, Défossez. *MuScriptor: An Open Model for Multi-Instrument
10
+ > Music Transcription.* arXiv:2607.08168, 2026. https://arxiv.org/abs/2607.08168
11
+
12
+ This repository is not affiliated with or endorsed by Mirelo or Kyutai.
13
+
14
+ ## Changes made (CC BY-NC 4.0 §3(a)(1)(B))
15
+
16
+ - Re-expressed the PyTorch model as two ONNX graphs (conditioner with in-graph log-mel front end; decoder with
17
+ an explicit KV cache). See `tools/export_muscriptor_onnx.py`.
18
+ - Quantized the decoder's weight matrices to INT8 (the LM head and embeddings stay float32). See `tools/quantize_int8.py`.
19
+
20
+ ## License
21
+
22
+ Weights and conversions: [CC BY-NC 4.0](LICENSE) — **non-commercial use only**, supplemented by the upstream
23
+ conditions of use below. The scripts in `tools/` import the MIT-licensed upstream
24
+ [muscriptor](https://github.com/muscriptor/muscriptor) code and are provided as is.
25
+
26
+ ## Upstream specific conditions of use (reproduced verbatim)
27
+
28
+ MuScriptor is the result of a research collaboration between Mirelo and Kyutai whose purpose is to transcribe audio to MIDI/music sheet. It is provided primarily for research purposes under the CC BY-NC 4.0 licence supplemented by the below specific conditions of use.
29
+ Specific conditions of use: MuScriptor and any generated content by MuScriptor are provided as is without any warranty of any kind, including but not limited to any warranty of non-infringement. Use of MuScriptor and its output must comply with all applicable laws and must not result in, involve, or facilitate any illegal or unauthorized activity. Prohibited uses include, without limitation, inputting music files and transcribing them to MIDI/music sheet without having all the necessary rights, including intellectual property rights, under applicable laws. Accordingly, users of MuScriptor undertake and warrant to have all the necessary rights, including intellectual property rights, in connection with their use of MuScriptor and its output. We disclaim all liability for any non-compliant use and users of MuScriptor shall indemnify, defend, and hold harmless Mirelo and Kyutai from and against any and all claims, damages, losses, liabilities, and expenses (including reasonable attorneys' fees) incurred by Mirelo and/or Kyutai arising out of or resulting from their failure to comply with the terms of the CC BY-NC 4.0 licence and/or these specific conditions of use.
README.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ base_model:
4
+ - MuScriptor/muscriptor-small
5
+ - MuScriptor/muscriptor-medium
6
+ library_name: onnxruntime
7
+ tags:
8
+ - music
9
+ - music-transcription
10
+ - automatic-music-transcription
11
+ - audio-to-midi
12
+ - onnx
13
+ - onnxruntime
14
+ - int8
15
+ ---
16
+
17
+ # MuScriptor — ONNX (small & medium, INT8)
18
+
19
+ ONNX Runtime conversions of [MuScriptor Small](https://huggingface.co/MuScriptor/muscriptor-small) (≈100M params)
20
+ and [MuScriptor Medium](https://huggingface.co/MuScriptor/muscriptor-medium) (≈300M params), the multi-instrument
21
+ music transcription model by **Mirelo × Kyutai**. Made for running the model on CPU through ONNX Runtime
22
+ (e.g. `onnxruntime-node`) without PyTorch. **Format conversion only — nothing retrained.** See [NOTICE.md](NOTICE.md)
23
+ for attribution, the list of changes and the upstream conditions of use.
24
+
25
+ > **License: CC BY-NC 4.0 — non-commercial use only**, plus the upstream conditions of use in [NOTICE.md](NOTICE.md).
26
+ > By using these files you accept them.
27
+
28
+ ## Files
29
+
30
+ | File | Size | What |
31
+ |---|---:|---|
32
+ | `small/cond.onnx` | 23.6 MB | conditioner: audio → prefix embeddings (log-mel inside the graph) |
33
+ | `small/lm-int8.onnx` | 108.5 MB | decoder, INT8 weights, KV cache in/out |
34
+ | `medium/cond.onnx` | 25.1 MB | conditioner |
35
+ | `medium/lm-int8.onnx` | 315.2 MB | decoder, INT8 weights |
36
+ | `SHA256SUMS` | | checksums of the four graphs |
37
+ | `tools/` | | export + quantization scripts that produced these files |
38
+
39
+ ## Graph interface (both sizes)
40
+
41
+ `cond.onnx`
42
+
43
+ | | |
44
+ |---|---|
45
+ | `audio` | `f32 [1, 80000]` — one 5 s chunk at 16 kHz mono, zero-padded |
46
+ | `instrument` | `i64 [1, K]` — MT3_FULL_PLUS instrument group ids; `-1` = unconditional |
47
+ | `dataset` | `i64 [1, 1]` — always `-1` |
48
+ | → `prefix` | `f32 [1, 501 + 1 + K, dim]` |
49
+
50
+ The mel spectrogram (reflect pad, STFT as a DFT convolution, HTK mel bank, `log(x + 1e-6)`) runs **inside** the graph
51
+ and uses the checkpoint's own window and filterbank buffers, which differ from the textbook formulas by about 2.4e-4.
52
+
53
+ `lm-int8.onnx`
54
+
55
+ | | |
56
+ |---|---|
57
+ | `tokens` | `i64 [1, S]` |
58
+ | `prefix` | `f32 [1, P, dim]` — conditioner output on the first call; `P = 0` afterwards |
59
+ | `past_k`, `past_v` | `f32 [L, 1, T_past, H, 64]` — empty (`T_past = 0`) on the first call |
60
+ | → `logits` | `f32 [1, card]` — last position only |
61
+ | → `present_k`, `present_v` | the cache grown by this call |
62
+
63
+ | | dim | heads (H) | layers (L) | card (vocab) | initial token |
64
+ |---|---:|---:|---:|---:|---:|
65
+ | small | 768 | 12 | 14 | 1393 | 1393 |
66
+ | medium | 1024 | 16 | 24 | 1395 | 1395 |
67
+
68
+ Positions continue from `T_past`; the same graph serves prefill and single-token decoding. Decoding is greedy over the
69
+ first 1393 logits, 5 s chunks, MT3 token vocabulary, with the tie-prologue handling described in the
70
+ [reference implementation](https://github.com/muscriptor/muscriptor). Prefill the first call with
71
+ `[initial_token]` (plus a forced tie prologue for chunks after the first).
72
+
73
+ ## Fidelity
74
+
75
+ fp32 exports vs the PyTorch reference, same 5 s chunk: conditioner output max |Δ| 5.7e-5 (small) / 7.1e-5 (medium);
76
+ greedy token sequences identical (24/24 and 27/27 tokens).
77
+
78
+ INT8 decoders, teacher-forced top-1 agreement with the fp32 reference over the reference's greedy tokens
79
+ (5 short musical clips, 175 tokens for small and 216 for medium — a small sample, not a benchmark):
80
+
81
+ | | fp32 | INT8 (these files) |
82
+ |---|---:|---:|
83
+ | small | 100% | 96.6% |
84
+ | medium | 100% | 98.6% |
85
+
86
+ INT4 weight-only variants were also tried (small 96.6%, medium 94.0%) and are not published here.
87
+
88
+ ## Reproducing
89
+
90
+ ```bash
91
+ python tools/export_muscriptor_onnx.py --size small --checkpoint model.safetensors --reference <muscriptor repo> --out out/small
92
+ python tools/quantize_int8.py out/small/lm.onnx out/small/lm-int8.onnx --card 1393
93
+ ```
94
+
95
+ The upstream weights are gated on Hugging Face: accept their conditions on the model pages first.
96
+
97
+ ## Citation
98
+
99
+ ```bibtex
100
+ @misc{rouard2026muscriptoropenmodelmultiinstrument,
101
+ title={MuScriptor: An Open Model for Multi-Instrument Music Transcription},
102
+ author={Simon Rouard and Michael Krause and Axel Roebel and Carl-Johann Simon-Gabriel and Alexandre D\'efossez},
103
+ year={2026},
104
+ eprint={2607.08168},
105
+ archivePrefix={arXiv},
106
+ primaryClass={cs.SD},
107
+ url={https://arxiv.org/abs/2607.08168}
108
+ }
109
+ ```
SHA256SUMS ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ 566d51d0460bb521af32891f75a7a052e4c21d2b3ee2540b851873de3b4fcd3b small/cond.onnx
2
+ a81e10580de32d45f88fc280c36107e507c89164aee6d1e87b7e74d43e880926 small/lm-int8.onnx
3
+ 27a26d8339ab971558f2402d303a1c9533a310678d34834f9aefe13fb6484c3f medium/cond.onnx
4
+ 514409bb224d02850b8ce4f14336c58a8c6dc38470417ec7fb29c80951c1c104 medium/lm-int8.onnx
medium/cond.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27a26d8339ab971558f2402d303a1c9533a310678d34834f9aefe13fb6484c3f
3
+ size 25121019
medium/lm-int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:514409bb224d02850b8ce4f14336c58a8c6dc38470417ec7fb29c80951c1c104
3
+ size 315231060
small/cond.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:566d51d0460bb521af32891f75a7a052e4c21d2b3ee2540b851873de3b4fcd3b
3
+ size 23565559
small/lm-int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a81e10580de32d45f88fc280c36107e507c89164aee6d1e87b7e74d43e880926
3
+ size 108492863
tools/export_muscriptor_onnx.py ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Export MuScriptor (small / medium) to two ONNX graphs for onnxruntime-node.
3
+
4
+ Dev-time tool only; nothing here ships inside the extension.
5
+
6
+ cond.onnx audio f32[1,80000] (5 s @ 16 kHz) + instrument i64[1,K] + dataset i64[1,1]
7
+ -> prefix f32[1, 501+1+K, dim]
8
+ The log-mel front end (reflect pad, STFT, mel bank, log) runs inside the graph
9
+ using the *checkpoint's own* window and filterbank buffers, which differ from the
10
+ textbook formulas by ~2.4e-4 and matter to the model.
11
+ instrument ids are raw group ids, -1 = unconditional (same for dataset).
12
+ lm.onnx tokens i64[1,S] + prefix f32[1,P,dim] + past_k/past_v f32[L,1,T,H,Dh]
13
+ -> logits f32[1,card] (last position only) + present_k/present_v
14
+ Explicit KV cache; positions continue from T. One graph serves prefill and decode.
15
+
16
+ Usage (from a venv with torch, onnx, onnxruntime, einops, safetensors, mido, soundfile):
17
+ python export_muscriptor_onnx.py --size small --checkpoint ckpt-small/model.safetensors \
18
+ --reference /path/to/muscriptor/repo --out out/small
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import argparse
24
+ import math
25
+ import sys
26
+ from pathlib import Path
27
+
28
+ import numpy as np
29
+ import torch
30
+ import torch.nn.functional as F
31
+ from torch import nn
32
+
33
+ SEGMENT = 80_000
34
+ N_FFT = 2048
35
+ HOP = 160
36
+ N_FREQ = N_FFT // 2 + 1
37
+ FRAMES = SEGMENT // HOP + 1 # 501
38
+
39
+
40
+ class Conditioner(nn.Module):
41
+ def __init__(self, lm):
42
+ super().__init__()
43
+ cps = lm.condition_provider.conditioners
44
+ wav = cps["self_wav"]
45
+ self.proj = wav.output_proj
46
+ self.inst_embed = cps["instrument_group"].embed
47
+ self.data_embed = cps["dataset_name"].embed
48
+ self.eps = wav.eps
49
+
50
+ window = wav.mel_spec_transform.spectrogram.window.detach().double()
51
+ fb = wav.mel_spec_transform.mel_scale.fb.detach().clone()
52
+ n = torch.arange(N_FFT, dtype=torch.float64)
53
+ k = torch.arange(N_FREQ, dtype=torch.float64)
54
+ ang = 2 * math.pi * k[:, None] * n[None, :] / N_FFT
55
+ kernel = torch.cat([window * torch.cos(ang), -window * torch.sin(ang)], 0) # [2*N_FREQ, N_FFT]
56
+ self.register_buffer("dft", kernel.float().unsqueeze(1)) # [2*N_FREQ, 1, N_FFT]
57
+ self.register_buffer("fb", fb) # [N_FREQ, n_mels]
58
+
59
+ def forward(self, audio, instrument, dataset):
60
+ x = F.pad(audio.unsqueeze(1), (N_FFT // 2, N_FFT // 2), mode="reflect")
61
+ spec = F.conv1d(x, self.dft, stride=HOP) # [1, 2*N_FREQ, FRAMES]
62
+ re, im = spec[:, :N_FREQ], spec[:, N_FREQ:]
63
+ mag = torch.sqrt(re * re + im * im)
64
+ mel = torch.matmul(mag.transpose(1, 2), self.fb) # [1, FRAMES, n_mels]
65
+ emb = self.proj(torch.log(mel + self.eps))
66
+ # The reference masks frames >= length/hop (500 of 501): the last frame is zeroed.
67
+ keep = (torch.arange(FRAMES) < SEGMENT // HOP).to(emb.dtype).view(1, -1, 1)
68
+ emb = emb * keep
69
+ # ClassConditioner: embedding row = id + 2 (id -1 -> row 1 = "unconditional")
70
+ inst = self.inst_embed(instrument + 2)
71
+ data = self.data_embed(dataset + 2)
72
+ # Order in the LM input is [wav, dataset, instrument]
73
+ return torch.cat([emb, data, inst], dim=1)
74
+
75
+
76
+ class Decoder(nn.Module):
77
+ def __init__(self, lm, heads: int):
78
+ super().__init__()
79
+ self.lm = lm
80
+ self.heads = heads
81
+
82
+ def forward(self, tokens, prefix, past_k, past_v):
83
+ lm = self.lm
84
+ x = lm.emb(tokens)
85
+ x = torch.cat([prefix.to(x.dtype), x], dim=1)
86
+ n_new = x.shape[1]
87
+ past = past_k.shape[2]
88
+ dim = x.shape[2]
89
+ h = self.heads
90
+ dh = dim // h
91
+
92
+ pos = (torch.arange(n_new) + past).view(1, -1, 1).float()
93
+ half = dim // 2
94
+ adim = torch.arange(half, dtype=torch.float32).view(1, 1, -1)
95
+ phase = pos / (10000.0 ** (adim / (half - 1)))
96
+ x = x + torch.cat([torch.cos(phase), torch.sin(phase)], dim=-1)
97
+
98
+ q_idx = (torch.arange(n_new) + past).view(-1, 1)
99
+ k_idx = torch.arange(past + n_new).view(1, -1)
100
+ blocked = k_idx > q_idx # [n_new, past+n_new]
101
+
102
+ ks, vs = [], []
103
+ for i, layer in enumerate(lm.transformer.layers):
104
+ attn = layer.self_attn
105
+ proj = F.linear(layer.norm1(x), attn.in_proj_weight).view(1, n_new, 3, h, dh)
106
+ q, k, v = proj[:, :, 0], proj[:, :, 1], proj[:, :, 2]
107
+ k_all = torch.cat([past_k[i], k], dim=1) # [1, T', h, dh]
108
+ v_all = torch.cat([past_v[i], v], dim=1)
109
+ ks.append(k_all)
110
+ vs.append(v_all)
111
+ scores = torch.matmul(q.transpose(1, 2), k_all.permute(0, 2, 3, 1)) / math.sqrt(dh)
112
+ scores = scores.masked_fill(blocked, float("-inf"))
113
+ out = torch.matmul(torch.softmax(scores, dim=-1), v_all.transpose(1, 2))
114
+ out = out.transpose(1, 2).reshape(1, n_new, dim)
115
+ x = x + attn.out_proj(out)
116
+ x = x + layer.linear2(F.gelu(layer.linear1(layer.norm2(x))))
117
+
118
+ last = lm.out_norm(x[:, -1:])
119
+ logits = lm.linear(last)[:, 0]
120
+ return logits, torch.stack(ks), torch.stack(vs)
121
+
122
+
123
+ def load_reference(reference: Path, checkpoint: Path):
124
+ sys.path.insert(0, str(reference))
125
+ import muscriptor.transcription_model as tm # noqa: WPS433
126
+
127
+ model = tm.TranscriptionModel.load_model(str(checkpoint), device="cpu", dtype="float32")
128
+ return tm, model
129
+
130
+
131
+ def main() -> None:
132
+ ap = argparse.ArgumentParser()
133
+ ap.add_argument("--size", choices=["small", "medium"], required=True)
134
+ ap.add_argument("--checkpoint", type=Path, required=True)
135
+ ap.add_argument("--reference", type=Path, required=True, help="clone of github.com/muscriptor/muscriptor")
136
+ ap.add_argument("--out", type=Path, required=True)
137
+ ap.add_argument("--opset", type=int, default=17)
138
+ args = ap.parse_args()
139
+ args.out.mkdir(parents=True, exist_ok=True)
140
+
141
+ tm, ref = load_reference(args.reference, args.checkpoint)
142
+ lm = ref._model
143
+ cfg = tm._CONFIGS[args.size]
144
+ layers, heads, dim = cfg.num_layers, cfg.num_heads, cfg.dim
145
+ dh = dim // heads
146
+ lm.eval()
147
+
148
+ cond = Conditioner(lm).eval()
149
+ dec = Decoder(lm, heads).eval()
150
+
151
+ # ---- export conditioner -------------------------------------------------
152
+ audio = torch.randn(1, SEGMENT) * 0.1
153
+ inst = torch.tensor([[-1]])
154
+ dset = torch.tensor([[-1]])
155
+ cond_path = args.out / "cond.onnx"
156
+ torch.onnx.export(
157
+ cond, (audio, inst, dset), str(cond_path), opset_version=args.opset, dynamo=False,
158
+ input_names=["audio", "instrument", "dataset"], output_names=["prefix"],
159
+ dynamic_axes={"instrument": {1: "k"}, "prefix": {1: "p"}},
160
+ )
161
+
162
+ # ---- export decoder -----------------------------------------------------
163
+ n_prefix = FRAMES + 1 + 1
164
+ tokens = torch.tensor([[card_initial(lm), 5, 6]])
165
+ prefix = torch.randn(1, n_prefix, dim)
166
+ pk = torch.randn(layers, 1, 4, heads, dh) * 0.1
167
+ pv = torch.randn(layers, 1, 4, heads, dh) * 0.1
168
+ lm_path = args.out / "lm.onnx"
169
+ torch.onnx.export(
170
+ dec, (tokens, prefix, pk, pv), str(lm_path), opset_version=args.opset, dynamo=False,
171
+ input_names=["tokens", "prefix", "past_k", "past_v"],
172
+ output_names=["logits", "present_k", "present_v"],
173
+ dynamic_axes={
174
+ "tokens": {1: "s"}, "prefix": {1: "p"},
175
+ "past_k": {2: "t"}, "past_v": {2: "t"},
176
+ "present_k": {2: "t2"}, "present_v": {2: "t2"},
177
+ },
178
+ )
179
+ print("exported", cond_path, lm_path)
180
+
181
+
182
+ def card_initial(lm) -> int:
183
+ return lm.card
184
+
185
+
186
+ if __name__ == "__main__":
187
+ main()
tools/quantize_int8.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """INT8 dynamic weight quantization of an exported MuScriptor lm.onnx (LM head kept fp32).
3
+
4
+ Usage: python quantize_int8.py out/small/lm.onnx out/small/lm-int8.onnx --card 1393
5
+ """
6
+ import argparse
7
+ import onnx
8
+ from onnxruntime.quantization import QuantType, quantize_dynamic
9
+
10
+ ap = argparse.ArgumentParser()
11
+ ap.add_argument("src")
12
+ ap.add_argument("dst")
13
+ ap.add_argument("--card", type=int, required=True, help="vocabulary size of the model (1393 small, 1395 medium)")
14
+ a = ap.parse_args()
15
+ m = onnx.load(a.src)
16
+ inits = {i.name: i for i in m.graph.initializer}
17
+ head = [n.name for n in m.graph.node if n.op_type == "MatMul" and any(i in inits and list(inits[i].dims)[-1] == a.card for i in n.input)]
18
+ quantize_dynamic(a.src, a.dst, weight_type=QuantType.QInt8, op_types_to_quantize=["MatMul"], nodes_to_exclude=head, per_channel=True)