checkpoint = ModelCheckpoint(
'./base.model',
monitor='val_accuracy',
verbose=1,
save_best_only=True,
mode='max',
save_weights_only=False,
save_frequency=1
)
earlystop = EarlyStopping(
monitor='val_loss',
min_delta=0.001,
patience=30,
verbose=1,
mode='auto'
)
opt1 = tf.keras.optimizers.Adam()
callbacks = [checkpoint,earlystop]
this isn't working on tensorflow 2.16.1 but, working on 2.15.0 on google colab
how can i fix my code or how can i install tensorflow 2.15.0 ?
i tried pip install tensorflow=2.15.0
but, it's showing error
The error in your comment says
save_frequencyis an unknown keyword forModelCheckpoint. In the docs it shows thatModelCheckpointexpectssave_freqas an argument. Also beware that if you set an integer forsave_freq, it saves each x batches, not epochs. If you just want it to save every epoch, you can setwhich is also the default. Why this woked in 2.15, I can not say, the docs for 2.15 also have
save_freqin it. Maybe it was compatible withsave_frequencyin the background up to that point. It is better to usesave_freq, as it is officially supported.If you want to change a package version in colab, use
%enables the pip command outside the python environment,-Uupgrades (or in your case downgrades) existing versions and you need""and either == or ~= for the version numbers. == for exact this version and ~= for, in this example "2.15.x", where x is the newest version.