seni
seni

Reputation: 711

ValueError: `Checkpoint` was expecting a trackable object (an object derived from `TrackableBase`), got None

I save the checkpoint and manager of my model pretrained (in python file named train), I open an other file and I would like to restore or load the saved checkpoint and manager in order to finetune my model like below:

checkpoint = tf.train.Checkpoint(step=tf.Variable(1), optimizer=None)
manager = tf.train.CheckpointManager(checkpoint, pretrain_save_path, max_to_keep=3)

I find this error

ValueError: `Checkpoint` was expecting a trackable object (an object derived from `TrackableBase`), got None. If you believe this object should be trackable (i.e. it is part of the TensorFlow Python API and manages state), please open an issue.

Upvotes: 2

Views: 4272

Answers (1)

杜飞龙
杜飞龙

Reputation: 11

The tf.train.Checkpoint() receives kwargs paras which are key-object. And the object must be a trackable object(None is not a trackable object). So you only need delete , optimizer=None

Upvotes: 1

Related Questions