示例#1
0
def same_run_eval(black_num=0, white_num=0):
    """Shorthand to spawn a job matching up two models from the same run,
    identified by their model number """
    if black_num <= 0 or white_num <= 0:
        print("Need real model numbers")
        return

    b = fsdb.get_model(black_num)
    w = fsdb.get_model(white_num)

    b_model_path = os.path.join(fsdb.models_dir(), b)
    w_model_path = os.path.join(fsdb.models_dir(), w)

    return launch_eval_job(b_model_path + ".pb", w_model_path + ".pb",
                           "{:d}-{:d}".format(black_num, white_num),
                           flags.FLAGS.bucket_name)
def get_mg_path(model_run, model_num):
    """
    model_run = integer, e.g. 15, 16, corresponding to the v-number
    model_num = integer, e.g 939, for the model number in that run
    """
    fsdb.switch_base("minigo-pub/v{:d}-19x19".format(model_run))
    model = fsdb.get_model(model_num)
    return os.path.join(fsdb.models_dir(), model)
def same_run_eval(black_num=0, white_num=0, completions=4):
    """Shorthand to spawn a job matching up two models from the same run,
    identified by their model number """
    if black_num <= 0 or white_num <= 0:
        print("Need real model numbers")
        return

    b = fsdb.get_model(black_num)
    w = fsdb.get_model(white_num)

    b_model_path = os.path.join(fsdb.models_dir(), b)
    w_model_path = os.path.join(fsdb.models_dir(), w)
    flags_path = fsdb.eval_flags_path()

    obj = launch_eval_job(b_model_path + ".pb",
                          w_model_path + ".pb",
                          "{:d}-{:d}".format(black_num, white_num),
                          bucket_name=flags.FLAGS.bucket_name,
                          flags_path=flags_path,
                          completions=completions)

    # Fire spams the retval to stdout, so...
    return "{} job launched ok".format(obj[1].metadata.name)
示例#4
0
def model_id(name_or_num):
    db = sqlite3.connect("ratings.db")
    bucket = fsdb.models_dir()
    if not isinstance(name_or_num, str):
        name_or_num = fsdb.get_model(name_or_num)
    return rowid_for(db, bucket, name_or_num)