YutaKusaka commited on
Commit
c6f65fe
Β·
verified Β·
1 Parent(s): e242dd1

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +136 -0
README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ pipeline_tag: audio-classification
4
+ base_model:
5
+ - m-a-p/MERT-v1-95M
6
+ - m-a-p/MERT-v1-330M
7
+ base_model_relation: finetune
8
+ tags:
9
+ - pytorch
10
+ - Transformers
11
+ - music
12
+ - streaming
13
+ - music-information-retrieval
14
+ - feature-extraction
15
+ - onnx
16
+ ---
17
+
18
+ # MuSTream: A Streaming Music Representation for Online Music Understanding
19
+
20
+ MuSTream is a streaming music representation for online music understanding. A
21
+ two-stage distillation (capacity, then causality) turns the non-causal
22
+ [MERT](https://huggingface.co/m-a-p/MERT-v1-95M) into causal streaming models of 26M,
23
+ 95M and 330M parameters. They process audio as a stream, give one prediction every
24
+ 0.2 s with a block-wise KV cache, and reach near-offline performance on chord
25
+ recognition, beat and downbeat tracking and key detection, in real time on a CPU.
26
+
27
+ - **Code:** <https://github.com/yamaha-research/MuSTream>
28
+ - **Real-time demo:** <https://yamaha-research-mustream.static.hf.space>
29
+
30
+ ## What is included
31
+
32
+ Six streaming backbones and, for each, three task probes, in PyTorch and ONNX:
33
+
34
+ | Model | Parameters | Teacher |
35
+ |---|---|---|
36
+ | MuSTream-26M | 26M | 26M bidirectional student distilled from MERT-v1-95M |
37
+ | MuSTream-95M | 95M | MERT-v1-95M |
38
+ | MuSTream-330M | 330M | MERT-v1-330M |
39
+
40
+ On an Apple M1 CPU, MuSTream-26M runs at a real-time factor of 0.09 with 0.22 s
41
+ latency, and MuSTream-330M at 0.35 with 0.29 s.
42
+
43
+ - **Variants `r0` / `r15`.** The local-interval teacher used in distillation sees
44
+ $p = 0$ or $p = 15$ frames past each supervised block.
45
+ - **Streaming setup.** 24 kHz mono input, 75 fps features. Each frame attends to the
46
+ past plus the rest of its 15-frame (0.2 s) block, over a 750-frame (10 s) KV cache.
47
+ - **Probes.** LSTM probes for chord recognition, beat / downbeat tracking and key
48
+ detection on top of each backbone.
49
+ - **Training data.** The released backbones are distilled on the public
50
+ [MTG-Jamendo](https://github.com/MTG/mtg-jamendo-dataset) audio (no labels).
51
+ The paper's results use backbones distilled on internal data; see
52
+ [`docs/understanding_performance.md`](https://github.com/yamaha-research/MuSTream/blob/main/docs/understanding_performance.md)
53
+ for a comparison of the two.
54
+
55
+ ```
56
+ pytorch/
57
+ β”œβ”€β”€ backbone/ # MuSTream backbones
58
+ β”‚ └── streaming_{26M,95M,330M}_{r0,r15}.ckpt
59
+ └── {chord,key,beat}/ # LSTM probes, one folder per backbone
60
+ └── streaming_{26M,95M,330M}_{r0,r15}/{best.pt, config.yaml}
61
+ onnx/ # the same models in ONNX
62
+ β”œβ”€β”€ backbone/
63
+ β”‚ └── streaming_{26M,95M,330M}_{r0,r15}.streaming.{onnx,json}
64
+ └── {chord,key,beat}/
65
+ └── streaming_{26M,95M,330M}_{r0,r15}.streaming.{onnx,json}
66
+ ```
67
+
68
+ ## How to use
69
+
70
+ ### Real-time demo in the browser
71
+
72
+ Open **<https://yamaha-research-mustream.static.hf.space>**, choose a task (chord,
73
+ beat, key or all), upload a song and press *Start streaming*, or press *Try a sample*.
74
+ The ONNX models run on your own device with ONNX Runtime Web: nothing to install, and
75
+ your audio is never uploaded. It uses MuSTream-26M by default. To run larger models or
76
+ the demo locally, see
77
+ [`streaming-demo/README.md`](https://github.com/yamaha-research/MuSTream/blob/main/streaming-demo/README.md).
78
+
79
+ ### Streaming feature extraction
80
+
81
+ Set up the code with [uv](https://docs.astral.sh/uv/) and download this repository
82
+ into `mustream/ckpt/`:
83
+
84
+ ```bash
85
+ git clone https://github.com/yamaha-research/MuSTream.git && cd MuSTream
86
+ uv sync && source .venv/bin/activate
87
+ hf download yamaha-research/MuSTream --local-dir mustream/ckpt
88
+ ```
89
+
90
+ Extract streaming features from your own audio (`--model` 26M, 95M or 330M;
91
+ `--variant` `r0` or `r15`):
92
+
93
+ ```bash
94
+ python mustream/extract_features.py song.wav --model 95M --variant r15
95
+ # -> features/song.npz: `features` [L, T, D] at 75 fps (L = 13, D = 768 for 95M)
96
+ ```
97
+
98
+ From Python:
99
+
100
+ ```python
101
+ import sys; sys.path.insert(0, "mustream")
102
+ from extract_features import load_backbone, load_audio, extract
103
+
104
+ model = load_backbone("mustream/ckpt/pytorch/backbone/streaming_95M_r15.ckpt", device="cuda") # or "cpu"
105
+ features = extract(model, load_audio("song.wav")) # torch.Tensor [L, T, D], 75 fps
106
+ ```
107
+
108
+ ### Chord, beat and key predictions
109
+
110
+ Each probe's `config.yaml` already points at its backbone, so the probes run as
111
+ downloaded. For example, streaming chord recognition:
112
+
113
+ ```bash
114
+ cd mustream/chord_recognition
115
+ python infer_streaming.py ../ckpt/pytorch/chord/streaming_95M_r15/config.yaml \
116
+ ../ckpt/pytorch/chord/streaming_95M_r15/best.pt --audio song.wav
117
+ ```
118
+
119
+ See the [GitHub repository](https://github.com/yamaha-research/MuSTream) for beat and
120
+ key detection, ONNX inference without PyTorch, training and evaluation.
121
+
122
+ ## License
123
+
124
+ Copyright 2026 Yamaha Corporation and the MuSTream authors.
125
+
126
+ The model weights in this repository (backbones and probes, in PyTorch and ONNX) are
127
+ licensed under the
128
+ [Creative Commons Attribution-NonCommercial 4.0 International License](https://creativecommons.org/licenses/by-nc/4.0/)
129
+ (CC BY-NC 4.0). They are granted for non-commercial research purposes only.
130
+
131
+ The MuSTream backbones are distilled from [MERT](https://huggingface.co/m-a-p/MERT-v1-95M),
132
+ whose weights are also released under CC BY-NC 4.0, using audio from
133
+ [MTG-Jamendo](https://github.com/MTG/mtg-jamendo-dataset).
134
+
135
+ The code in the [GitHub repository](https://github.com/yamaha-research/MuSTream) is
136
+ licensed separately under the GNU Affero General Public License v3.0 (AGPL-3.0).