DeepJ: TypeError: __int__ returned non-int (type NoneType)

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?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

@calclavia @slave2sync @swarna-a-26 I am on Ubtuntu Linux with TF 1.12 with GPU (without GPU) and Keras 2.0. I am getting the same ValueError: Error when checking model input: expected input_1 to have 4 dimensions, but got array with shape (0, 1)

Any help would be much appreciated?

@frogg @dannywu19910524 I used tensorflow1.6.0 and keras 2.0.0.That seems to remove the above error.Thanks so much. I am getting the below error when I try to train the data. volume_dense (Dense) multiple 129


concatenate_3 (Concatenate) (None, 128, 48, 3) 0

Total params: 1,269,476.0 Trainable params: 1,269,476.0 Non-trainable params: 0.0


Unable to load model from file. Loading data Training Traceback (most recent call last): File “train.py”, line 32, in <module> 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/site-packages/keras/engine/training.py”, line 1405, in fit batch_size=batch_size) File “/usr/local/lib/python3.6/site-packages/keras/engine/training.py”, line 1295, in _standardize_user_data exception_prefix=‘model input’) File “/usr/local/lib/python3.6/site-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)

Any idea about this error? I created a data folder and have three mid files there. Any thoughts to overcome this issue? Is this one also related to keras and tensorflow version? any thoughts will be helpful.I am using MAC 10.13.1

That was a great hint. It wasn’t the tensorflow version itself that caused the issue, but keras. I installed an older version of keras now and it seems to work!