calclavia / deepj Goto Github PK
View Code? Open in Web Editor NEWA deep learning model for style-specific music generation.
Home Page: https://arxiv.org/abs/1801.00887
License: MIT License
A deep learning model for style-specific music generation.
Home Page: https://arxiv.org/abs/1801.00887
License: MIT License
Why choose to set time-axis ahead and note-axis behind rather than set note-axis ahead and time-axis behind.
As title.
If there is a way to set instrument for music event or track or parttern?
Hi, i'm try to use midi_util.py to extract play, replay, volume matrix from piano-midi.de datasets, but i find that the replay matrix is always the all zeros array. How can I deal with this?
Hi i was trying to install the music package using conda but couldn't find it. Is the music file written by you or its a inbuilt python program? I am using the tensorflow version of deepj
Hello,
I've tried running this model with TF 1.6 /1.4 /1.2 (with and without GPU) and Keras 2.0 and am getting the stack trace below [ubuntu 16.04, python3.6, data folder with examples] when i execute the train.py script
Unable to load model from file.
Loading data
Training
Traceback (most recent call last):
File "train.py", line 32, in
main()
File "train.py", line 16, in main
train(models)
File "train.py", line 29, in train
models[0].fit(train_data, train_labels, epochs=1000, callbacks=cbs, batch_size=BATCH_SIZE)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1405, in fit
batch_size=batch_size)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1295, in _standardize_user_data
exception_prefix='model input')
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 121, in _standardize_input_data
str(array.shape))
ValueError: Error when checking model input: expected input_1 to have 4 dimensions, but got array with shape (0, 1)
I tried downgrading Keras to 1.xx but the code uses Keras 2.0 syntax.
can you please look into it?
After installing all requirements (python-midi
and requirements.txt
) I get this error message when executing generate.py
:
Using TensorFlow backend.
Traceback (most recent call last):
File "generate.py", line 153, in <module>
main()
File "generate.py", line 142, in main
models = build_or_load()
File "/Users/frederikriedel/Developer/DeepJ/util.py", line 15, in build_or_load
models = build_models()
File "/Users/frederikriedel/Developer/DeepJ/model.py", line 149, in build_models
notes_out = naxis(time_out, chosen, style)
File "/Users/frederikriedel/Developer/DeepJ/model.py", line 111, in f
dense_layer_cache[l] = Dense(int(x.get_shape()[3]))
TypeError: __int__ returned non-int (type NoneType)
Do you maybe know what I'm missing here?
Hi, I install all requirements and run the generate code.
When I run python generate
there is a error
Writing file out/samples/output_0.mid
Traceback (most recent call last):
File "generate.py", line 153, in
main()
File "generate.py", line 150, in main
write_file('output', generate(models, args.bars, styles))
File "generate.py", line 134, in write_file
midi.write_midifile(fpath, mf)
File "/home/inspur/anaconda3/lib/python3.6/site-packages/midi/fileio.py", line 169, in write_midifile
return write_midifile(out,pattern)
File "/home/inspur/anaconda3/lib/python3.6/site-packages/midi/fileio.py", line 171, in write_midifile
return writer.write(pattern)
File "/home/inspur/anaconda3/lib/python3.6/site-packages/midi/fileio.py", line 105, in write
self.write_track(track)
File "/home/inspur/anaconda3/lib/python3.6/site-packages/midi/fileio.py", line 122, in write_track
buf.extend(self.encode_midi_event(event))
File "/home/inspur/anaconda3/lib/python3.6/site-packages/midi/fileio.py", line 161, in encode_midi_event
ret.extend(event.data)
ValueError: byte must be in range(0, 256)
I just use the pertained model, I am not sure if it is my environment's mismatch.
each my style folder only contrains 10 midi files.
it uses one hour for only 1 epoch.
Multitask training technique
Allow the generation algorithm to interpolate between two styles.
Given two styles as vectors, we want the algorithm to slowly change style every single time step, until it ends up with a different style by the end of the song.
E.g: [1, 0, 0]
-> [0.5, 0.5, 0]
-> [0, 1, 0]
This should work with a mixture of styles as well [0.5, 0.5, 0]
to [0, 0.5, 0.5]
I get this error message
Traceback (most recent call last):
File "train.py", line 32, in <module>
main()
File "train.py", line 15, in main
models = build_or_load()
File "/home/jose/DeepJ-icsc/util.py", line 15, in build_or_load
models = build_models()
File "/home/jose/DeepJ-icsc/model.py", line 149, in build_models
notes_out = naxis(time_out, chosen, style)
File "/home/jose/DeepJ-icsc/model.py", line 111, in f
dense_layer_cache[l] = Dense(int(x.get_shape()[3]))
TypeError: __int__ returned non-int (type NoneType)
can it possibly support multi-instruments in the future?
the folder data/ only contains midi?
I encountered error when i train model with data folder only contains midi.
So i wonder if there is some misunderstanding about the train data I built.
I'd appreciated if U can help me with the problem.(ฅ´ω`ฅ)
Traceback (most recent call last):
File "generate.py", line 153, in
main()
File "generate.py", line 142, in main
models = build_or_load()
File "/data/python/DeepJ-icsc/util.py", line 15, in build_or_load
models = build_models()
File "/data/python/DeepJ-icsc/model.py", line 149, in build_models
notes_out = naxis(time_out, chosen, style)
File "/data/python/DeepJ-icsc/model.py", line 111, in f
dense_layer_cache[l] = Dense(int(x.get_shape()[3]))
TypeError: int returned non-int (type NoneType)
run generate.py in CentOS 7.2, tensorflow cpu mode, python 3.5
Hi, I am currently trying to run the master branch on Google Colab using Pytorch 4.0, cuda 8.0. But during the training of first epoch the following error occurs:
=== Loading Model ===
GPU: True
Batch Size: 32
FP16: True
Number of Parameters: 113496
=== Dataset ===
Loading data...
100%|█████████████████████████████████████████████| 2/2 [00:02<00:00, 1.03s/it]
Loading 2 MIDI file(s) with average event count 19748.0
100%|█████████████████████████████████████████████| 2/2 [00:01<00:00, 1.03it/s]
Loading 2 MIDI file(s) with average event count 7399.5
Creating data generators...
Training Sequences: 3 Validation Sequences: 1
=== Training ===
Epoch 1: 16%|███▏ | 158/1000 [02:24<12:52, 1.09it/s, loss=4.43]Epoch 1: 36%|███████ | 355/1000 [05:26<09:53, 1.09it/s, loss=4.24]
Traceback (most recent call last):
File "train.py", line 210, in
main()
File "train.py", line 207, in main
train(args, model, train_batcher, TRAIN_CYCLES, val_batcher, VAL_CYCLES, optimizer, plot=not args.noplot)
File "train.py", line 56, in train
loss = train_step(model, data, optimizer)
File "train.py", line 116, in train_step
torch.nn.utils.clip_grad_norm_(model.parameters(), GRADIENT_CLIP)
File "/usr/local/lib/python3.5/site-packages/torch/nn/utils/clip_grad.py", line 28, in clip_grad_norm_
param_norm = p.grad.data.norm(norm_type)
RuntimeError: value cannot be converted to type Half without overflow: inf
Please help! Thank!!
Epoch 60/1000
10954/10954 [==============================] - 659s - loss: 0.0475
Epoch 61/1000
10954/10954 [==============================] - 658s - loss: 0.0474
Epoch 62/1000
10954/10954 [==============================] - 658s - loss: 0.0473
Epoch 63/1000
10954/10954 [==============================] - 659s - loss: 0.0471
Epoch 64/1000
10954/10954 [==============================] - 658s - loss: 0.0472
Epoch 65/1000
10954/10954 [==============================] - 658s - loss: 0.0612
Epoch 66/1000
10954/10954 [==============================] - 659s - loss: 0.0958
Epoch 67/1000
10954/10954 [==============================] - 657s - loss: 0.0877
you can see around epoch 66 the loss had increased a lot, does it mean hours of training wasted? sry I am a beginner of this... :(
Artistic style embedding:
Writing file out/samples/output_0.mid
Traceback (most recent call last):
File "generate.py", line 153, in <module>
main()
File "generate.py", line 150, in main
write_file('output', generate(models, args.bars, styles))
File "generate.py", line 134, in write_file
midi.write_midifile(fpath, mf)
File "/usr/local/python3/lib/python3.5/site-packages/midi/fileio.py", line 169, in write_midifile
return write_midifile(out,pattern)
File "/usr/local/python3/lib/python3.5/site-packages/midi/fileio.py", line 171, in write_midifile
return writer.write(pattern)
File "/usr/local/python3/lib/python3.5/site-packages/midi/fileio.py", line 105, in write
self.write_track(track)
File "/usr/local/python3/lib/python3.5/site-packages/midi/fileio.py", line 122, in write_track
buf.extend(self.encode_midi_event(event))
File "/usr/local/python3/lib/python3.5/site-packages/midi/fileio.py", line 161, in encode_midi_event
ret.extend(event.data)
ValueError: byte must be in range(0, 256)
I kept my machine up for 6 hours and trained for about 40 epochs.
In Ubuntu 16.04 64 with NV tesla P4 box, I can install & run python-midi 0.2.3 in python2,but can not do the same with python3, because " No module named container".
build_or_load()
Traceback (most recent call last):
File "util.py", line 36, in
build_or_load()
File "util.py", line 15, in build_or_load
models = build_models()
File "/Users/chenqi/workspace/DeepJ/model.py", line 148, in build_models
notes_out = naxis(time_out, chosen, style)
File "/Users/chenqi/workspace/DeepJ/model.py", line 110, in f
dense_layer_cache[l] = Dense(int(x.get_shape()[3]))
TypeError: int returned non-int (type NoneType)
shift_chosen = Lambda(lambda x: tf.pad(x[:, :, :-1, :], [[0, 0], [0, 0], [1, 0], [0, 0]]))(chosen)
# shift_chosen: shape=(?, 128, 48, 3)
shift_chosen = Reshape((time_steps, NUM_NOTES, -1))(shift_chosen)
# shift_chosen: shape=(?, 128, 48, ?)
x = Concatenate(axis=3)([x, shift_chosen])
# x: shape=(?, 128, 48, ?)
then int(x.get_shape()[3])
throw TypeError: int returned non-int (type NoneType)
Is it possible to export the model into a javascript music generator, the Deepj.AI link does not work even if I turned off the ad blocker, and I would like to listen to it.
Can anybody please summarize the versions of all the different libraries that we have to use in this. I have been for the past few hours trying to run this, but always an error comes up. Currently, am stuck at "Failed to load the native TensorFlow runtime".
For display purposes.
the genres and stylesc I set are like this:
genre = [
'jazz',
'classical',
'hip_hop'
]
styles = [
[
'data/jazz/CharlieParker',
'data/jazz/DavidLiebman',
'data/jazz/JJJohnson'
],
[
'data/classical/beethoven',
'data/classical/holst',
'data/classical/stravinsky'
'data/classical/sullivan'
],
[
'data/hip_hop/50_cent',
'data/hip_hop/ja_rule',
'data/hip_hop/pitbull',
'data/hip_hop/will_smith',
]
]
How to write the command line to generate music of different styles.
I use " python generate.py -h" to get the optional arguments,it says:
--styles STYLES [STYLES ...] Styles to mix together
but i can't figure out the specific usage of the style control:
i have tried " python generate.py --styles classical"and " python generate.py --styles classical[beethoven holst],
both showing "error: argument --styles: invalid int value: 'beethoven'"
for example, if someone wants a keyboard sinfonia, just write down the first few bars and the model can continue the music.
Website https://deepj.ai/ shows loading sign way too long.
Console shows errors:
Failed to load resource: the server responded with a status of 522 ()
https://server.deepj.ai/stream.mp3?length=1000&seed=0&Baroque=0.021820007785793072&Classical=0.8729091205455646&Romantic=0.5977987382883878&Modern=0.49897429867853504
Failed to load https://server.deepj.ai/stream.mp3?length=1000&seed=0&Baroque=0.021820007785793072&Classical=0.8729091205455646&Romantic=0.5977987382883878&Modern=0.49897429867853504: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://deepj.ai' is therefore not allowed access. The response had HTTP status code 522.
I am on MAC OS X 10.3.1
Using TensorFlow backend.
Traceback (most recent call last):
File "train.py", line 32, in
main()
File "train.py", line 15, in main
models = build_or_load()
File "/Users/swarnaananthan/storycircles/ai_music/DeepJ/util.py", line 15, in build_or_load
models = build_models()
File "/Users/swarnaananthan/storycircles/ai_music/DeepJ/model.py", line 149, in build_models
notes_out = naxis(time_out, chosen, style)
File "/Users/swarnaananthan/storycircles/ai_music/DeepJ/model.py", line 111, in f
dense_layer_cache[l] = Dense(int(x.get_shape()[3]))
TypeError: int returned non-int (type NoneType)
Please help me in fixing the issue.
on the console:
GET http://18.222.90.74/stream.mp3?length=1000&seed=0&Baroque=0.0982352937586819&Classical=0.7525334207246455&Romantic=0.8340969462751091&Modern=0.8574476342870909 net::ERR_CONNECTION_REFUSED
I want to know how to compile the training file for producing the music?
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.