Dragjon / Chess-Ai-Training

Chess ai training using tensorflow based on IAmEthanMai's code on github https://github.com/iAmEthanMai/chess-engine-model
MIT License
2 stars 0 forks source link

Got this tensorflow error. #3

Open victorvondoom25 opened 3 months ago

victorvondoom25 commented 3 months ago

image

Can you update this project.

victorvondoom25 commented 3 months ago

image

Can you update this project.

I think the estimator is now depricated.

Dragjon commented 3 months ago

Oh wow, I haven't worked on this for quite a while. Will update it as soon as possible.

victorvondoom25 commented 3 months ago

Oh wow, I haven't worked on this for quite a while. Will update it as soon as possible.

Thanks!

Dragjon commented 3 months ago

Yep the estimator is deprecated from tensorflow 2.16.1 onwards. You can temporarily uninstall and install the older version

pip uninstall tensorflow
pip install tensorflow==2.15.1

From This

victorvondoom25 commented 2 months ago

Yep the estimator is deprecated from tensorflow 2.16.1 onwards. You can temporarily uninstall and install the older version

pip uninstall tensorflow
pip install tensorflow==2.15.1

From This

Is there any way it can be used on lichess as a UCI engine?

Dragjon commented 2 months ago

You have to write your own uci parsing protocol, here is a simple example in python

def parse_parameters(line):
    DEFAULT_WTIME = float('inf')
    DEFAULT_BTIME = float('inf')
    parameters = line.split()[1:]
    wtime, btime = DEFAULT_WTIME, DEFAULT_BTIME

    for i in range(len(parameters)):
        if parameters[i] == "infinite":
            wtime = float('inf')
            btime = float('inf')
        elif parameters[i] == "wtime" and i + 1 < len(parameters):
            wtime = float(parameters[i + 1])
        elif parameters[i] == "btime" and i + 1 < len(parameters):
            btime = float(parameters[i + 1])
    return wtime, btime

def play_chess():
    global board, start_time
    remaining_time = 1000000

    while True:
        line = input()
        if line == "uci":
            print("id name My Engine Name")
            print("id author My Name")
            print("uciok")
        elif line == "isready":
            print("readyok")
        elif line.startswith("position startpos"):
            board = chess.Board()
            if "moves" in line:
                _, moves_part = line.split("moves")
                moves = moves_part.strip().split()
                for move in moves:
                    board.push_uci(move)
        elif line.startswith("position fen"):
            _, fen = line.split("fen ")
            fen = fen.split(" ")
            fen = fen[0] + " " + fen[1] + " " + fen[2] + " " + fen[3] + " " + fen[4] + " " + fen[5]
            board.set_fen(fen)
            if "moves" in line:
                _, moves_part = line.split("moves")
                moves = moves_part.strip().split()
                for move in moves:
                    board.push_uci(move)
        elif line.startswith("go"):
            wtime, btime = parse_parameters(line)
            remaining_time = wtime if board.turn == chess.WHITE else btime
            start_time = time.time()
            sb_max_time = remaining_time / sbtm
            hb_max_time = remaining_time / hbtm
            getbestmove()
        elif line == "quit":
            break