File size: 712 Bytes
41b9d24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import subprocess
from pathlib import Path

import argbind
import rich
from audiotools.ml import Experiment


@argbind.bind(without_prefix=True)
def run(
    run_dir: str = os.getenv("PATH_TO_RUNS", "runs"),
    name: str = None,
    recent: bool = False,
):
    if recent:
        paths = sorted(Path(run_dir).iterdir(), key=os.path.getmtime)
        paths = [p.name for p in paths if p.is_dir()]
        if paths:
            name = paths[-1]

    with Experiment(run_dir, name) as exp:
        exp.snapshot()
        rich.print(f"Created a snapshot of {exp.parent_directory} at {exp.exp_dir}")


if __name__ == "__main__":
    args = argbind.parse_args()
    with argbind.scope(args):
        run()