salu133445 / musegan

An AI for Music Generation
https://salu133445.github.io/musegan/
MIT License
1.84k stars 374 forks source link

Failed to convert object of type <class 'list'> to Tensor. #61

Closed YacratesWyh closed 5 years ago

YacratesWyh commented 5 years ago

I've fixed some issues of import tensorflow.nn to import tensorflow.python.ops.nn Still, I encounter the following error, what's happening?

:~/musegan$ ./scripts/run_inference.sh "./exp/my_experiment/" "0" /home/yinhao/anaconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6 return f(*args, **kwds) /home/yinhao/anaconda3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters musegan.inference INFO Using parameters: {'beat_resolution': 12, 'condition_track_idx': None, 'data_shape': [4, 48, 84, 5], 'is_accompaniment': False, 'is_conditional': False, 'latent_dim': 128, 'nets': {'discriminator': 'default', 'generator': 'default'}, 'use_binary_neurons': False} musegan.inference INFO Using configurations: {'adam': {'beta1': 0.5, 'beta2': 0.9}, 'batch_size': 64, 'checkpoint_dir': './exp/my_experiment//model', 'colormap': [[1.0, 0.0, 0.0], [1.0, 0.5, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [0.0, 0.5, 1.0]], 'columns': 5, 'config': './exp/my_experiment//config.yaml', 'data_filename': 'train_x_lpd_5_phr', 'data_source': 'sa', 'evaluate_steps': 100, 'gan_loss_type': 'wasserstein', 'gpu': '0', 'initial_learning_rate': 0.001, 'learning_rate_schedule': {'end': 50000, 'end_value': 0.0, 'start': 45000}, 'log_loss_steps': 100, 'lower': -2, 'midi': {'is_drums': [1, 0, 0, 0, 0], 'lowest_pitch': 24, 'programs': [0, 0, 25, 33, 48], 'tempo': 100}, 'n_dis_updates_per_gen_update': 5, 'n_jobs': 20, 'params': './exp/my_experiment//params.yaml', 'result_dir': './exp/my_experiment//results/inference', 'rows': 5, 'runs': 10, 'sample_grid': [8, 8], 'save_array_samples': True, 'save_checkpoint_steps': 10000, 'save_image_samples': True, 'save_pianoroll_samples': True, 'save_samples_steps': 100, 'save_summaries_steps': 0, 'slope_schedule': {'end': 50000, 'end_value': 5.0, 'start': 10000}, 'steps': 50000, 'upper': 2, 'use_gradient_penalties': True, 'use_learning_rate_decay': True, 'use_random_transpose': False, 'use_slope_annealing': False, 'use_train_test_split': False} musegan.model INFO Building model. musegan.model INFO Building training nodes. Traceback (most recent call last): File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 468, in make_tensor_proto str_values = [compat.as_bytes(x) for x in proto_values] File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 468, in str_values = [compat.as_bytes(x) for x in proto_values] File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/compat.py", line 65, in as_bytes (bytes_or_text,)) TypeError: Expected binary or unicode string, got None

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/yinhao/musegan/scripts/../src/inference.py", line 163, in main() File "/home/yinhao/musegan/scripts/../src/inference.py", line 111, in main config=config) File "/home/yinhao/musegan/src/musegan/model.py", line 60, in call return self.get_train_nodes(x, z, y, c, params, config) File "/home/yinhao/musegan/src/musegan/model.py", line 106, in get_train_nodes nodes['fake_x'] = self.gen(nodes['z'], y, True) File "/home/yinhao/musegan/src/musegan/presets/generator/default.py", line 25, in call h = tconv_layer(h, 512, (4, 1, 1), (4, 1, 1)) # 4, 1, 1 File "/home/yinhao/musegan/src/musegan/presets/generator/default.py", line 16, in tconv_layer = lambda i, f, k, s: ACTIVATION(norm(tconv3d(i, f, k, s))) File "/home/yinhao/musegan/src/musegan/presets/ops.py", line 16, in i, f, k, s, kernel_initializer=CONV_KERNEL_INITIALIZER) File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/layers/convolutional.py", line 1733, in conv3d_transpose return layer.apply(inputs) File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 671, in apply return self.call(inputs, *args, *kwargs) File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 575, in call outputs = self.call(inputs, args, **kwargs) File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/layers/convolutional.py", line 1618, in call outputs_shape[3], outputs_shape[4] File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3938, in reshape "Reshape", tensor=tensor, shape=shape, name=name) File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 513, in _apply_op_helper raise err File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 510, in _apply_op_helper preferred_dtype=default_dtype) File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 926, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 229, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 208, in constant value, dtype=dtype, shape=shape, verify_shape=verify_shape)) File "/home/yinhao/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 472, in make_tensor_proto "supported type." % (type(values), values)) TypeError: Failed to convert object of type <class 'list'> to Tensor. Contents: [None, 4, 1, 512]. Consider casting elements to a supported type.

salu133445 commented 5 years ago

Hi, what version of TensorFlow are you using? There was a bug in tf.layers.conv3d_transpose in previous versions. You might need to update the TensorFlow library or create a virtual environment with the provided Pipfile (you can find how to do so in the README file).

salu133445 commented 5 years ago

Close the issue for there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.