Instructions to use m-a-p/MuPT-v0-8192-550M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use m-a-p/MuPT-v0-8192-550M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="m-a-p/MuPT-v0-8192-550M")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("m-a-p/MuPT-v0-8192-550M") model = AutoModelForMultimodalLM.from_pretrained("m-a-p/MuPT-v0-8192-550M") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use m-a-p/MuPT-v0-8192-550M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "m-a-p/MuPT-v0-8192-550M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "m-a-p/MuPT-v0-8192-550M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/m-a-p/MuPT-v0-8192-550M
- SGLang
How to use m-a-p/MuPT-v0-8192-550M with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "m-a-p/MuPT-v0-8192-550M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "m-a-p/MuPT-v0-8192-550M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "m-a-p/MuPT-v0-8192-550M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "m-a-p/MuPT-v0-8192-550M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use m-a-p/MuPT-v0-8192-550M with Docker Model Runner:
docker model run hf.co/m-a-p/MuPT-v0-8192-550M
Update README.md
#2
by paralym - opened
README.md
CHANGED
|
@@ -121,13 +121,58 @@ Once you enter the container, you can start a REST server for inference.
|
|
| 121 |
Use CURL to query the server directly, note that the newline token `\n` is represented by `<n>` in the vocabulary, so we need to replace the newline token with `<n>` in both the prompt and the generated tokens.
|
| 122 |
|
| 123 |
```shell
|
| 124 |
-
curl 'http://localhost:6000/api' -X 'PUT' -H 'Content-Type: application/json; charset=UTF-8' -d '{"prompts":["X:1<n>
|
| 125 |
```
|
| 126 |
Output:
|
| 127 |
```shell
|
| 128 |
-
X:1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
```
|
| 130 |
|
| 131 |
Once you encode the generated tokens into audio, you will hear the following music.
|
| 132 |
|
| 133 |
-
<audio controls src="https://cdn-uploads.huggingface.co/production/uploads/640701cb4dc5f2846c91d4eb/
|
|
|
|
| 121 |
Use CURL to query the server directly, note that the newline token `\n` is represented by `<n>` in the vocabulary, so we need to replace the newline token with `<n>` in both the prompt and the generated tokens.
|
| 122 |
|
| 123 |
```shell
|
| 124 |
+
curl 'http://localhost:6000/api' -X 'PUT' -H 'Content-Type: application/json; charset=UTF-8' -d '{"prompts":["X:1<n>T:Music21 Fragment<n>T:Music21 Fragment<n>T:Music21<n>C:Music21<n>%%score 1 2 3 4<n>L:1/4<n>M:4/4<n>K:C<n>V:1 treble nm=\"Piano\" snm=\"Pno\"<n>%%MIDI program 0<n>%%MIDI control 7 100<n>%%MIDI control 10 64<n>V:2 treble nm=\"Piano\" snm=\"Pno\"<n>%%MIDI channel 3<n>%%MIDI program 0<n>%%MIDI control 7 100<n>%%MIDI control 10 64<n>V:3 bass nm=\"Piano\" snm=\"Pno\"<n>%%MIDI channel 4<n>%%MIDI program 0<n>%%MIDI control 7 100<n>%%MIDI control 10 64<n>V:4 bass nm=\"Piano\" snm=\"Pno\"<n>%%MIDI channel 5<n>%%MIDI program 0<n>%%MIDI control 7 100<n>%%MIDI control 10 64<n>V:1<n> z3 c | B A G F/E/ | !fermata!E ^F ^G A | B e d c | !fermata!B2 G A | B c d e | %6<n> !fermata!c2"], "tokens_to_generate":4096}'
|
| 125 |
```
|
| 126 |
Output:
|
| 127 |
```shell
|
| 128 |
+
X:1
|
| 129 |
+
T:Music21 Fragment
|
| 130 |
+
T:Music21 Fragment
|
| 131 |
+
T:Music21
|
| 132 |
+
C:Music21
|
| 133 |
+
%%score 1 2 3 4
|
| 134 |
+
L:1/4
|
| 135 |
+
M:4/4
|
| 136 |
+
K:C
|
| 137 |
+
V:1 treble nm="Piano" snm="Pno"
|
| 138 |
+
%%MIDI program 0
|
| 139 |
+
%%MIDI control 7 100
|
| 140 |
+
%%MIDI control 10 64
|
| 141 |
+
V:2 treble nm="Piano" snm="Pno"
|
| 142 |
+
%%MIDI channel 3
|
| 143 |
+
%%MIDI program 0
|
| 144 |
+
%%MIDI control 7 100
|
| 145 |
+
%%MIDI control 10 64
|
| 146 |
+
V:3 bass nm="Piano" snm="Pno"
|
| 147 |
+
%%MIDI channel 4
|
| 148 |
+
%%MIDI program 0
|
| 149 |
+
%%MIDI control 7 100
|
| 150 |
+
%%MIDI control 10 64
|
| 151 |
+
V:4 bass nm="Piano" snm="Pno"
|
| 152 |
+
%%MIDI channel 5
|
| 153 |
+
%%MIDI program 0
|
| 154 |
+
%%MIDI control 7 100
|
| 155 |
+
%%MIDI control 10 64
|
| 156 |
+
V:1
|
| 157 |
+
z3 c | B A G F/E/ | !fermata!E ^F ^G A | B e d c | !fermata!B2 G A | B c d e | %6
|
| 158 |
+
!fermata!c2 e | a g/f/ e d | !fermata!e2- e e | a e a g/f/ | e2 !fermata!d g | d d g e |1
|
| 159 |
+
e2 !fermata!e G :|3 e2 !fermata!e2- || e z z2 | z4 |]
|
| 160 |
+
V:2
|
| 161 |
+
z3 G | G E C B, | !fermata!C D E E | G G ^F A | !fermata!^G2 E E | G G G G | sG !fermata!B2 G |
|
| 162 |
+
c B B A | !fermata!^G2- G G | A B c d | c2 !fermata!B _B | A A _A A |1 G2 A !fermata!G :|3
|
| 163 |
+
G2 !fermata!A2- || A z z2 | z4 |]
|
| 164 |
+
V:3
|
| 165 |
+
z3 C,/D,/ | E, E, E, ^G,, | !fermata!A,, B,, B,, C,/D,/ | E, C, D, ^F, | !fermata!E,2 C, C,/D,/ |
|
| 166 |
+
E, C, B,, C, | !fermata!G, !fermata!G,,2 C,/D,/ | E, E, F, D, | !fermata!E,2- E, D, |
|
| 167 |
+
C, B,, A,, B,, | C,3/2 D,/ !fermata!G,, E, | F, F, _E, B,, |1 _B,, G,, ^F,, !fermata!G,, :|3
|
| 168 |
+
_B,, G,, !fermata!^F,,2- || F,, z z2 | z4 |]
|
| 169 |
+
V:4
|
| 170 |
+
z3 C,/B,,/ | A,, E,, A,, E,, | !fermata!A,, G,, E,, A,, | G,, C, B,, D,, |
|
| 171 |
+
!fermata!E,,2 E,,/F,,/ A,, | G,, C, G,, C, | !fermata!B,, !fermata!G,,2 C,/B,,/ | A,, E,, F,, D,, |
|
| 172 |
+
!fermata!E,,2- E,,/^F,,/ ^G,, | A,, ^G,, A,, B,, | C,3/2 D,/ !fermata!G,, E,, |
|
| 173 |
+
F,,/G,,/ A,, B,, E,, |1 G,, C,, ^F,, !fermata!G,, :|3 G,, C,, !fermata!^F,,2- || F,, z z2 | z4 |]
|
| 174 |
```
|
| 175 |
|
| 176 |
Once you encode the generated tokens into audio, you will hear the following music.
|
| 177 |
|
| 178 |
+
<audio controls src="https://cdn-uploads.huggingface.co/production/uploads/640701cb4dc5f2846c91d4eb/cDaJ19RPkVZ_mSdzxAI-D.mpga"></audio>
|