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

Function get_latest_checkpoint

utils/train_utils.py:136–149  ·  view source on GitHub ↗
(checkpoint_dir)

Source from the content-addressed store, hash-verified

134
135
136def get_latest_checkpoint(checkpoint_dir):
137
138 # Get a list of all checkpoint files
139 checkpoint_files = glob.glob(os.path.join(checkpoint_dir, "*"))
140 # Check if there are any checkpoints
141 if not checkpoint_files:
142 # print("No checkpoints found")
143 # raise FileNotFoundError
144 return "No_checkpoints_found"
145 else:
146 # Get the checkpoint file with the latest modification time
147 latest_checkpoint = max(checkpoint_files, key=os.path.getmtime)
148 # print(f"Latest checkpoint: {latest_checkpoint}")
149 return latest_checkpoint

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected