When Im trying to plot graph the error comes "ValueError: x and y must have same first dimension, but have shapes (5,) and (12,)"

Code:

ac = history.history[“accuracy”]
v_ac = history.history[“val_accuracy”]

loss = history.history[“loss”]
v_loss = history.history[“val_loss”]

epochs_range = range(5)
plt.figure(figsize=[8,8])
plt.subplot(121)
plt.plot(epochs_range,ac,label = “Training Accuracy”)
plt.plot(epochs_range,v_ac,label = “Validation Accuracy”)
plt.legend(loc = “lower right”)
plt.title(“Accuracy”)

plt.subplot(122)
plt.plot(epochs_range,loss,label = “Training loss”)
plt.plot(epochs_range,val_loss,label = “Validation loss” )
plt.legend(loc = “upper left”)
plt.title(“Loss”)

plt.show()
Can you tell how to correct this code

hey @sawi.1899 ,
can you let me know for how many epochs have you trained your model.
i guess 12 , correct ??