MCPcopy Create free account
hub / github.com/baidu/lac / init_checkpoint

Function init_checkpoint

python/LAC/utils.py:136–152  ·  view source on GitHub ↗

Init CheckPoint

(exe, init_checkpoint_path, main_program)

Source from the content-addressed store, hash-verified

134
135
136def init_checkpoint(exe, init_checkpoint_path, main_program):
137 """Init CheckPoint"""
138 assert os.path.exists(
139 init_checkpoint_path), "[%s] cann't be found." % init_checkpoint_path
140
141 def existed_persitables(var):
142 """If existed presitabels"""
143 if not fluid.io.is_persistable(var):
144 return False
145 return os.path.exists(os.path.join(init_checkpoint_path, var.name))
146
147 fluid.io.load_vars(
148 exe,
149 init_checkpoint_path,
150 main_program=main_program,
151 predicate=existed_persitables)
152 print("Load model from {}".format(init_checkpoint_path))
153
154
155def init_pretraining_params(exe,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected