Update README.md
Browse files
README.md
CHANGED
@@ -49,17 +49,17 @@ You will need the `miditok` (>=v2.1.7), `transformers` and `torch` packages to m
|
|
49 |
import torch
|
50 |
from transformers import AutoModelForCausalLM
|
51 |
from miditok import TSD
|
52 |
-
from
|
53 |
|
54 |
torch.set_default_device("cuda")
|
55 |
model = AutoModelForCausalLM.from_pretrained("Natooz/Maestro-TSD-bpe20k", trust_remote_code=True, torch_dtype="auto")
|
56 |
tokenizer = TSD.from_pretrained("Natooz/Maestro-TSD-bpe20k")
|
57 |
-
input_midi =
|
58 |
input_tokens = tokenizer(input_midi)
|
59 |
|
60 |
-
generated_token_ids = model.generate(input_tokens.ids, max_length=
|
61 |
generated_midi = tokenizer(generated_token_ids)
|
62 |
-
generated_midi.
|
63 |
```
|
64 |
|
65 |
## Training Details
|
|
|
49 |
import torch
|
50 |
from transformers import AutoModelForCausalLM
|
51 |
from miditok import TSD
|
52 |
+
from symusic import Score
|
53 |
|
54 |
torch.set_default_device("cuda")
|
55 |
model = AutoModelForCausalLM.from_pretrained("Natooz/Maestro-TSD-bpe20k", trust_remote_code=True, torch_dtype="auto")
|
56 |
tokenizer = TSD.from_pretrained("Natooz/Maestro-TSD-bpe20k")
|
57 |
+
input_midi = Score("path/to/file.mid")
|
58 |
input_tokens = tokenizer(input_midi)
|
59 |
|
60 |
+
generated_token_ids = model.generate(input_tokens.ids, max_length=500)
|
61 |
generated_midi = tokenizer(generated_token_ids)
|
62 |
+
generated_midi.dump_midi("path/to/continued.mid")
|
63 |
```
|
64 |
|
65 |
## Training Details
|