Skip to content

Running Leela Chess Zero in a Chess GUI

zz4032 edited this page Nov 30, 2021 · 10 revisions

Warning

This page was originally written for the lczero engine. The current engine is lc0. While most of the instructions still apply, there are some differences.
Several command line parameters have changed. Not everything has been corrected, so verify that the examples specified still work. \ In particular the -noponder and -uci options do not work, while lc0 accepts long options prefixed with -- and only short (single letter) options prefixed with -.

An updated guide is published in the blog

Introduction

Leela Chess Zero (LCZero) utilizes the UCI (Universal Chess Interface) protocol, and hence can be run in any Chess GUI that supports that protocol.

Windows users can download everything needed to run the engine from the releases page. The following versions are available

  • lc0-windows-cuda.zip for PCs with recent NVIDIA GPUs,
  • lc0-windows-opencl.zip for AMD and older NVIDIA GPUs,
  • lc0-windows-blas.zip for PCs without a dedicated GPU.

Linux and Mac users have to compile from source following the instructions in the project page.

Note: If a file path that’s being fed to the engine contains spaces, you have to quote it. Example:

"C:/Program Files (x86)/Chess/Engines/LCZero/networks/id132"

Setup guides for specific Chess GUI’s

Nibbler

Nibbler is a recent chess GUI especially built for and only LCZero.

You first need to download the release version for your distrubution (At the moment, only Windows and Linux are supported).

Then Nibbler will need two thing:

  • The LCZero chess engine. CUDA only works on NVIDIA GPUs. If you do not have one, you can try OpenCL which works on most GPUs but is slower. The BLAS version does not need a GPU but uses the CPU so it will be much more slower.
  • A neural network: they can be find here. The ’best ones’ can be find here.

Instruction for Windows:

  • Execute the nibbler.exe file.
  • On the top menu, click on `Engine` -> `Choose engine…` and select the lc0.exe file from LCZero.
  • On the top menu click on `Engine` -> `Choose weights file…` and select the network you downloaded.

Fritz

Note: Utilization of Leela-chess in Fritz requires v0.6 (or higher) of the engine. Previous versions don’t work in Fritz.

In order to run Leela Chess Zero in Fritz, create a ‘LCZero’ subdirectory in Fritz’s installation folder, and copy the aforementioned required files to that folder. Alternatively, you can copy the Leela Chess Zero training instance folder to the aforementioned folder, since it contains the required files mentioned above. The network file for Leela Chess Zero should also reside in the aforementioned directory, and be named ‘weights.txt’ (this is so auto-detection of that file works).

From version 0.7:

Once you have the required files in place, add the engine to Fritz:

  • In the Fritz start menu, click ‘Enter & Analyse’
  • Select the ‘Engine’ tab, click ‘Create UCI Engine’
  • In the ‘Set up UCI Engine’ dialog, select the ‘lczero.exe’ file located in the aforementioned folder via the respective file selection dialog

Name and Author should be filled in automatically, and no further configuration is required.

Version 0.6:

Fritz unfortunately doesn’t accept any command line parameters for external engines, so a little workaround is required to utilize the engine in this GUI. It is the utility ‘InBetween’ by Odd Gunnar Malin, which intercepts communication between the GUI and the engine, and allows on-the-fly modification of the transferred data. The utility can be downloaded here (scroll down). You use it as follows:

  • Extract the files ‘InBetween.exe’ and ‘InBetween.ini’ to the aforementioned ‘LCZero’ subdirectory
  • Edit ‘InBetween.ini’ and provide the following option in the [InBetween] section: CommandLine := lczero.exe –uci (optional: additional parameters according to the list above, for example –noponder; don’t forget to remove ; at the beginning of the line to activate the command)

Example:

CommandLine := lczero.exe --uci --noponder
  • Save & Close the file

Once you have the required files in place, add the engine to Fritz:

  • In the Fritz start menu, click ‘Enter & Analyse’
  • Select the ‘Engine’ tab, click ‘Create UCI Engine’
  • In the ‘Set up UCI Engine’ dialog, select the ‘InBetween.exe’ file located in the aforementioned folder via the respective file selection dialog

Name and Author should be filled in automatically, and no further configuration is required.

Note: For the purpose of creating this guide, v1.3 of the ‘InBetween’ utility has been used.

All versions:

To finalize and verify the process, click ‘Ok’, then click ‘Change Main Engine’ and select LCZero from the list. Now start a new game by selecting ‘Home’ > ‘New Game’, and make the first move. LCZero should begin to play once it is her turn to do so.

Arena

In order to run Leela Chess Zero in Arena, create a ‘LCZero’ subdirectory in Arena’s ‘Engines’ folder, and copy the aforementioned required files to that folder. Alternatively, you can copy the Leela Chess Zero training instance folder to the ‘Engines’ folder, since it contains the required files mentioned above.

