0

我能够通过 colab 训练基于 perofrmance_rnn_compact 架构的 midi 数据集。我还可以通过以下方式生成一系列笔记:

!performance_rnn_generate \
--run_dir=/content/drive/MyDrive/Performance_RNN/training \
--output_dir=/content/drive/MyDrive/Performance_RNN/generate \
--config='performance_with_dynamics_compact' \
--hparams="rnn_layer_sizes=[512,512,512]" \
--temperature=1. \
--num_outputs=5 \
--num_steps=20000 \
--primer_melody="[48,53,55,60,65,72,37]"

不幸的是,我无法通过以下方式从我训练有素的检查点创建一个 mag 包:

#Save your model 
!performance_rnn_generate \
--run_dir=/content/drive/MyDrive/Performance_RNN/training \
--hparams="rnn_layer_sizes=[512,512,512]" \
--bundle_file=/content/drive/MyDrive/Performance_RNN/training/bundle.mag \
--config='performance_with_dynamics_compact' \
--save_generator_bundle

看起来生成的捆绑文件可能已损坏或无法正常工作。它不能用于通过以下方式从中创建新的 midi 音符序列:

!performance_rnn_generate \
--config='performance_with_dynamics_compact' \
--hparams="rnn_layer_sizes=[512,512,512]" \
--bundle_file=/content/drive/MyDrive/Performance_RNN/training/bundle.mag \
--output_dir=/content/drive/MyDrive/Performance_RNN/generate/outofbundle \
--temperature=1. \
--num_outputs=5 \
--num_steps=20000 \
--primer_melody="[48,53,55,60,65,72,37]" 

我认为这可能与我的 performance_with_dynamics_compact 模型的“紧凑”形状有关?

也许有人有想法?

我收到以下错误:

/usr/local/lib/python3.7/dist-packages/librosa/util/decorators.py:9: NumbaDeprecationWarning: An import was requested from a module that has moved location.
Import requested from: 'numba.decorators', please update to use 'numba.core.decorators' or pin to Numba version 0.48.0. This alias will not be present in Numba version 0.50.0.
  from numba.decorators import jit as optional_jit
/usr/local/lib/python3.7/dist-packages/librosa/util/decorators.py:9: NumbaDeprecationWarning: An import was requested from a module that has moved location.
Import of 'jit' requested from: 'numba.decorators', please update to use 'numba.core.decorators' or pin to Numba version 0.48.0. This alias will not be present in Numba version 0.50.0.
  from numba.decorators import jit as optional_jit
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow/python/compat/v2_compat.py:111: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
2021-11-15 15:22:02.008172: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:39] Overriding allow_growth setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0.
INFO:tensorflow:Restoring parameters from /tmp/tmp81426j4g/model.ckpt
I1115 15:22:02.059761 139764869441408 saver.py:1399] Restoring parameters from /tmp/tmp81426j4g/model.ckpt
INFO:tensorflow:Need to generate 19912 more steps for this sequence, will try asking for 11948 RNN steps
I1115 15:22:02.129988 139764869441408 performance_sequence_generator.py:240] Need to generate 19912 more steps for this sequence, will try asking for 11948 RNN steps
Traceback (most recent call last):
  File "/usr/local/bin/performance_rnn_generate", line 8, in <module>
    sys.exit(console_entry_point())
  File "/usr/local/lib/python3.7/dist-packages/magenta/models/performance_rnn/performance_rnn_generate.py", line 290, in console_entry_point
    tf.app.run(main)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 303, in run
    _run_main(main, args)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "/usr/local/lib/python3.7/dist-packages/magenta/models/performance_rnn/performance_rnn_generate.py", line 285, in main
    run_with_flags(generator)
  File "/usr/local/lib/python3.7/dist-packages/magenta/models/performance_rnn/performance_rnn_generate.py", line 244, in run_with_flags
    generated_sequence = generator.generate(primer_sequence, generator_options)
  File "/usr/local/lib/python3.7/dist-packages/magenta/models/shared/sequence_generator.py", line 194, in generate
    return self._generate(input_sequence, generator_options)
  File "/usr/local/lib/python3.7/dist-packages/magenta/models/performance_rnn/performance_sequence_generator.py", line 242, in _generate
    len(performance) + rnn_steps_to_gen, performance, **args)
  File "/usr/local/lib/python3.7/dist-packages/magenta/models/performance_rnn/performance_model.py", line 81, in generate_performance
    extend_control_events_callback=extend_control_events_callback)
  File "/usr/local/lib/python3.7/dist-packages/magenta/models/shared/events_rnn_model.py", line 378, in _generate_events
    steps_per_iteration=steps_per_iteration)
  File "/usr/local/lib/python3.7/dist-packages/magenta/common/beam_search.py", line 130, in beam_search
    beam_entries, generate_step_fn, branch_factor, first_iteration_num_steps)
  File "/usr/local/lib/python3.7/dist-packages/magenta/common/beam_search.py", line 63, in _generate_branches
    all_sequences, all_states, all_scores)
  File "/usr/local/lib/python3.7/dist-packages/magenta/models/shared/events_rnn_model.py", line 232, in _generate_step
    temperature)
  File "/usr/local/lib/python3.7/dist-packages/magenta/models/shared/events_rnn_model.py", line 127, in _generate_step_for_batch
    [graph_final_state, graph_softmax], feed_dict)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py", line 971, in run
    run_metadata_ptr)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py", line 1168, in _run
    f'Cannot feed value of shape {str(np_val.shape)} for Tensor '
ValueError: Cannot feed value of shape (1, 22, 388) for Tensor Placeholder:0, which has shape (1, ?, 1)

在此先感谢,克里斯蒂安

4

0 回答 0