Example #1
0
    #     output_node_name="logit_layer/MatMul",
    #     max_batch_size=40000)

    # move_scoring_model_path = "/srv/tmp/move_scoring_1/pre_commit_test_1/1528363445"
    # save_model_as_graphdef_for_serving(
    #     model_path=move_scoring_model_path,
    #     output_model_path=move_scoring_model_path,
    #     output_filename="tensorrt_move_scoring_graph.pb",
    #     output_node_name="GatherNd_2",
    #     # trt_memory_fraction=.45,
    #     max_batch_size=40000)

    BOARD_EVAL_GRAPHDEF_FILENAME = "/srv/tmp/encoder_evaluation_helper/sf_data_attempts/sf_data_crazy_network_13/1529028437/tensorrt_eval_graph.pb"
    MOVE_SCORING_GRAPHDEF_FILENAME = "/srv/tmp/move_scoring_1/pre_commit_test_1/1528363445/tensorrt_move_scoring_graph.pb"

    BOARD_PREDICTOR, MOVE_PREDICTOR, PREDICTOR_CLOSER = get_inference_functions(
        BOARD_EVAL_GRAPHDEF_FILENAME, MOVE_SCORING_GRAPHDEF_FILENAME)

    first_move_scoring_testing_filename = "/srv/databases/chess_engine/one_rand_per_board_data/move_scoring_testing_set_1.npy"

    batch_first_engine = BatchFirstEngine(4, BOARD_PREDICTOR, MOVE_PREDICTOR,
                                          first_move_scoring_testing_filename)

    stockfish_engine = StockFishEngine(
        "stockfish-8-linux/Linux/stockfish_8_x64")

    random_engine = RandomEngine()

    for j in range(1):
        play_one_game(batch_first_engine, random_engine, True)

    PREDICTOR_CLOSER()
Example #2
0
        pgn_file_paths[:-1],
        to_collect_filters=[during_search_n_man_filter_creator(6)],
        data_writer=board_eval_data_writer_creator(
            file_ratios,
            for_deep_pink_loss_use,
            comparison_move_generator=standard_comparison_move_generator,
            print_frequency=10000),
        num_first_moves_to_skip=5,
        output_filenames=final_dataset_filenames)

    print("Time taken to create databases:", time.time() - start_time)

    BOARD_EVAL_GRAPHDEF_FILE = "/srv/tmp/encoder_evaluation/normal_next_try_4_regulated/1528279891/tensorrt_eval_graph.pb"
    TEMP_STR = "/srv/tmp/move_scoring_1/pre_commit_test_1/1528279921/tensorrt_move_scoring_graph.pb"

    BOARD_PREDICTOR, _, BOARD_PREDICTOR_CLOSER = get_inference_functions(
        BOARD_EVAL_GRAPHDEF_FILE, TEMP_STR)

    def cur_eval_fn(node_array):
        return BOARD_PREDICTOR(*struct_array_to_ann_inputs(
            create_struct_array_from_jitclasses(node_array))).squeeze(axis=1)

    def dummy_eval_fn(node_array):
        return np.zeros(len(node_array), dtype=np.float32)

    # board_eval_writer = board_eval_data_writer_creator(
    #         [1],
    #         [True],
    #         comparison_move_generator=standard_comparison_move_generator,
    #         print_frequency=100000)
    #
    #
            game_length_filter_creator(170),
            excessive_promotion_filter_creator(3)
        ],
        to_collect_filters=[during_search_n_man_filter_creator(3)],
        data_writer=board_eval_data_writer_creator(
            file_ratios,
            for_deep_pink_loss_use,
            comparison_move_generator=standard_comparison_move_generator,
            print_frequency=10000),
        num_first_moves_to_skip=4,
        output_filenames=temp_dataset_filenames)  #=#final_dataset_filenames)

    print("Time taken to create databases:", time.time() - start_time)

    BOARD_EVAL_GRAPHDEF_FILENAME = "/srv/tmp/encoder_evaluation_helper/sf_data_attempts/encoder_new_data_2.6/1529409998/tensorrt_eval_graph.pb"
    BOARD_PREDICTOR, _, PREDICTOR_CLOSER = get_inference_functions(
        BOARD_EVAL_GRAPHDEF_FILENAME, None, session_gpu_memory=.1)

    def cur_eval_fn(node_array):
        return BOARD_PREDICTOR(
            *struct_array_to_ann_inputs(node_array)).squeeze(axis=1)

    def dummy_eval_fn(node_array):
        return np.zeros(len(node_array), dtype=np.float32)

    # STOCKFISH_LOCATION = "/home/sam/PycharmProjects/ChessAI/stockfish-8-linux/Linux/stockfish_8_x64"
    #
    #
    # board_eval_writer = board_eval_data_writer_creator(
    #         [1],
    #         [True],
    #         comparison_move_generator=stockfish_move_generator_creator(STOCKFISH_LOCATION, 1, 1), #Using very little resources so that it won't find a better move than the GM had
Example #4
0
    OUTPUT_NODE_NAMES = ["%s/%s"%(prefix,name) for name, prefix in zip(OUTPUT_NODE_NAMES, PREFIXES)]
    TRT_OUTPUT_FILENAME = "COMBINED_TRT_TEST_314.pbtxt"
    # save_trt_graphdef(
    #     OUTPUT_MODEL_PATH + "/" +  REMAPPED_INPUT_NAME,
    #     OUTPUT_MODEL_PATH,
    #     TRT_OUTPUT_FILENAME,
    #     OUTPUT_NODE_NAMES,
    #     trt_memory_fraction=.65,
    #     max_batch_size=int(1.25*MAX_SEARCH_BATCH_SIZE),
    #     write_as_text=True)


    MOVE_SCORING_TEST_FILENAME = "/srv/databases/lichess/lichess_db_standard_rated_2018-07_first_100k_games.npy"
    ZERO_VALUE_BOARD_FILENAME = "/srv/databases/has_zero_valued_board/combined_zero_boards.npy"

    BOARD_PREDICTOR, MOVE_PREDICTOR, PREDICTOR_CLOSER = get_inference_functions(OUTPUT_MODEL_PATH + "/" + TRT_OUTPUT_FILENAME, session_gpu_memory=.2)

    search_depth = 4
    batch_first_engine = BatchFirstEngine(
        search_depth,
        BOARD_PREDICTOR,
        MOVE_PREDICTOR,
        bin_database_file="deeper_network_1.npy",
        max_batch_size=MAX_SEARCH_BATCH_SIZE,
        saved_zero_shift_file="no_dilations_inception_1.npy",
    )



    ethereal_engine = UCIEngine("Ethereal-11.00/src/Ethereal", move_time=10, num_threads=1, print_search_info=True)