W1A3: exercise 1: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

after running history = model.fit([X, a0, c0], list(Y), epochs=100, verbose = 0), I get the following traceback, and I am unsure why it is happening. please help, thank you!

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-58-2e567c3a3672> in <module>
----> 1 history = model.fit([X, a0, c0], list(Y), epochs=100, verbose = 0)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py in _method_wrapper(self, *args, **kwargs)
    106   def _method_wrapper(self, *args, **kwargs):
    107     if not self._in_multi_worker_mode():  # pylint: disable=protected-access
--> 108       return method(self, *args, **kwargs)
    109 
    110     # Running inside `run_distribute_coordinator` already.

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
   1061           use_multiprocessing=use_multiprocessing,
   1062           model=self,
-> 1063           steps_per_execution=self._steps_per_execution)
   1064 
   1065       # Container that configures and calls `tf.keras.Callback`s.

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/data_adapter.py in __init__(self, x, y, sample_weight, batch_size, steps_per_epoch, initial_epoch, epochs, shuffle, class_weight, max_queue_size, workers, use_multiprocessing, model, steps_per_execution)
   1115         use_multiprocessing=use_multiprocessing,
   1116         distribution_strategy=ds_context.get_strategy(),
-> 1117         model=model)
   1118 
   1119     strategy = ds_context.get_strategy()

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/data_adapter.py in __init__(self, x, y, sample_weights, sample_weight_modes, batch_size, epochs, steps, shuffle, **kwargs)
    273     inputs = pack_x_y_sample_weight(x, y, sample_weights)
    274 
--> 275     num_samples = set(int(i.shape[0]) for i in nest.flatten(inputs))
    276     if len(num_samples) > 1:
    277       msg = "Data cardinality is ambiguous:\n"

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/data_adapter.py in <genexpr>(.0)
    273     inputs = pack_x_y_sample_weight(x, y, sample_weights)
    274 
--> 275     num_samples = set(int(i.shape[0]) for i in nest.flatten(inputs))
    276     if len(num_samples) > 1:
    277       msg = "Data cardinality is ambiguous:\n"

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

my code is included below

{mentor edit: code removed}

There is nothing wrong with your code that I can see.

Please don’t post your code (it breaks the course Honor Code), unless a Mentor asks you to.

Try restarting the kernel and clear the output, then re-run all of the cells. Check carefully for any error messages in any output cells.

okay, thank you. I tried your suggestion and am still getting the same error message.
Okay, I will no longer post my codes. But how can you see what the problem is if I don’t provide my code? are you able to access the jupyter notebook?

If I need to see your code, I will ask you to send it to me. But we are not at that point yet.

The error traces back to your djmodel function, but that seems to be OK.

So we’re left with some procedural problem. Such as, perhaps you missed executing some cell that defines some of the data used by the model.fit() statement.

Try to restart the kernel and clear all the output, then run all the cells in the notebook. Then carefully look at every output cell to see if there are any error messages.

Hello,

I am struggling with the same error for days.
The error I get when I run:

inference_model = music_inference_model(LSTM_cell, densor, Ty = 50)

is:

“int() argument must be a string, a bytes-like object or a number, not ‘NoneType’”.

I check many times all of my code and re-run + cleared output but with no effect.
According to the error there are None values somewhere. I see that the X in the djmodel gets the following shape:

X = Input(shape=(Tx, n_values)) → (None, 30, 90)

so also x has None, and also a. Is this related to my error?

Ok, I found where is my error.
In music_inference_model I was using inference_model = model.fit(…) instead of inference_model = Model(…) for unknown reason. I don’t know how I didn’t see this.