MCPcopy Create free account
hub / github.com/google-research/language / checkpoints_iterator

Function checkpoints_iterator

language/capwap/utils/experiment_utils.py:190–208  ·  view source on GitHub ↗

Iterate all checkpoints in model directory in order they are created.

(model_dir)

Source from the content-addressed store, hash-verified

188
189
190def checkpoints_iterator(model_dir):
191 """Iterate all checkpoints in model directory in order they are created."""
192 visited = set()
193 while True:
194 tf.logging.info("Waiting for new checkpoints at %s", model_dir)
195 while True:
196 ckpt_state = tf.train.get_checkpoint_state(model_dir)
197 if not ckpt_state:
198 time.sleep(1)
199 continue
200 ckpt_paths = ckpt_state.all_model_checkpoint_paths
201 new_ckpts = [p for p in ckpt_paths if p not in visited]
202 if new_ckpts:
203 break
204 new_ckpts = sorted(
205 new_ckpts, key=lambda x: int(os.path.basename(x).split("-")[1]))
206 tf.logging.info("Found new checkpoint at %s", new_ckpts[0])
207 yield new_ckpts[0]
208 visited.add(new_ckpts[0])
209
210
211def evaluate_checkpoints(

Callers 1

evaluate_checkpointsFunction · 0.85

Calls 2

splitMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…