Init CheckPoint
(exe, init_checkpoint_path, main_program)
| 134 | |
| 135 | |
| 136 | def 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 | |
| 155 | def init_pretraining_params(exe, |
nothing calls this directly
no outgoing calls
no test coverage detected