spectraldoy / music-transformer Goto Github PK
View Code? Open in Web Editor NEWMy project to build and train a Music Transformer in PyTorch.
License: GNU General Public License v3.0
My project to build and train a Music Transformer in PyTorch.
License: GNU General Public License v3.0
Heya, I faced this error while trying to generate some MIDIs based on your pretrained weights. Do you know how I can fix this? I feel that it's something to do with the PyTorch version but I have installed the versions as listed in requirements.txt.
PS C:\Users\USER\Desktop\music-transformer-main> python generate.py models/chopintransformerv5.pt .../gen_audio.mid -v
Greedy decoding...
Traceback (most recent call last):
File "C:\Users\USER\Desktop\music-transformer-main\generate.py", line 282, in
generate(model_=music_transformer, inp=[""], save_path=args.save_path,
File "C:\Users\USER\Desktop\music-transformer-main\generate.py", line 229, in generate
token_ids = greedy_decode(model=model_, inp=inp, mode=mode, temperature=temperature, k=k)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Desktop\music-transformer-main\generate.py", line 109, in greedy_decode
predictions = model(inp, mask=create_mask(inp, n))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Desktop\music-transformer-main\model.py", line 107, in forward
x = self.decoder(x, memory=None, tgt_mask=mask)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\transformer.py", line 461, in forward
seq_len = _get_seq_len(tgt, self.layers[0].self_attn.batch_first)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1688, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")
AttributeError: 'DecoderLayer' object has no attribute 'self_attn'
Given appropriately normalised MIDI files, this transformer produces results that are truly astonishing, a head and shoulders above all the other similar projects on github.
Samples of generated Baroque music attached.
samples.zip
First of all, this is a great repo and it was super helpful in understanding the music transformer! I had some questions about training. For the pretrained models you included, how many epochs did you train for, and approximately how long did training take? Do you have any graphs from these runs that you could share, and what training / validation loss did you achieve?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.