LeelaChessZero / lc0

The rewritten engine, originally for tensorflow. Now all other backends have been ported here.
GNU General Public License v3.0
2.38k stars 525 forks source link

WDL in python binding #1900

Closed SimonBenhamou closed 1 year ago

SimonBenhamou commented 1 year ago

Hello,

In the python binding, it seems like the engine's evaluate function can only output the Q score, but not the WDL head results. Here is my code:

from lczero.backends import Weights, Backend, GameState
w = Weights('../../maia_models/maia-1900.pb')
b = Backend(weights=w, backend='eigen')
board_input = GameState(fen='2R5/5kpp/4p3/p4p2/3B4/1K5N/4rNPP/8 b - - 0 29').as_input(b)
board_evaluation = b.evaluate(board_input)[0]

Is there any way to expose the WDL attributes to python?

SimonBenhamou commented 1 year ago

Found it, I missed the d method...

LilacPeregrine commented 5 months ago

Do you have the fixed code for including WDL? I'm looking to do something similar.

Edit: board_evaluation = b.evaluate(board_input)[0].d()