in ablations/evaluation/launch_evals.py [0:0]
def checkpoint_exists(logging_dir: str, model_name: str, checkpoint: str, reference_date: Optional[datetime]) -> bool:
fs, path = url_to_fs(logging_dir)
try:
result_files = fs.glob(f"{path}/results/{model_name}/{checkpoint}/results_*.json")
except FileNotFoundError:
result_files = []
if len(result_files) == 0:
return False
if reference_date is None:
return True
timestamps = [datetime.strptime(re.search(r'results_(.*)\.json$', f).group(1), "%Y-%m-%dT%H-%M-%S.%f") for f in
result_files]
return any(timestamp > reference_date for timestamp in timestamps)