コード例 #1
0
def run(ctx, args):
    """Runs an experiment
    """
    print(args)
    # Strip potential operation from experiment name
    experiment, op_name = _strip_op_name_from_experiment(args)

    # Safe load of experiment file path
    try:
        experiment_config_file = \
            config.get_project_config()["experiments"].get(experiment)
    except KeyError:
        cli.error("No experiments found. "
                  "Are you sure you're in a Tracker project?")

    # Load configuration file
    experiment_config = config.load(experiment_config_file)

    # Create operation object
    #  - Here we scan through the sourcecode
    #    and extract the (hyper-)parameters
    op = oplib.Operation(
        op_name, _op_run_dir(args),
        _get_experiment_dict_by_name(experiment, experiment_config),
        _op_gpus(args), args.yes)

    # Prompt user to confirm run parameters
    if args.yes or _confirm_run(args, experiment, op):
        for n in range(args.trials):
            cli.out("Trial {}/{}".format(n + 1, args.trials))
            # Run the trial
            _run(args, op)
コード例 #2
0
ファイル: run.py プロジェクト: dti-research/tracker
def run(ctx, args):
    """Runs an experiment
    """
    # Strip potential operation from experiment name
    exp_name, op_name = _strip_op_name_from_experiment(args)
    if op_name is None:
        op_name = DEFAULT_OP
        log.debug("Running experiment: '{}' with default operation: '{}' "
                  "as no op was provided by the user!".format(
                      exp_name, op_name))

    # Safe load of experiment file path
    try:
        exp_conf_file = \
            config.get_project_config()["experiments"].get(exp_name)
    except KeyError:
        cli.error("No experiments found. "
                  "Are you sure you're in a Tracker project?")

    # Load configuration file
    exp_conf = config.load(exp_conf_file)

    # Create operation object
    op = oplib.Operation(op_name, _op_run_dir(args),
                         _op_experiment(exp_name, exp_conf), _op_remote(args),
                         _op_gpus(args))

    # Prompt user to confirm run parameters
    if args.yes or _confirm_run(args, exp_name, op):
        for n in range(args.trials):
            cli.out("Trial {}/{}".format(n + 1, args.trials))
            # Run the trial
            _run(args, op)
コード例 #3
0
ファイル: run.py プロジェクト: dti-research/tracker
def _path_for_id(run_id):
    experiments = config.get_project_config().get("experiments")
    run_dirs = _get_all_run_dirs(experiments)

    try:
        return next(x for x in run_dirs if run_id in x)
    except StopIteration:
        raise NoSuchRun(run_id)
コード例 #4
0
ファイル: run.py プロジェクト: dti-research/tracker
def get_all_run_ids():
    experiments = config.get_project_config().get("experiments")
    run_ids = []

    for exp in experiments:
        runs_dir = pathlib.experiment_runs_dir(exp)
        run_ids.extend(pathlib.get_immediate_subdirectories(runs_dir))

    return run_ids
コード例 #5
0
def _get_all_trials():
    experiments = config.get_project_config().get("experiments")
    run_ids = []

    for exp in experiments:
        # Will always return tracker home on host machine!
        runs_dir = pathlib.experiment_runs_dir(exp)
        run_ids.extend(pathlib.get_immediate_subdirectories(runs_dir))

    return [run_id[:8] for run_id in run_ids]
コード例 #6
0
def _get_experiment_names():
    project_config = config.get_project_config()
    return project_config["experiments"]
コード例 #7
0
ファイル: run.py プロジェクト: dti-research/tracker
def _get_experiment_names():
    project_config = config.get_project_config()
    # TODO: Add all op names to respective experiments.
    return project_config["experiments"]