#๐Ÿ”’ TypeError: argument of type 'NoneType' is not iterable

15 messages ยท Page 1 of 1 (latest)

frozen agateBOT
#

@thorny gazelle

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

thorny gazelle
#
C:\Users\Velou\Desktop\midilearning>py generate_random_midi.py
2024-06-19 18:29:20.138370: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-06-19 18:29:21.955793: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
Loaded 61448 events from MIDI files.
C:\Users\Velou\AppData\Local\Programs\Python\Python312\Lib\site-packages\keras\src\layers\core\dense.py:87: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.
  super().__init__(activity_regularizer=activity_regularizer, **kwargs)
Epoch 1/50
Traceback (most recent call last):
  File "C:\Users\Velou\Desktop\midilearning\generate_random_midi.py", line 129, in <module>
    main()
  File "C:\Users\Velou\Desktop\midilearning\generate_random_midi.py", line 87, in main
    model.fit(X_train_scaled, {'output_time': y_time_train, 'output_quality': y_quality_train}, epochs=50, batch_size=32, validation_data=(X_test_scaled, {'output_time': y_time_test, 'output_quality': y_quality_test}))
  File "C:\Users\Velou\AppData\Local\Programs\Python\Python312\Lib\site-packages\keras\src\utils\traceback_utils.py", line 122, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "C:\Users\Velou\AppData\Local\Programs\Python\Python312\Lib\site-packages\keras\src\trainers\compile_utils.py", line 457, in build
    if name not in output_names:
       ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable```
#

Im trying to Code an Midi Generator with a bit Ai. Ive set up couple Learning Midis but it gives me those errors

ornate token
#

@thorny gazelle what this means is that output_names is None. But that happens in keras itself. The last line of code for this error that you wrote is

model.fit(X_train_scaled, {'output_time': y_time_train, 'output_quality': y_quality_train}, epochs=50, batch_size=32, validation_data=(X_test_scaled, {'output_time': y_time_test, 'output_quality': y_quality_test}))

So one of these variables must be what output_names becomes.

thorny gazelle
#

oh alr

ornate token
#

How did you produce this code?

thorny gazelle
#

kinda gpt and kinda coded my self

#

but gtp wasnt able to fix the code tho XD

ornate token
thorny gazelle
#

i understand what you said but my knoledge is also just basics

ornate token
#

I see
Try inspecting all the variables you pass to model.fit, to confirm that nothing is None.

thorny gazelle
frozen agateBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.