I am training a model using a data generator with a a dataset as input. The program runs perfectly until it reaches the model evaluation then it throws the following error;
raise ValueError(“y
argument is not supported when using ”
ValueError: y
argument is not supported when using python generator as input. Can someone help me fix it? The part of the code with the error is below. The issue is with the last line of code.
train_generator = generator(df_train,batch_size, tokenizer,onehot,label_encoder, n_classes)
validation_generator = generator(df_valid,batch_size, tokenizer,onehot,label_encoder, n_classes)
test_generator = generator(df_test,batch_size, tokenizer,onehot,label_encoder, n_classes)
model.fit(train_generator,
validation_data=validation_generator,
epochs=1,steps_per_epoch = len(df_train)//batch_size, validation_steps = len(df_valid)//batch_size, shuffle = True)
score = model.evaluate(test_generator, len(df_test), verbose=0)
print('Test score:', score[0])
print('Test accuracy:', score[1])
2