Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Fix resume checkpoint for tf2 codepath #1912

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tensor2tensor/utils/contrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# these as needed.
import tensorflow_addons as tfa # pylint: disable=g-import-not-at-top
import tf_slim # pylint: disable=g-import-not-at-top
import tensorflow as tf2
is_tf2 = True


Expand All @@ -55,6 +56,12 @@ def __init__(self, **kw):
for k, v in kw.items():
setattr(self, k, v)

def load_checkpoint(self, ckpt_dir):
return tf2.train.load_checkpoint(ckpt_dir)

def get_trainable_variables(self):
return tf.trainable_variables()


def slim():
return tf_slim
Expand Down