Once you have the required files in place, add the engine to Arena:

  • In Arena, press <F11>
  • Select ‘Details’, click ‘Installation wizard’
  • Click ‘Forward >>’, and in the next dialog make sure Arena’s ‘Engines’ folder is selected
  • Click ‘Forward >>’ again, then select the lczero.exe you’ve installed earlier from the list
  • Click ‘Forward >>’ twice, then in the last dialog select ‘UCI’ and click ‘Forward >>’ one more time

The engine you just added should now be selected in ‘Details’. Now add the following configuration information:

  • Name: LCZero <version/build> <network id/name>
  • Author: Linscott, Huizinga, Olsen, Diamond et al.
  • Command Line Parameters: -w <file_path_to_network_file> (optional: additional parameters according to the list above, for example –noponder)
  • Country: Europe
  • Type: UCI
  • (Optional) Logo file: If you want the engine to use a logo file, you can download and use this one:

and in tab ‘Special:

  • Website of the author: http://lczero.org

To finalize and verify the process, click ‘Apply’, then click ‘Start this engine right now!’. LCZero should be started, and by pressing <F4> you can verify her output in the engine log.

To use multiple cores if you run the cpu/blas binary :

  • Press F11 to open the engine management window
  • Go to “UCI” tab
  • Uncheck “Common max CPU core settings”
  • Go to “details” tab, select the lc0 engine
  • in the “Command Line Parameters” textbox add “–threads=n” where n is the number of CPU worker threads to use. (see : Lc0-options for more information & options)

Cute Chess

In order to run Leela Chess Zero in the GUI version of Cute Chess, create a ‘LCZero’ subdirectory in Cute Chess’ engines folder, and copy the aforementioned required files to that folder. Alternatively, you can copy the Leela Chess Zero training instance folder to the engines folder, since it contains the required files mentioned above.

Once you have the required files in place, add the engine to Cute Chess:

  • In Cute Chess, select ‘Tools’ > ‘Settings’, then click the ‘Engines’ tab
  • Click the ‘+’ in the lower left corner of that tab to open the ‘Add engine’ dialog

Now add the following configuration information:

  • Name: LCZero <version/build> <network id/name>
  • Command: lczero.exe -w <file_path_to_network_file> (optional: additional parameters according to the list above, for example –noponder)
  • Working Directory: <file_path_to_LCZero_folder>
  • Protocol: uci

To finalize and verify the process, click ‘Ok’, close the ‘Settings’ dialog, then select ‘Game’ > ‘New…’, and assign the engine to either White or Black by selecting ‘CPU’ and choosing LCZero from the list of engines. Click ‘Ok’ to start the game. LCZero should be loaded and begin to play once it is her turn to do so.

Scid vs. PC

In order to run Leela Chess Zero in Scid vs. PC, create a ‘LCZero’ subdirectory in Scid vs. PC’s ‘bin\engines’ folder, and copy the aforementioned required files to that folder. Alternatively, you can copy the Leela Chess Zero training instance folder to the ‘bin\engines’ folder, since it contains the required files mentioned above.

Once you have the required files in place, add the engine to Scid vs. PC:

  • In Scid vs. PC, select ‘Tools’ > ‘Analysis Engines’ to open the ‘Analysis Engines’ dialog
  • Click ‘New’ to open the ‘Configure Engine’ dialog

Now add the following configuration information:

  • Name: LCZero <version/build> <network id/name>
  • Command: <file_path_to_LCZero_folder>/bin/engines/LCZero/lczero.exe
  • Directory: <file_path_to_LCZero_folder>
  • Parameters: -w <file_path_to_network_file> (optional: additional parameters according to the list above, for example –noponder)
  • Webpage: http://lczero.org
  • Protocol: UCI

To finalize and verify the process, click ‘Ok’, then click ‘Start’, and close the ‘Analysis Engines’ dialog. The engine should immediately start, and begin to analyze. To verify gameplay, select ‘Play’ > ‘Tournament’, and assign the engine to one of the two engine slots (assign a different one to the other slot), then click ‘Ok’ to start the tournament. Both engines should be loaded and begin to play.

Note: All file paths configured in Scid vs. PC require a slash (/) as file path separator, not a backslash (\).

Lucas Chess

In order to run Leela Chess Zero in Lucas Chess, create a ‘LCZero’ subdirectory in Lucas Chess’s ‘Engines\Windows’ folder, and copy the aforementioned required files to that folder. Alternatively, you can copy the Leela Chess Zero training instance folder to the ‘Engines\Windows’ folder, since it contains the required files mentioned above.

From version 0.7:* Warning

This page was originally written for the lczero engine. The current engine is lc0. While most of the instructions still apply, there are some differences.
Several command line parameters have changed. Not everything has been corrected, so verify that the examples specified still work. \ In particular the -noponder and -uci options do not work, while lc0 accepts long options prefixed with -- and only short (single letter) options prefixed with -.

An updated guide is published in the blog

Clone this wiki locally