https://github.com/patrickfrank1/lc0-docker
Containerize Leela Chess Zero (lc0) for use on CPU devices. Also provides a simple python middleware for analyzing queued positions. Tested on raspberry pi 4. Some containers also include stockfish 14.
https://github.com/patrickfrank1/lc0-docker
chess docker-image lc0 raspberry-pi stockfish
Last synced: 3 months ago
JSON representation
Containerize Leela Chess Zero (lc0) for use on CPU devices. Also provides a simple python middleware for analyzing queued positions. Tested on raspberry pi 4. Some containers also include stockfish 14.
- Host: GitHub
- URL: https://github.com/patrickfrank1/lc0-docker
- Owner: patrickfrank1
- License: gpl-3.0
- Created: 2021-08-10T17:37:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T20:59:12.000Z (over 4 years ago)
- Last Synced: 2025-02-08T20:12:44.628Z (12 months ago)
- Topics: chess, docker-image, lc0, raspberry-pi, stockfish
- Language: Shell
- Homepage:
- Size: 86.1 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lc0-docker
Run [Leela Chess Zero](https://github.com/LeelaChessZero/lc0) anywhere in a docker container on CPU
## Requirements
This repository requires a working docker installation on your host system. If you don't have docker installed, please follow the [official installation guide](https://docs.docker.com/engine/install/ubuntu/). Afterwards you can perform the following steps to get lc0 running.
## Build an image and run a container
First you need to clone the git repository:
```bash
git clone https://github.com/patrickfrank1/lc0-docker.git
```
Next you select a git branch, each branch lets you build a different image. The images are described in detail in the subsections below. To build the image and run a container, simply execute the ./build.sh script. Scripts to stop and remove the container are also available.
### lc0 base image
This image is implemented on the `master` branch. It installs lc0 and preconfigures it with the Leelenstein 15 network. Build the image and run the container with default settings:
``` bash
./build.sh
```
The engine should now be accessible via command line.

Communicate via [UCI Protocol](http://wbec-ridderkerk.nl/html/UCIProtocol.html), for example to analyse a position to depth 10 first set up the position, then strat the analysis.
```
position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR
go depth 10
```
The console output should look something like this:

Exit the engine by sending the `quit` command, then exit the container by sending the `exit` command. Logs are by default saved to `./settings/log.txt` in your local directory.
### lc0 and stockfish base image
This image is somewhat similar to the lc0 base image, with the exception that here two UCI compliant chess engines are available: lc0 and stockfish 14. To build the image check out the git branch `lc0-and-stockfish-command-line`.
``` bash
git checkout lc0-and-stockfish-command-line
```
After building the image with the build script
``` bash
./build.sh
```
the container provides the standard shell. To start lc0 execute the command
``` bash
lc0 --config=/lc0/settings/lc0.config
```
this will set the correct path to the configuration and network files. To analyze with stockfish execute the command
``` bash
stockfish_14_x64_popcnt
```
### lc0 analysis with fie input and output
This image implements a service that analyses a set of positions and prints the analysis results to file. The container runs silently in the background. Check out the git branch `lc0-file-io`
``` bash
git checkout lc0-file-io
```
and build the image
``` bash
./build.sh
```
now navigate to `./analysis/queue.txt` in your workspace and follow the instructions therein. For example the following input, which runs an analysis for exactly one position

results in the following output file (truncated)
