C1_W4_Lab_2

Hello, I am getting the following error. Please help.

Epoch 1/15
8/8 ━━━━━━━━━━━━━━━━━━━━ 22s 2s/step - accuracy: 0.4979 - loss: 0.7005 - val_accuracy: 0.5000 - val_loss: 1.5893
Epoch 2/15
1/8 ━━━━━━━━━━━━━━━━━━━━ 14s 2s/step - accuracy: 0.5156 - loss: 0.9130
2024-07-12 17:56:52.399008: W tensorflow/core/framework/local_rendezvous.cc:404] Local rendezvous is aborting with status: OUT_OF_RANGE: End of sequence
	 [[{{node IteratorGetNext}}]]
2024-07-12 17:56:52.407074: W tensorflow/core/framework/local_rendezvous.cc:404] Local rendezvous is aborting with status: OUT_OF_RANGE: End of sequence
	 [[{{node IteratorGetNext}}]]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[75], line 1
----> 1 history = model.fit(
      2     train_generator,
      3     steps_per_epoch=8,
      4     epochs=15,
      5     verbose=1,
      6     validation_data=validation_generator,
      7     validation_steps=8
      8 )

File /opt/miniconda3/lib/python3.12/site-packages/keras/src/utils/traceback_utils.py:122, in filter_traceback.<locals>.error_handler(*args, **kwargs)
    119     filtered_tb = _process_traceback_frames(e.__traceback__)
    120     # To get the full stack trace, call:
    121     # `keras.config.disable_traceback_filtering()`
--> 122     raise e.with_traceback(filtered_tb) from None
    123 finally:
    124     del filtered_tb

File /opt/miniconda3/lib/python3.12/site-packages/keras/src/backend/tensorflow/trainer.py:354, in TensorFlowTrainer.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)
    333         self._eval_epoch_iterator = TFEpochIterator(
    334             x=val_x,
    335             y=val_y,
   (...)
    341             shuffle=False,
    342         )
    343     val_logs = self.evaluate(
    344         x=val_x,
    345         y=val_y,
   (...)
    351         _use_cached_eval_dataset=True,
    352     )
    353     val_logs = {
--> 354         "val_" + name: val for name, val in val_logs.items()
    355     }
    356     epoch_logs.update(val_logs)
    358 callbacks.on_epoch_end(epoch, epoch_logs)

AttributeError: 'NoneType' object has no attribute 'items'

Hi @avinil

I think you’re dealing with a None value here, you can find it and the reason causing it by debugging and printing intermediate values. Make sure that your data generators are implement correctly and avoid hardcoding values!

Hope it helps! Feel free to ask if you need further assistance.

Hi @avinil

The error tells you to recall logs value correctly for the callback codes make sure you have assigned value range for logs as well as accuracy as asked by the assignment instructions.

Hint: check videos and ungraded labs, or in case if you have done same course previous assignment, check mycallback codes.

You error is more pointing on the logs value being recalled in callback codes

Let me know if you are not able to get.

Regards
DP

I had the same error. I found that reducing the steps_per_epoch from 8 to 6 resolved the issue. Basically, the generators running out of data before the completion, as far as I can guess. Hope that helps.