MusicVAE - multitrack training problem

219 views
Skip to first unread message

andrey...@gmail.com

unread,
Jul 15, 2018, 1:08:21 PM7/15/18
to Magenta Discuss

Hello,

 

Thanks to all in this forum for help!

 

I am trying to use MusicVAE to generate music in style of one of my favorite band.

 

As I understand to do this I should:

 

1.     Train model on batch of midi

2.     Generate random samples

3.     Enjoy

 

 

I find  out that unconditional model here looks good for me:

 

https://colab.research.google.com/notebooks/magenta/music_vae/multitrack.ipynb

 

Unfortunately there is no possibility to train model with my own midi in this Colab Notebook.

So I am trying to do it on my own environment.

 

I set up magenta

 
!pip install magenta

 

Convert midi to note_sequences

 

!convert_dir_to_note_sequences \
  --input_dir=RancidMidi \
  --output_file=tmp/notesequences_BandMidi.tfrecord \
  --recursive

 

Then I am trying to train model on sequences:

 

!music_vae_train \
--config=cat-mel_2bar_small \
--run_dir=/tmp/music_vae/ \
--mode=train \
--examples_path=tmp/notesequences_BandMidi.tfrecord

 

And I am getting the following exception:

 

INFO:tensorflow:Reading examples from: tmp/notesequences_BandMidi.tfrecord
INFO:tensorflow:Building MusicVAE model with BidirectionalLstmEncoder, CategoricalLstmDecoder, and hparams:
{'dec_rnn_size': [256, 256], 'min_learning_rate': 1e-05, 'beta_rate': 0.99999, 'sampling_schedule': 'inverse_sigmoid', 'clip_mode': 'global_norm', 'use_cudnn': False, 'residual_decoder': False, 'sampling_rate': 1000, 'decay_rate': 0.9999, 'free_bits': 0, 'grad_clip': 1.0, 'grad_norm_clip_to_zero': 10000, 'max_seq_len': 32, 'enc_rnn_size': [512], 'learning_rate': 0.001, 'batch_size': 512, 'conditional': True, 'max_beta': 0.2, 'residual_encoder': False, 'dropout_keep_prob': 1.0, 'z_size': 256}
INFO:tensorflow:
Encoder Cells (bidirectional):
  units: [512]
 
INFO:tensorflow:
Decoder Cells:
  units: [256, 256]
 
Traceback (most recent call last):
  File "/opt/conda/bin/music_vae_train", line 11, in <module>
    sys.exit(console_entry_point())
  File "/opt/conda/lib/python3.5/site-packages/magenta/models/music_vae/music_vae_train.py", line 325, in console_entry_point
    tf.app.run(main)
  File "/opt/conda/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "/opt/conda/lib/python3.5/site-packages/magenta/models/music_vae/music_vae_train.py", line 321, in main
    run(configs.CONFIG_MAP)
  File "/opt/conda/lib/python3.5/site-packages/magenta/models/music_vae/music_vae_train.py", line 303, in run
    task=FLAGS.task)
  File "/opt/conda/lib/python3.5/site-packages/magenta/models/music_vae/music_vae_train.py", line 162, in train
    is_training=True)
  File "/opt/conda/lib/python3.5/site-packages/magenta/models/music_vae/base_model.py", line 161, in build
    self._decoder.build(hparams, output_depth, is_training)
  File "/opt/conda/lib/python3.5/site-packages/magenta/models/music_vae/lstm_models.py", line 296, in build
    hparams, is_training)
  File "/opt/conda/lib/python3.5/site-packages/magenta/models/music_vae/lstm_utils.py", line 214, in get_sampling_probability
    sampling_probability = 1.0 - k / (k + tf.exp(step / k))
  File "/opt/conda/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 970, in binary_op_wrapper
    y = ops.convert_to_tensor(y, dtype=x.dtype.base_dtype, name="y")
  File "/opt/conda/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1014, in convert_to_tensor
    as_ref=False)
  File "/opt/conda/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1104, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/opt/conda/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 947, in _TensorTensorConversionFunction
    (dtype.name, t.dtype.name, str(t)))
ValueError: Tensor conversion requested dtype float32 for Tensor with dtype int32: 'Tensor("Const:0", shape=(), dtype=int32)'
 

 

Could any one please help what I am doing wrong?



There is possibility to upload midi to Reconstruct  in Colab Notebook - #@title Upload MIDI Files to Reconstruct

https://colab.research.google.com/notebooks/magenta/music_vae/multitrack.ipynb


It works perfect with my midi  - i can do nice Interpolation Between  Samples. So it should not be a problem with midi.

But I want to generate a track not Interpolation between some bars.


I tried to used melody_rnn to generate melody line based on other single melodies -  it works fine.

But now I want multi-track :)


Could you please point me to the reason of exception (float32/int32)?

Or may be there is a code example or suitable Colab Notebook?


!pip list | grep tensorflow 
tensorflow (1.8.0)




Many thanks!





 

Adam Roberts

unread,
Jul 16, 2018, 8:53:08 AM7/16/18
to andrey...@gmail.com, Magenta Discuss
Try adding the flag 
"--hparams=sampling_rate=1000.0"

--
Magenta project: magenta.tensorflow.org
To post to this group, send email to magenta...@tensorflow.org
To unsubscribe from this group, send email to magenta-discu...@tensorflow.org
---
You received this message because you are subscribed to the Google Groups "Magenta Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to magenta-discu...@tensorflow.org.

andrey...@gmail.com

unread,
Jul 19, 2018, 5:13:14 PM7/19/18
to Magenta Discuss, andrey...@gmail.com
Thank you Adam, unfortunately it did not help. Still same problem :(

понедельник, 16 июля 2018 г., 15:53:08 UTC+3 пользователь Adam Roberts написал:

Adam Roberts

unread,
Jul 30, 2018, 2:28:45 PM7/30/18
to andrey...@gmail.com, Magenta Discuss
Andrey,

I am having trouble reproducing this. Can you open an issue on the GitHub and we can follow up there?

-Adam

Adam Roberts

unread,
Jul 30, 2018, 4:18:48 PM7/30/18
to andrey...@gmail.com, Magenta Discuss
FYI, this should be fixed in v0.3.10.

andrey...@gmail.com

unread,
Jul 31, 2018, 4:47:40 AM7/31/18
to Magenta Discuss, andrey...@gmail.com
Thanks Adam! Will do. 
Probably  it is a problem with Python 3

Do you have any plans for 0.3.10 release date?

понедельник, 30 июля 2018 г., 23:18:48 UTC+3 пользователь Adam Roberts написал:

Adam Roberts

unread,
Jul 31, 2018, 11:17:46 AM7/31/18
to andrey...@gmail.com, Magenta Discuss
Yes, it is released although there seems to be another issue. Follow https://github.com/tensorflow/magenta/issues/1245 for updates.
Reply all
Reply to author
Forward
0 new messages