Open BerkinChen opened 2 years ago
Hi. The code is for preprocessed data, so you need to first merge the instruments into the 6 basic ones as mentioned in the README page. We may update the code soon to support arbitrary MIDI files.
Thanks.
What does this merge / normalize (as stated in README) refers to specifically?
According to your paper, the author quotes this method from PopMAG: Pop Music Accompaniment Generation, which follows 'Musegan: Multi-track sequential generative adversarial networks for symbolic music generation and accompaniment'.
In musegan, it`s described as 'Instruments out of the list are considered as part of the strings.'
Does it mean any inst types apart from the above 6 (130 total - 6 = 124) are simply mapped to string type(id=48)?
Many thanks
The same error. Can you provide the preprocess scripts?
@HuichuanLiu @btyu
@SkyAndCloud You don't need advanced preprocessing scripts. Just make sure the instruments in your midi file are the same as the ones described in the readme. You can automatically change the instruments of each track using midi-toolkit. What works best will kinda depend on the music you are using. For my midis, I set all program ids from 0-24 to piano (0), 25-32 to guitar (25), etc.
Here is a library that might help. https://github.com/YatingMusic/miditoolkit
@HuichuanLiu @SkyAndCloud Hi! Due to some reasons, we cannot release the script for normalizing the instrumental tracks. This script is not written by me, but as far as I know, it detects the function of each track, changes the melody tracks to synthesizer (80), and removes unnecessary ones, merges the left ones into the 5 basic accompaniment tracks. The logic is a bit complicated, but you may use the simple method mentioned by @DiegoBear as an alternative.
BTW, we have just updated the document to support arbitrary datasets. Please see the [General Use] parts.
Thank you!
Thanks for @btyu updated [General Use] part, forward() got multiple values for argument 'key_padding_mask'
eliminated.
But I see the checkpoint file was for data/meta/dict.txt
having 556 lines; while data/meta/general_use_dict.txt
has 1020 lines.
This causes the loaded checkpoints and models 's shape mis-match.
copying a param with shape torch.Size([560, 512]) from checkpoint, the shape in current model is torch.Size([1024, 512])
Could the team also upload checkpoints file for general use as well? Thanks a lot !!
(I am trying to play with the Inference part with a single GPU card...)
@oktak Hi. We only trained the model on 6-instrument data with the 556-line dict. To generate music with all kinds of instruments, you may follow the doc to train your own model. Thx.
@btyu Hi,thanks for your tips to the solvement for the KeyError when using midiprocessor, still i am confused about how to classify tracks,like melody track refers to which kind of instrument? is it fixed or not? and which are unnecessary ones?what to do when existing two track with the same insrtument?
Thank you!
@ShengXia1573 Hi! You may design your own method to merge the instruments. For example, detect which track plays the role of melody and change its instrument program id to 80, change all the piano-like instruments to 0, all the guitar-like instruments to 25, etc., and delete other unnecessary tracks. The specific rule is up to you.
However, merging the tracks to 6 tracks is optional. You can use all the tracks in the original midi files by following the [General Use] parts in the document.
As for multiple tracks of the same instrument, in the MidiProcessor code, we merge them as one.
I download the midl-full dataset and put it in data/midi, Then when I use the midiprocessor, it assert KeyError and I can only process a part of the whole data. Such as Error when encoding data/midi/8a915113d60861e9d1503ebee11e90d3.mid. Traceback (most recent call last): File "/home/disk3/cbq/anaconda3/envs/music/lib/python3.8/site-packages/midiprocessor-0.1.0-py3.8.egg/midiprocessor/batch_encoding.py", line 98, in process_file encodings = encoder.encode_file( File "/home/disk3/cbq/anaconda3/envs/music/lib/python3.8/site-packages/midiprocessor-0.1.0-py3.8.egg/midiprocessor/midi_encoding.py", line 282, in encode_file token_lists = enc_remigen2_utils.convert_pos_info_to_token_lists( File "/home/disk3/cbq/anaconda3/envs/music/lib/python3.8/site-packages/midiprocessor-0.1.0-py3.8.egg/midiprocessor/enc_remigen2_utils.py", line 101, in convert_pos_info_to_token_lists insts_ids = sort_insts(insts_ids) File "/home/disk3/cbq/anaconda3/envs/music/lib/python3.8/site-packages/midiprocessor-0.1.0-py3.8.egg/midiprocessor/inst_sorting.py", line 38, in do_sort_insts_based_6tracks_customization1 return sorted(insts, key=lambda x: sort_6tracks_customized_order[x]) File "/home/disk3/cbq/anaconda3/envs/music/lib/python3.8/site-packages/midiprocessor-0.1.0-py3.8.egg/midiprocessor/inst_sorting.py", line 38, in
return sorted(insts, key=lambda x: sort_6tracks_customized_order[x])
KeyError: 34