Created
July 22, 2020 01:15
-
-
Save ilyakava/343a3fd83e98cf3196687ba5ba52562e to your computer and use it in GitHub Desktop.
Tensorflow 1.15 manual warm start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
warm_starts = sorted(glob.glob(args.warm_start_from)) if args.warm_start_from is not None else None | |
warm_start_from = warm_starts[-1] if (warm_starts is not None and len(warm_starts)) else None | |
warm_start_from = os.path.join(warm_start_from, 'variables/variables') | |
id_assignment_map = {} | |
for myvar in tf.contrib.framework.get_variables_to_restore(): | |
myscope = os.path.dirname(myvar.name) | |
if len(myscope): | |
myscope += '/' | |
id_assignment_map[myscope] = myscope | |
tf.train.init_from_checkpoint(warm_start_from, id_assignment_map) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment