MCPcopy Create free account
hub / github.com/CompVis/zigma / wandb_runid_from_checkpoint

Function wandb_runid_from_checkpoint

utils/train_utils.py:12–30  ·  view source on GitHub ↗
(checkpoint_path)

Source from the content-addressed store, hash-verified

10
11
12def wandb_runid_from_checkpoint(checkpoint_path):
13 # Python
14 import os
15 import re
16
17 # Define the directory to search
18 dir_path = os.path.join(checkpoint_path, "wandb/latest-run")
19 # Define the pattern to match
20 pattern = r"run-(\w+)\.wandb"
21
22 # Iterate over all files in the directory
23 for filename in os.listdir(dir_path):
24 # If the filename matches the pattern
25 if re.match(pattern, filename):
26 # Extract the desired part of the filename
27 extracted_part = re.match(pattern, filename).group(1)
28 logging.info(f"induced run id from ckpt: {extracted_part}")
29 return extracted_part
30 raise ValueError("No file found that matches the pattern")
31
32
33def instantiate_from_config(config):

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected