in scripts/plotting/plot_sweep.py [0:0]
def get_paths(pattern):
base_path = Path("/checkpoint/{}/mvfst-rl/multirun".format(getpass.getuser()))
#base_path = Path("/checkpoint/{}/mvfst-rl/run".format(getpass.getuser()))
if isinstance(pattern, str):
pattern = [pattern]
logdirs = [logdir for p in pattern for logdir in base_path.glob(p)]
# This function identifies the folders of individual experiments. In multirun mode they
# are just numbers, while in single run mode we can still identify them by the presence
# of the "train" subfolder.
is_individual_folder = lambda path: (path.is_dir() and path.name.isdigit()) or (path / "train").is_dir()
all_paths = []
for logdir in logdirs:
if is_individual_folder(logdir):
all_paths.append(logdir / "train")
else:
all_paths += [
item / "train" for item in logdir.iterdir()
if is_individual_folder(item)
]
paths = []
for path in all_paths:
logf = path / "logs.tsv"
if not logf.exists():
print(f"logs.tsv not found, skipping {path}")
continue
if logf.stat().st_size == 0:
print(f"Empty logs.tsv, skipping {path}")
continue
paths.append(path)
return paths