MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / load_existing_json

Method load_existing_json

tensorpack/callbacks/monitor.py:309–323  ·  view source on GitHub ↗

Look for an existing json under dir (defaults to :meth:`logger.get_logger_dir()`) named "stats.json", and return the loaded list of statistics if found. Returns None otherwise.

(dir=None)

Source from the content-addressed store, hash-verified

307
308 @staticmethod
309 def load_existing_json(dir=None):
310 """
311 Look for an existing json under dir (defaults to
312 :meth:`logger.get_logger_dir()`) named "stats.json",
313 and return the loaded list of statistics if found. Returns None otherwise.
314 """
315 if dir is None:
316 dir = logger.get_logger_dir()
317 fname = os.path.join(dir, JSONWriter.FILENAME)
318 if tf.gfile.Exists(fname):
319 with open(fname) as f:
320 stats = json.load(f)
321 assert isinstance(stats, list), type(stats)
322 return stats
323 return None
324
325 @staticmethod
326 def load_existing_epoch_number(dir=None):

Callers 2

_before_trainMethod · 0.80

Calls 2

joinMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected