Example #1
0
def main():
    selfplay_settings = SelfplaySettings(
        game="ataxx",
        game_count=8,
        temperature=1.0,
        zero_temp_move_count=20,
        max_game_length=300,
        keep_tree=False,
        dirichlet_alpha=0.2,
        dirichlet_eps=0.25,
        full_search_prob=1.0,
        full_iterations=500,
        part_iterations=500,
        exploration_weight=2.0,
        random_symmetries=True,
        batch_size=128,
        threads_per_device=2,
    )

    train_settings = TrainSettings(
        epochs=1,
        wdl_target=WdlTarget.Final,
        policy_weight=2.0,
        batch_size=128,
        plot_points=100,
        plot_smooth_points=50,
    )

    root_path = "data/ataxx/loop1"
    # TODO remove this again, pretty dangerous!
    shutil.rmtree(root_path, ignore_errors=True)
    os.makedirs(root_path, exist_ok=True)
    initial_path = os.path.join(root_path, "initial_network.pt")

    model = GoogleModel(64, 4, 2, 32, True, None, False)
    model = torch.jit.script(model)
    torch.jit.save(model, initial_path)

    settings = LoopSettings(
        root_path=root_path,
        initial_network=initial_path,
        generations=100,
        buffer_gen_count=5,
        selfplay_settings=selfplay_settings,
        train_settings=train_settings,
        train_weight_decay=1e-5,
        test_fraction=0.05,
    )

    run_loop(settings)
Example #2
0
    f.seek(0)
    f.truncate(0)
    for l in bl: f.write(l + "\n")
    f.close()
    lck.close()

    return bl

def run_rpm_builder(b):
    if os.fork() == 0:
        return
    else:
        rpm_builder.main_for(b)
        sys.exit(0)

def main():
    init_conf()
    for b in builders_order():
        run_rpm_builder(b)
        # give builder some time to aquire lock
        time.sleep(1)
    # wait for children to die out
    try:
        while 1: os.wait()
    except:
        pass

if __name__ == '__main__':
    loop.run_loop(main)
def main():
    lck = lock.lock("request_fetcher", non_block = True)
    if lck == None:
        sys.exit(1)
    init_conf()
    acl.try_reload()

    status.push("fetching requests")
    if has_new(config.control_url):
        q = fetch_queue(config.control_url)
        max_no = 0
        q_new = []
        for r in q:
            if r.no > max_no:
                max_no = r.no
            if r.no > last_count:
                q_new.append(r)
        for b in config.binary_builders:
            handle_reqs(b, q_new)
        f = open(path.last_req_no_file, "w")
        f.write("%d\n" % max_no)
        f.close()
    status.pop()
    lck.close()

if __name__ == '__main__':
    # http connection is established (and few bytes transferred through it)
    # each $secs seconds.
    loop.run_loop(main, secs = 10)
def main():
    lck = lock.lock("request_fetcher", non_block=True)
    if lck == None:
        sys.exit(1)
    init_conf()
    acl.try_reload()

    status.push("fetching requests")
    if has_new(config.control_url):
        q = fetch_queue(config.control_url)
        max_no = 0
        q_new = []
        for r in q:
            if r.no > max_no:
                max_no = r.no
            if r.no > last_count:
                q_new.append(r)
        for b in config.binary_builders:
            handle_reqs(b, q_new)
        f = open(path.last_req_no_file, "w")
        f.write("%d\n" % max_no)
        f.close()
    status.pop()
    lck.close()


if __name__ == '__main__':
    # http connection is established (and few bytes transferred through it)
    # each $secs seconds.
    loop.run_loop(main, secs=10)