Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,360 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
metrics:
|
6 |
+
- accuracy
|
7 |
+
pipeline_tag: text-generation
|
8 |
---
|
9 |
+
# 🎼 ChatMusician: Fostering Intrinsic Musical Abilities Into LLM
|
10 |
+
|
11 |
+
[**🌐 DemoPage**](https://ezmonyi.github.io/ChatMusician/) | [**🤗 Dataset**](https://huggingface.co/datasets/m-a-p/MusicPile) | [**🤗 Benchmark**](https://huggingface.co/datasets/m-a-p/MusicTheoryBench) | [**📖 arXiv**](http://arxiv.org/abs/2402.16153) | [**Code**](https://github.com/hf-lin/ChatMusician)
|
12 |
+
|
13 |
+
## 🔔News
|
14 |
+
- **🔥[2023-12-10]: The release of ChatMusician's demo, code, model, data, and benchmark. 😆**
|
15 |
+
- [2023-11-30]: Checkout another awesome project [MMMU](https://huggingface.co/datasets/MMMU/MMMU/) that includes multimodal music reasoning.
|
16 |
+
|
17 |
+
## Introduction
|
18 |
+
|
19 |
+
While Large Language Models (LLMs) demonstrate impressive capabilities in text generation,
|
20 |
+
we find that their ability has yet to be generalized to music, humanity’s creative language.
|
21 |
+
We introduce **ChatMusician**, **an open-source LLM that integrates intrinsic musical abilities**.
|
22 |
+
|
23 |
+
It is based on continual pre-training and finetuning LLaMA2 on a text-compatible music representation, ABC notation, and the music is treated as a second language. ChatMusician can understand and generate music with a pure text tokenizer without any external multi-modal neural structures or tokenizers. Interestingly, endowing musical abilities does not harm language abilities, even achieving a slightly higher MMLU score. Our model is capable of composing well-structured, full-length music, conditioned on texts, chords, melodies, motifs, musical forms, etc, surpassing GPT-4 baseline. On our meticulously curated college-level music understanding benchmark, MusicTheoryBench, ChatMusician surpasses LLaMA2 and GPT-3.5 on zero-shot setting by a noticeable
|
24 |
+
margin. Our work reveals that LLMs can be an excellent compressor for music, but there remains significant territory to be conquered. Code, data, model, and benchmark are open-sourced.
|
25 |
+
|
26 |
+
<!-- <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/5fd6f670053c8345eddc1b68/8NSONUjIF7KGUCfwzPCd9.mpga"></audio> -->
|
27 |
+
|
28 |
+
## Training Data
|
29 |
+
|
30 |
+
ChatMusician is pretrained on the 🤗 [MusicPile](https://huggingface.co/datasets/m-a-p/MusicPile), which is the first pretraining corpus for **developing musical abilities** in large language models. Check out the dataset card for more details.
|
31 |
+
And supervised finetuned on 1.1M samples(2:1 ratio between music scores
|
32 |
+
and music knowledge & music summary data) from MusicPile. Check our [paper](http://arxiv.org/abs/2402.16153) for more details.
|
33 |
+
|
34 |
+
## Training Procedure
|
35 |
+
|
36 |
+
We initialized a fp16-precision ChatMusician-Base from the LLaMA2-7B-Base weights, and applied a continual pre-training plus fine-tuning pipeline. LoRA adapters were integrated into the attention and MLP layers, with additional training on embeddings and all linear layers. The maximum sequence length
|
37 |
+
was 2048. We utilized 16 80GB-A800 GPUs for one epoch pre-training and 8 32GB-V100 GPUs for two epoch fine-tuning. DeepSpeed was employed for memory efficiency, and the AdamW optimizer was used with a 1e-4 learning rate and a 5% warmup cosine scheduler. Gradient clipping was set at 1.0. The LoRA parameters dimension, alpha, and
|
38 |
+
dropout were set to 64, 16, and 0.1, with a batch size of 8.
|
39 |
+
|
40 |
+
## Evaluation
|
41 |
+
|
42 |
+
1. Music understanding abilities are evaluated on the [MusicTheoryBench](https://huggingface.co/datasets/m-a-p/MusicTheoryBench).
|
43 |
+
2. General language abilities of ChatMusician are evaluated on the [Massive Multitask Language Understanding (MMLU) dataset](https://huggingface.co/datasets/lukaemon/mmlu).
|
44 |
+
|
45 |
+
|
46 |
+
## Usage
|
47 |
+
|
48 |
+
You can use the models through Huggingface's Transformers library. Check our Github repo for more advanced use: [https://github.com/hf-lin/ChatMusician](https://github.com/hf-lin/ChatMusician)
|
49 |
+
|
50 |
+
|
51 |
+
## Prompt Format
|
52 |
+
|
53 |
+
**Our model produces symbolic music(ABC notation) well in the following prompts.** Here are some musical tasks.
|
54 |
+
|
55 |
+
### Function: Text2music
|
56 |
+
|
57 |
+
```
|
58 |
+
Prompt:
|
59 |
+
Using ABC notation, recreate the given text as a musical score.
|
60 |
+
Meter C
|
61 |
+
Notes The parts are commonly interchanged.
|
62 |
+
Transcription 1997 by John Chambers
|
63 |
+
Key D
|
64 |
+
Note Length 1/8
|
65 |
+
Rhythm reel
|
66 |
+
|
67 |
+
Response:
|
68 |
+
X:1
|
69 |
+
L:1/8
|
70 |
+
M:2/2
|
71 |
+
K:D
|
72 |
+
"A7" FE |"D" D2 FA dAFD |"A7" CDEF G2 FE |"D" D2 FA dcdf |"E7" edcB"A7" AGFE | |"D" D2 FA dAFD |
|
73 |
+
"A7" CDEF G2 FG |"D" AdcB"A7" AGFE |"D" D2 F2 D2 :: de |"D" fefg fedc |"Em" B^ABc B2 cd |
|
74 |
+
"E7" e^def e=dcB |"A" A2 ce aABc | |"D" dcde fdAF |"G" GFGA BdcB |"D" AdcB"A7" Agec |
|
75 |
+
"D" d2 f2 d2 :|
|
76 |
+
```
|
77 |
+
```
|
78 |
+
Prompt:
|
79 |
+
Develop a tune influenced by Bach's compositions.
|
80 |
+
|
81 |
+
Response:
|
82 |
+
X:1
|
83 |
+
X:1
|
84 |
+
T:Music21 Fragment
|
85 |
+
T:Music21 Fragment
|
86 |
+
T:Music21
|
87 |
+
C:Music21
|
88 |
+
%%score 1 2 3 4
|
89 |
+
L:1/8
|
90 |
+
M:4/4
|
91 |
+
K:C
|
92 |
+
V:1 treble nm="Piano" snm="Pno"
|
93 |
+
%%MIDI program 0
|
94 |
+
%%MIDI control 7 100
|
95 |
+
%%MIDI control 10 64
|
96 |
+
L:1/4
|
97 |
+
V:2 treble nm="Piano" snm="Pno"
|
98 |
+
%%MIDI channel 3
|
99 |
+
%%MIDI program 0
|
100 |
+
%%MIDI control 7 100
|
101 |
+
%%MIDI control 10 64
|
102 |
+
V:3 bass nm="Piano" snm="Pno"
|
103 |
+
%%MIDI channel 4
|
104 |
+
%%MIDI program 0
|
105 |
+
%%MIDI control 7 100
|
106 |
+
%%MIDI control 10 64
|
107 |
+
V:4 bass nm="Piano" snm="Pno"
|
108 |
+
%%MIDI channel 5
|
109 |
+
%%MIDI program 0
|
110 |
+
%%MIDI control 7 100
|
111 |
+
%%MIDI control 10 64
|
112 |
+
V:1
|
113 |
+
z3 c | B A G F | E D !fermata!E c | d e d c | !fermata!B2 z c | B A G F | E D !fermata!E c | %7
|
114 |
+
d e d c | !fermata!B2 z e | f e d c | B A !fermata!B B | c d e d | !fermata!c2 z e | d c B A | %14
|
115 |
+
G A B c | d e d c | !fermata!B2 z e | d c B A | G A B c | d e d c | !fermata!c2 z B | A G F E | %22
|
116 |
+
D C !fermata!D c | B c d e | d c B A | !fermata!G2 z c | B A G F | E D !fermata!E c | d e d c | %29
|
117 |
+
!fermata!B2 z e | d c B A | G A B c | d e d c | !fermata!c2 z e | d c B A | G A B c | d e d c | %36
|
118 |
+
!fermata!c2 z B | A G F E | D C !fermata!D c | B c d e | d c B A | !fermata!G2 z2 |] %42
|
119 |
+
V:2
|
120 |
+
z6 CD | EF ED C2 CD | EF ED !fermata!C2 CD | EF GF ED C2 | !fermata!C6 CD | EF ED C2 CD | %6
|
121 |
+
EF ED !fermata!C2 CD | EF GF ED C2 | !fermata!C6 CD | EF GA GF ED | C2 DE !fermata!F2 DC | %11
|
122 |
+
B,C DB, C2 CD | !fermata!E6 CD | EF GA GF ED | C2 DE !fermata!F2 DC | B,C DB, C2 CD | %16
|
123 |
+
!fermata!E6 CD | EF GA GF ED | C2 DE !fermata!F2 DC | B,C DB, C2 CD | !fermata!E6 B,C | %21
|
124 |
+
DE ^FE D=C B,A, | G,^F, G,2 !fermata!G,2 =F,2 | G,2 A,B, CD EF | !fermata!G6 B,C | DE ^FE D=C B,A, | %26
|
125 |
+
G,^F, G,2 !fermata!G,2 =F,2 | G,2 A,B, CD EF | !fermata!G6 B,C | DE ^FE D=C B,A, | %30
|
126 |
+
G,^F, G,2 !fermata!G,2 =F,2 | G,2 A,B, CD EF | !fermata!G6 B,C | DE ^FE D=C B,A, | %34
|
127 |
+
G,^F, G,2 !fermata!G,2 =F,2 | G,2 A,B, CD EF | !fermata!G6 z2 |] %37
|
128 |
+
V:3
|
129 |
+
z6 G,2 | A,2 G,2 G,2 G,2 | G,2 G,2 !fermata!G,2 G,2 | G,2 A,2 B,2 C2 | !fermata!C6 G,2 | %6
|
130 |
+
A,2 G,2 G,2 G,2 | G,2 G,2 !fermata!G,2 G,2 | G,2 A,2 B,2 C2 | !fermata!C6 G,2 | G,2 A,2 B,2 C2 | %11
|
131 |
+
C2 B,2 !fermata!C2 B,2 | C2 D2 E2 D2 | !fermata!C6 G,2 | A,2 G,2 G,2 G,2 | G,2 G,2 !fermata!G,2 G,2 | %16
|
132 |
+
G,2 A,2 B,2 C2 | !fermata!C6 G,2 | G,2 A,2 B,2 C2 | C2 B,2 !fermata!C2 B,2 | C2 D2 E2 D2 | %21
|
133 |
+
!fermata!C6 B,2 | A,2 G,2 G,2 G,2 | G,2 G,2 !fermata!G,2 G,2 | G,2 A,2 B,2 C2 | !fermata!C6 B,2 | %26
|
134 |
+
A,2 G,2 G,2 G,2 | G,2 G,2 !fermata!G,2 G,2 | G,2 A,2 B,2 C2 | !fermata!C6 B,2 | A,2 G,2 G,2 G,2 | %31
|
135 |
+
G,2 G,2 !fermata!G,2 G,2 | G,2 A,2 B,2 C2 | !fermata!C6 z2 |] %34
|
136 |
+
V:4
|
137 |
+
z6"C" C,2 |"Am" A,,2"Em" E,2"C" C,2"C" C,2 |"Am" A,,2"Em" E,2"C" !fermata!C,2"C" C,2 | %3
|
138 |
+
"G" G,,2"Am" A,,2"G" B,,2"C" C,2 |"C" !fermata!C,6"C" C,2 |"Am" A,,2"Em" E,2"C" C,2"C" C,2 | %6
|
139 |
+
"Am" A,,2"Em" E,2"C" !fermata!C,2"C" C,2 |"G" G,,2"Am" A,,2"G" B,,2"C" C,2 |"C" !fermata!C,6"C" C,2 | %9
|
140 |
+
"G" G,,2"Am" A,,2"G" B,,2"C" C,2 |"C" C,2"G" G,,2"C" !fermata!C,2"C" C,2 | %11
|
141 |
+
"C" C,2"G" G,,2"Am" A,,2"G" B,,2 |"C" !fermata!C,6"C" C,2 |"G" G,,2"Am" A,,2"G" B,,2"C" C,2 | %14
|
142 |
+
"C" C,2"G" G,,2"C" !fermata!C,2"C" C,2 |"G" G,,2"Am" A,,2"G" B,,2"C" C,2 |"C" !fermata!C,6"C" C,2 | %17
|
143 |
+
"G" G,,2"Am" A,,2"G" B,,2"C" C,2 |"C" C,2"G" G,,2"C" !fermata!C,2"C" C,2 | %19
|
144 |
+
"G" G,,2"Am" A,,2"G" B,,2"C" C,2 |"C" !fermata!C,6"E" E,2 |"Am" A,,2"Em" E,2"C" C,2"C" C,2 | %
|
145 |
+
```
|
146 |
+
|
147 |
+
### Function: Melody Harmonization
|
148 |
+
|
149 |
+
```
|
150 |
+
Prompt:
|
151 |
+
Construct smooth-flowing chord progressions for the supplied music.
|
152 |
+
|
153 |
+
|: BA | G2 g2"^(C)" edeg | B2 BA"^(D7)" BcBA | G2 g2 edeg | dBAG A2 BA |
|
154 |
+
G2 g2"^(C)" edeg | B2 BA B2 d2 | e2 ef e2 (3def | gedB A2 :: BA | G2 BG dGBe |
|
155 |
+
dBBA"^(D7)" B3 A | G2 BG dGBe | dBAG A4 | G2 BG dGBe | dBBA B3 d |
|
156 |
+
e2 ef e2 (3def | gedB A2 :|
|
157 |
+
|
158 |
+
Response:
|
159 |
+
X:1
|
160 |
+
L:1/8
|
161 |
+
M:2/2
|
162 |
+
K:G
|
163 |
+
|: BA |"G" G2 g2"^(C)" edeg |"G" B2 BA"^(D7)" BcBA |"G" G2 g2"Em" edeg |"Am" A2 AG"D7" AcBA |
|
164 |
+
"G" G2 g2"^(C)" edeg |"G" B2 BA B2 d2 |"C" e2 ef e2 (3def |"D7" gedB A2 :: BA |"G" G2 BG dGBG |
|
165 |
+
"G" B2 BA"^(D7)" BcBA |"G" G2 BG"Em" dGBG |"Am" A2 AG"D7" AcBA |"G" G2 BG dGBe | dBBA B2 d2 |
|
166 |
+
"C" e2 ef e2 (3def |"D7" gedB A2 :|
|
167 |
+
```
|
168 |
+
```
|
169 |
+
Prompt:
|
170 |
+
Develop a series of chord pairings that amplify the harmonious elements in the given music piece.
|
171 |
+
|
172 |
+
E |: EAA ABc | Bee e2 d | cBA ABc | BEE E2 D | EAA ABc | Bee e2 d |
|
173 |
+
cBA ^GAB |1 A2 A A2 E :|2 A2 A GAB || c3 cdc | Bgg g2 ^g | aed cBA |
|
174 |
+
^GAB E^F^G | A^GA BAB | cde fed | cBA ^GAB |1 A2 A GAB :|2 \n A3 A2 ||
|
175 |
+
|
176 |
+
Response:
|
177 |
+
X:1
|
178 |
+
L:1/8
|
179 |
+
M:6/8
|
180 |
+
K:Amin
|
181 |
+
E |:"Am" EAA ABc |"E7" Bee e2 d |"Am" cBA ABc |"E7" BGE E2 E |
|
182 |
+
"Am" EAA ABc |"E7" Bee e2 d |"Am" cBA"E7" ^GAB |1"Am" A2 A A2 E :|2
|
183 |
+
"Am" A2 A GAB ||"C" c3 cdc |"G" Bgg g2 ^g |"Am" aed cBA |
|
184 |
+
"E7" ^GAB E^F^G |"Am" A^GA"E7" BAB |"Am" cde"Dm" fed |
|
185 |
+
"Am" cBA"E7" ^GAB |1"Am" A2 A GAB :|2 "Am" A2 A A2 ||
|
186 |
+
```
|
187 |
+
|
188 |
+
### Function: Chord Conditioned Music Generation
|
189 |
+
```
|
190 |
+
Prompt:
|
191 |
+
Develop a musical piece using the given chord progression. 'Dm', 'C', 'Dm', 'Dm', 'C', 'Dm', 'C', 'Dm'
|
192 |
+
|
193 |
+
Response:
|
194 |
+
X:1
|
195 |
+
L:1/8
|
196 |
+
M:6/8
|
197 |
+
K:F
|
198 |
+
z4 z D |"Dm" A2 A"C" G2 F |"Dm" FE D D2 D |
|
199 |
+
"Dm" A2 A"C" G2 A |"Dm" D3 D2 D |"Dm" A2 A"C" G2 F |
|
200 |
+
"Dm" FE D D2 D |"Dm" F2 G"C" E2 C |"Dm" D3 D2 D |
|
201 |
+
"F" F2 F F2 c |"Bb" d2 c"^(Gm)" B2 A |
|
202 |
+
"Gm" G2 G G2 B |"Am" A2 G"A7" FE D |"Dm" F2 F F2 c |
|
203 |
+
"Bb" d2 c"^(Gm)" B2 A |"Gm" G2 G"A7" A2 G |
|
204 |
+
"Dm" FE D D2 z |]
|
205 |
+
```
|
206 |
+
|
207 |
+
### Function: Musical Form Conditioned Music Generation
|
208 |
+
|
209 |
+
```
|
210 |
+
Prompt:
|
211 |
+
Develop a composition by incorporating elements from the given melodic structure.
|
212 |
+
|
213 |
+
Ternary, Sectional: Verse/Chorus/Bridge
|
214 |
+
|
215 |
+
Response:
|
216 |
+
X:1
|
217 |
+
L:1/8
|
218 |
+
M:6/8
|
219 |
+
K:Gmin
|
220 |
+
|:"Gm" GAB AG^F | GAB c2 c | d2 d cdB | A2 d cBA |
|
221 |
+
GAB AG^F | GAB c2 c | d2 d cdB |1 AG^F G2 D :|2
|
222 |
+
AG^F GAB |: c2 c cBA | c2 c cBA | c2 c cBA |
|
223 |
+
ABA GAB | c2 c cBA | c2 c cBA | d2 d cdB |1
|
224 |
+
AG^F GAB :|2 AG^F G2 A |:"Bbm" B3 dcB | f2 e dcB |
|
225 |
+
c2 f c2 c | cfc cBA | ABB dcB | f2 e dcB |
|
226 |
+
d2 d edc |1 cBA B2 B :|2 cBA G3 ||
|
227 |
+
```
|
228 |
+
|
229 |
+
### Function: Motif and Form Conditioned Music Generation
|
230 |
+
|
231 |
+
```
|
232 |
+
Text Input:
|
233 |
+
Create music by incorporating the assigned motif into the predetermined musical arrangement.
|
234 |
+
|
235 |
+
Musical Form Input: Only One Section
|
236 |
+
|
237 |
+
ABC Notation Music Input:
|
238 |
+
X:1
|
239 |
+
L:1/8
|
240 |
+
M:9/8
|
241 |
+
K:Emin
|
242 |
+
vB2 E E2 F G2 A
|
243 |
+
|
244 |
+
Response:
|
245 |
+
X:1
|
246 |
+
L:1/8
|
247 |
+
M:9/8
|
248 |
+
K:Emin
|
249 |
+
|:"Em" vB2 E E2 F G2 A |"D" B2 e e2 ^d e3 |
|
250 |
+
"Bm" B2 E E2 F G2 A |"G" B2 G A2 F"C" G2 E |
|
251 |
+
"Em" vB2 E E2 F G2 A |"D" B2 e e2 ^d"C" e3 |
|
252 |
+
"Em" ve2 B"^Av" A2 F"Bm" G2 A |1"G" B2 G"D" A2 F"Em" G2 E :|
|
253 |
+
2"G" B2 G"D" A2 F"G" G3 |"^(C)" ABc"^(D)" ded"G" dBG |
|
254 |
+
"^(C)" cde"D" dcB"G" A2 G |"^(C)" E2 E"Am" ABc"D" def |
|
255 |
+
"Em" g2 G"D" FAF"G" G3 |"^(C)" ABc"^(D)" ded"G" dBG |
|
256 |
+
"^(C)" cde"D" dcB"G" A2 G |"Em" e2 B"^Av" A2 F"Bm" G2 A |
|
257 |
+
"G" B2 G"D" A2 F"Em" G2 E |]
|
258 |
+
```
|
259 |
+
|
260 |
+
### Function: Music Understanding
|
261 |
+
|
262 |
+
```
|
263 |
+
Prompt:
|
264 |
+
Investigate the aspects of this musical work and convey its structural organization using suitable musical words.
|
265 |
+
|
266 |
+
X:1
|
267 |
+
L:1/8
|
268 |
+
M:2/2
|
269 |
+
K:G
|
270 |
+
G2 dG BGdG | G2 dc BAGB | A2 eA cAeA | A2 ed cAFA |
|
271 |
+
G2 dG BGdG | G2 dc BAGB | ABcd efge |1 aged cAFA :|2
|
272 |
+
aged ^cdef |: g3 f g2 ef | gedc BA G2 | eaag agea |
|
273 |
+
aged ^cdef | g3 f g2 ef |gedc BAGB | ABcd efge |1
|
274 |
+
aged ^cdef :|2 aged cAFA |:"^variations:" G2 BG dGBA |
|
275 |
+
G2 dG BAGB | A2 cA eAcA | A2 ed cAFA | G2 BG dGBA |
|
276 |
+
G2 dc BAGB | ABcd efge |1 aged cAFA :|2 aged ^cdef |:
|
277 |
+
g2 af g2 ef | gedc BAGB | Aaag ageg | aged ^cdef |
|
278 |
+
gbaf g2 ef | gedc BAGB | ABcd efge |1
|
279 |
+
aged ^cdef :|2 aged cAFA ||
|
280 |
+
|
281 |
+
Response:
|
282 |
+
Compound Binary
|
283 |
+
```
|
284 |
+
|
285 |
+
```
|
286 |
+
Prompt:
|
287 |
+
Analyze the musical work and pinpoint the consistent melodic element in every section.
|
288 |
+
|
289 |
+
X:1
|
290 |
+
L:1/8
|
291 |
+
M:4/4
|
292 |
+
K:G
|
293 |
+
ge | d2 G2 cBAG | d2 G2 cBAG | e2 A2 ABcd | edcB A2 Bc |
|
294 |
+
d2 cB g2 fe | edcB cBAG | BAGE DEGA | B2 G2 G2 :: ga |
|
295 |
+
b2 gb a2 fa | g2 eg edcB | e2 A2 ABcd | edcB A2 ga |
|
296 |
+
b2 gb a2 fa | g2 eg edcB | cBAG DEGA | B2 G2 G2 :|
|
297 |
+
|
298 |
+
Response:
|
299 |
+
X:1
|
300 |
+
L:1/8
|
301 |
+
M:4/4
|
302 |
+
K:G
|
303 |
+
ge d2 G2 cBAG d2 G2 cBAG
|
304 |
+
```
|
305 |
+
|
306 |
+
## CLI demo
|
307 |
+
```
|
308 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
|
309 |
+
from string import Template
|
310 |
+
prompt_template = Template("Human: ${inst} </s> Assistant: ")
|
311 |
+
|
312 |
+
tokenizer = AutoTokenizer.from_pretrained("m-a-p/ChatMusician-v1-sft-78k", trust_remote_code=True)
|
313 |
+
model = AutoModelForCausalLM.from_pretrained("m-a-p/ChatMusician-v1-sft-78k", trust_remote_code=True).eval()
|
314 |
+
model.cuda()
|
315 |
+
generation_config = GenerationConfig(
|
316 |
+
temperature=0.2,
|
317 |
+
top_k=40,
|
318 |
+
top_p=0.9,
|
319 |
+
do_sample=True,
|
320 |
+
num_beams=1,
|
321 |
+
repetition_penalty=1.1,
|
322 |
+
min_new_tokens=10,
|
323 |
+
max_new_tokens=1536
|
324 |
+
)
|
325 |
+
|
326 |
+
instruction = """Using ABC notation, recreate the given text as a musical score.
|
327 |
+
Meter C
|
328 |
+
Notes The parts are commonly interchanged.
|
329 |
+
Transcription 1997 by John Chambers
|
330 |
+
Key D
|
331 |
+
Note Length 1/8
|
332 |
+
Rhythm reel
|
333 |
+
"""
|
334 |
+
|
335 |
+
prompt = prompt_template.safe_substitute({"inst": instruction})
|
336 |
+
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
|
337 |
+
response = model.generate(
|
338 |
+
input_ids=inputs["input_ids"].to(model.device),
|
339 |
+
attention_mask=inputs['attention_mask'].to(model.device),
|
340 |
+
eos_token_id=tokenizer.eos_token_id,
|
341 |
+
generation_config=generation_config,
|
342 |
+
)
|
343 |
+
response = tokenizer.decode(response[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
|
344 |
+
print(response)
|
345 |
+
```
|
346 |
+
|
347 |
+
## Intended Uses
|
348 |
+
These models are trained for research purposes. They are designed to solve general math problems. They can be used in educational software, tutoring systems, or any application where a solution to a math problem is needed. The models can generate both a chain of thought (CoT) rationale and a program of thought (PoT) rationale, providing a comprehensive solution to a given math problem.
|
349 |
+
|
350 |
+
|
351 |
+
## Limitations
|
352 |
+
We've tried our best to build math generalist models. However, we acknowledge that the models' performance may vary based on the complexity and specifics of the math problem. Still not all mathematical fields can be covered comprehensively.
|
353 |
+
|
354 |
+
|
355 |
+
## Citation
|
356 |
+
If you use the models, data, or code from this project, please cite the original paper:
|
357 |
+
|
358 |
+
```
|
359 |
+
coming soon.
|
360 |
+
```
|