Skip to content

Tensorflow model.fit fails on test_step: 'NoneType' object has no attribute 'items' #20104

@JVD9kh96

Description

@JVD9kh96

I am using tf.data module to load my datasets. Although the training and validation data modules are almost the same. The train_step works properly and the training on the first epoch continues till the last batch, but in the test_step I get the following error:

    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'

Here is the code for fitting the model:

results = auto_encoder.fit(
    train_data,
    epochs=config['epochs'],
    steps_per_epoch=(num_train // config['batch_size']),
    validation_data=valid_data,
    validation_steps=(num_valid // config['batch_size'])-1,
    callbacks=callbacks
)

I should mention that I have used .repeat() on both train_data and valid_data, so the problem is not with not having enough samples.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions