Skip to content

Commit 9555b66

Browse files
authored
implement latest_checkpoint.
1 parent 774fbc8 commit 9555b66

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

site/en/tutorials/distribute/keras.ipynb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,10 @@
486486
},
487487
"outputs": [],
488488
"source": [
489-
"model.load_weights(tf.train.latest_checkpoint(checkpoint_dir))\n",
489+
"import pathlib\n",
490+
"latest_checkpoint = sorted(pathlib.Path(checkpoint_dir).glob('*'))[-1]\n",
491+
"\n",
492+
"model.load_weights(latest_checkpoint)\n",
490493
"\n",
491494
"eval_loss, eval_acc = model.evaluate(eval_dataset)\n",
492495
"\n",

0 commit comments

Comments
 (0)