Coder Social home page Coder Social logo

leela-zero / leela-zero Goto Github PK

View Code? Open in Web Editor NEW
5.3K 290.0 1.0K 3.71 MB

Go engine with no human-provided knowledge, modeled after the AlphaGo Zero paper.

License: GNU General Public License v3.0

C++ 80.64% Makefile 0.16% C 5.77% QMake 0.08% Python 8.36% CMake 4.84% Batchfile 0.15%

leela-zero's Introduction

Linux Build Status Windows Build Status

What

A Go program with no human provided knowledge. Using MCTS (but without Monte Carlo playouts) and a deep residual convolutional neural network stack.

This is a fairly faithful reimplementation of the system described in the Alpha Go Zero paper "Mastering the Game of Go without Human Knowledge". For all intents and purposes, it is an open source AlphaGo Zero.

Wait, what?

If you are wondering what the catch is: you still need the network weights. No network weights are in this repository. If you manage to obtain the AlphaGo Zero weights, this program will be about as strong, provided you also obtain a few Tensor Processing Units. Lacking those TPUs, I'd recommend a top of the line GPU - it's not exactly the same, but the result would still be an engine that is far stronger than the top humans.

Gimme the weights

Recomputing the AlphaGo Zero weights will take about 1700 years on commodity hardware.

One reason for publishing this program is that we are running a public, distributed effort to repeat the work. Working together, and especially when starting on a smaller scale, it will take less than 1700 years to get a good network (which you can feed into this program, suddenly making it strong).

I want to help

Using your own hardware

You need a PC with a GPU, i.e. a discrete graphics card made by NVIDIA or AMD, preferably not too old, and with the most recent drivers installed.

It is possible to run the program without a GPU, but performance will be much lower. If your CPU is not very recent (Haswell or newer, Ryzen or newer), performance will be outright bad, and it's probably of no use trying to join the distributed effort. But you can still play, especially if you are patient.

Windows

Head to the Github releases page at https://github.com/leela-zero/leela-zero/releases, download the latest release, unzip, and launch autogtp.exe. It will connect to the server automatically and do its work in the background, uploading results after each game. You can just close the autogtp window to stop it.

macOS and Linux

Follow the instructions below to compile the leelaz and autogtp binaries in the build subdirectory. Then run autogtp as explained in the contributing instructions below. Contributing will start when you run autogtp.

Using a Cloud provider

Many cloud companies offer free trials (or paid solutions, not discussed here) that are usable for helping the leela-zero project.

There are community maintained instructions available here:

I just want to play with Leela Zero right now

Download the best known network weights file from here, or, if you prefer a more human style, a (weaker) network trained from human games here.

If you are on Windows, download an official release from here and head to the Usage section of this README.

If you are on macOS, Leela Zero is available through Homebrew, the de facto standard package manager. You can install it with:

brew install leela-zero

If you are on Unix, you have to compile the program yourself. Follow the compilation instructions below and then read the Usage section.

Compiling AutoGTP and/or Leela Zero

Requirements

  • GCC, Clang or MSVC, any C++14 compiler
  • Boost 1.58.x or later, headers and program_options, filesystem and system libraries (libboost-dev, libboost-program-options-dev and libboost-filesystem-dev on Debian/Ubuntu)
  • zlib library (zlib1g & zlib1g-dev on Debian/Ubuntu)
  • Standard OpenCL C headers (opencl-headers on Debian/Ubuntu, or at https://github.com/KhronosGroup/OpenCL-Headers/tree/master/CL)
  • OpenCL ICD loader (ocl-icd-libopencl1 on Debian/Ubuntu, or reference implementation at https://github.com/KhronosGroup/OpenCL-ICD-Loader)
  • An OpenCL capable device, preferably a very, very fast GPU, with recent drivers is strongly recommended (OpenCL 1.1 support is enough). Don't forget to install the OpenCL driver if this part is packaged seperately by the Linux distribution (e.g. nvidia-opencl-icd). If you do not have a GPU, add the define "USE_CPU_ONLY", for example by adding -DUSE_CPU_ONLY=1 to the cmake command line.
  • Optional: BLAS Library: OpenBLAS (libopenblas-dev) or Intel MKL
  • The program has been tested on Windows, Linux and macOS.

Example of compiling - Ubuntu & similar

# Test for OpenCL support & compatibility
sudo apt install clinfo && clinfo

# Clone github repo
git clone https://github.com/leela-zero/leela-zero
cd leela-zero
git submodule update --init --recursive

# Install build depedencies
sudo apt install cmake g++ libboost-dev libboost-program-options-dev libboost-filesystem-dev opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev zlib1g-dev

# Use a stand alone build directory to keep source dir clean
mkdir build && cd build

# Compile leelaz and autogtp in build subdirectory with cmake
cmake ..
cmake --build .

# Optional: test if your build works correctly
./tests

Example of compiling - macOS

# Clone github repo
git clone https://github.com/leela-zero/leela-zero
cd leela-zero
git submodule update --init --recursive

# Install build depedencies
brew install boost cmake zlib

# Use a stand alone build directory to keep source dir clean
mkdir build && cd build

# Compile leelaz and autogtp in build subdirectory with cmake
cmake ..
cmake --build .

# Optional: test if your build works correctly
./tests

Example of compiling - Windows

# Clone github repo
git clone https://github.com/leela-zero/leela-zero
cd leela-zero
git submodule update --init --recursive

cd msvc
Double-click the leela-zero2015.sln or leela-zero2017.sln corresponding
to the Visual Studio version you have.
# Build from Visual Studio 2015 or 2017

Contributing

For Windows, you can use a release package, see "I want to help".

Unix and macOS, after finishing the compile and while in the build directory:

# Copy leelaz binary to autogtp subdirectory
cp leelaz autogtp

# Run AutoGTP to start contributing
./autogtp/autogtp

Usage for playing or analyzing games

Leela Zero is not meant to be used directly. You need a graphical interface for it, which will interface with Leela Zero through the GTP protocol.

The engine supports the GTP protocol, version 2.

Lizzie is a client specifically for Leela Zero which shows live search probilities, a win rate graph, and has an automatic game analysis mode. Has binaries for Windows, Mac, and Linux.

Sabaki is a very nice looking GUI with GTP 2 capability.

LeelaSabaki is modified to show variations and winning statistics in the game tree, as well as a heatmap on the game board.

GoReviewPartner is a tool for automated review and analysis of games using bots (saved as .rsgf files), Leela Zero is supported.

A lot of go software can interface to an engine via GTP, so look around.

Add the --gtp commandline option on the engine command line to enable Leela Zero's GTP support. You will need a weights file, specify that with the -w option.

All required commands are supported, as well as the tournament subset, and "loadsgf". The full set can be seen with "list_commands". The time control can be specified over GTP via the time_settings command. The kgs-time_settings extension is also supported. These have to be supplied by the GTP 2 interface, not via the command line!

Weights format

The weights file is a text file with each line containing a row of coefficients. The layout of the network is as in the AlphaGo Zero paper, but any number of residual blocks is allowed, and any number of outputs (filters) per layer, as long as the latter is the same for all layers. The program will autodetect the amounts on startup. The first line contains a version number.

  • Convolutional layers have 2 weight rows:
    1. convolution weights
    2. channel biases
  • Batchnorm layers have 2 weight rows:
    1. batchnorm means
    2. batchnorm variances
  • Innerproduct (fully connected) layers have 2 weight rows:
    1. layer weights
    2. output biases

The convolution weights are in [output, input, filter_size, filter_size] order, the fully connected layer weights are in [output, input] order. The residual tower is first, followed by the policy head, and then the value head. All convolution filters are 3x3 except for the ones at the start of the policy and value head, which are 1x1 (as in the paper).

There are 18 inputs to the first layer, instead of 17 as in the paper. The original AlphaGo Zero design has a slight imbalance in that it is easier for the black player to see the board edge (due to how padding works in neural networks). This has been fixed in Leela Zero. The inputs are:

1) Side to move stones at time T=0
2) Side to move stones at time T=-1  (0 if T=0)
...
8) Side to move stones at time T=-7  (0 if T<=6)
9) Other side stones at time T=0
10) Other side stones at time T=-1   (0 if T=0)
...
16) Other side stones at time T=-7   (0 if T<=6)
17) All 1 if black is to move, 0 otherwise
18) All 1 if white is to move, 0 otherwise

Each of these forms a 19 x 19 bit plane.

In the training/caffe directory there is a zero.prototxt file which contains a description of the full 40 residual block design, in (NVIDIA)-Caffe protobuff format. It can be used to set up nv-caffe for training a suitable network. The zero_mini.prototxt file describes a smaller 12 residual block case. The training/tf directory contains the network construction in TensorFlow format, in the tfprocess.py file.

Expert note: the channel biases seem redundant in the network topology because they are followed by a batchnorm layer, which is supposed to normalize the mean. In reality, they encode "beta" parameters from a center/scale operation in the batchnorm layer, corrected for the effect of the batchnorm mean/variance adjustment. At inference time, Leela Zero will fuse the channel bias into the batchnorm mean, thereby offsetting it and performing the center operation. This roundabout construction exists solely for backwards compatibility. If this paragraph does not make any sense to you, ignore its existence and just add the channel bias layer as you normally would, output will be correct.

Training

Getting the data

At the end of the game, you can send Leela Zero a "dump_training" command, followed by the winner of the game (either "white" or "black") and a filename, e.g:

dump_training white train.txt

This will save (append) the training data to disk, in the format described below, and compressed with gzip.

Training data is reset on a new game.

Supervised learning

Leela can convert a database of concatenated SGF games into a datafile suitable for learning:

dump_supervised sgffile.sgf train.txt

This will cause a sequence of gzip compressed files to be generated, starting with the name train.txt and containing training data generated from the specified SGF, suitable for use in a Deep Learning framework.

Training data format

The training data consists of files with the following data, all in text format:

  • 16 lines of hexadecimal strings, each 361 bits longs, corresponding to the first 16 input planes from the previous section
  • 1 line with 1 number indicating who is to move, 0=black, 1=white, from which the last 2 input planes can be reconstructed
  • 1 line with 362 (19x19 + 1) floating point numbers, indicating the search probabilities (visit counts) at the end of the search for the move in question. The last number is the probability of passing.
  • 1 line with either 1 or -1, corresponding to the outcome of the game for the player to move

Running the training

For training a new network, you can use an existing framework (Caffe, TensorFlow, PyTorch, Theano), with a set of training data as described above. You still need to contruct a model description (2 examples are provided for Caffe), parse the input file format, and outputs weights in the proper format.

There is a complete implementation for TensorFlow in the training/tf directory.

Supervised learning with TensorFlow

This requires a working installation of TensorFlow 1.4 or later:

src/leelaz -w weights.txt
dump_supervised bigsgf.sgf train.out
exit
training/tf/parse.py 6 128 train.out

This will run and regularly dump Leela Zero weight files (of networks with 6 blocks and 128 filters) to disk, as well as snapshots of the learning state numbered by the batch number. If interrupted, training can be resumed with:

training/tf/parse.py 6 128 train.out leelaz-model-batchnumber

Todo

  • Further optimize Winograd transformations.
  • Improve GPU batching in the search.
  • Root filtering for handicap play.
  • More backends:
  • MKL-DNN based backend.
  • CUDA specific version using cuDNN or cuBLAS.
  • AMD specific version using MIOpen/ROCm.

Related links

License

The code is released under the GPLv3 or later, except for ThreadPool.h, cl2.hpp, half.hpp and the eigen and clblast_level3 subdirs, which have specific licenses (compatible with GPLv3) mentioned in those files.

Additional permission under GNU GPL version 3 section 7

If you modify this Program, or any covered work, by linking or combining it with NVIDIA Corporation's libraries from the NVIDIA CUDA Toolkit and/or the NVIDIA CUDA Deep Neural Network library and/or the NVIDIA TensorRT inference library (or a modified version of those libraries), containing parts covered by the terms of the respective license agreement, the licensors of this Program grant you additional permission to convey the resulting work.

leela-zero's People

Contributors

akdtg avatar alreadydone avatar apetresc avatar armavica avatar barrybecker4 avatar bittsitt avatar chinchangyang avatar dependabot[bot] avatar earthengine avatar gcp avatar godmoves avatar hersmunch avatar ibmibmibm avatar ihavnoid avatar infinity0 avatar killerducky avatar kuba97531 avatar marcocalignano avatar mkolman avatar nazgand avatar nerai avatar roy7 avatar sethtroisi avatar tfifie avatar thynson avatar ttl avatar tux3 avatar ywrt avatar zediir avatar zhanzhenzhen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leela-zero's Issues

Still an issue with pass code?

See move 612, why does white not pass here? Black has passed so passing for White should return 100% win for White? http://eidogo.com/#ADkRWiyp:0,611
This is with autogtp, Leela Zero 0.4,
weights filename: e6779c9becc10a7e147d3cb9c5177a45d3659f95856cd7199d98d0f9ecaf156e

I loaded the game into sabaki and asked Leela to play that move again, it passed. But perhaps sabaki is not giving Leela the correct order of moves information. To setup the position it did many play Bs, followed by many play Ws.

(there were many play B commands before this, and then many play W commands)
Leela-zero-ep1> play W T3
= 
● Leela-zero-ep1> play W T2
= 
● Leela-zero-ep1> play W T1
= 
● Leela-zero-ep1> genmove W
= pass
Thinking at most 50.0 seconds...
NN eval=0.000101
pass ->   11876 (V:  0.06%) (N: 31.4%) PV: pass S4 pass pass 
6957 visits, 98112 nodes, 1001 playouts, 685 n/s

Engine doesn't respect time_settings parameter

I've run leela-zero-0.1 version with next parameters:
--gtp --threads 4 time_settings 0 20 1 -w C:\Bots\leela-zero-0.1-win32\weights.txt --noponder
As I understand time_settings 0 20 1 means 1 bayomi, 20 seconds, 0 main time.
But engine always think 'Thinking at most 50.0 seconds...' as highlighted on screenshot.

Also behavior of --threads with 1, 2, 3, 4 value (my processor is 4 cores) is kinda strange and different than any other engine. I understand that it shouldn't behave the same way, but wondering why it happens.

  • can't see direct relations between number of cores specified and core-load. for example threads 1 and threads 4 - difference in CPU load may be 10-20%
  • this is the only engine which doesn't load CPU. The reason is that engine doesn't use Monte Carlo playouts?
  • this is the only engine which use GPU load at 99% - neither usual leela neither other bots load GPU more than 80%
  • almost no memory used (neither DRAM neither GPU)

This things are not very clear, why so different from other engines :)

691 26-oct-17 10 54

Net probability is not taken into account when choose move

May be it called not net probabiliry, but seems it's not used properly?
A19 -> 3516 (V: 56.39%) (N: 0.0%)
For move V: 56.39% is highest but N is zero, but move still was played.
Other moves with high N is reasonable but choosen - is not.
P.S. I remember that this is only draft weigth and read 'I just want to play right now' section, but isn't it here an issue with choosing move mechanism when the net generate correct data?

692 26-oct-17 11 14

Two questions about auto-play games

Dear Sir,
I have two questions about Leela-Zero:

  1. I ran the autogtp.exe files several times and generated several games (in sgf format), but how do I send these sgf files back to you or to some sort of servers?

  2. I need to click autogtp.exe icon again and again if I want to generate a few games. Is there a command that I can tell leela-zero to run a few hundred games so that I don't need to click the autogtp.exe icon a few hundred times?

Is 1000 playouts enough to self-train?

I see you the number of playouts per move in Leela zero's self training is 1000 down from the 1600 described in the paper. Are 1000 playouts enough to get meaningful data to make the network progress? If it is, it'd be a good way to speed up the game generation.

Cannot compile autogtp -- cannot find QT headers

I'm running Ubuntu 16.04. When running qmake, then followed by make, I get the following error:
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -o main.o main.cpp main.cpp:28:30: fatal error: QRegularExpression: No such file or directory compilation terminated. Makefile:205: recipe for target 'main.o' failed make: *** [main.o] Error 1

When running qmake --version or qmake-qt4 --version, in both cases I get:
QMake version 2.01a Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu

However, the QRegularExpression file is only installed for QT5, seemingly?
locate QRegularExpression /usr/include/x86_64-linux-gnu/qt5/QtCore/QRegularExpression /usr/include/x86_64-linux-gnu/qt5/QtCore/QRegularExpressionMatch /usr/include/x86_64-linux-gnu/qt5/QtCore/QRegularExpressionMatchIterator /usr/include/x86_64-linux-gnu/qt5/QtGui/QRegularExpressionValidator

I tried installing missing QT4 libraries (sudo apt install libqt4*dev), but that didn't help. Any ideas how to fix? Any further diagnostics I can provide?

Thank you for making this tool!

leelazero how to set the time?

I use sabaki to load leelazero, it always thinking at most 50.0 seconds, how to be free to set the time for each step?

The reason of the Zero' strength

Since you have replicated the paper, do you believe whether the strength of Go Zero is due to the Algorithm or the computer power that google use? I mean do they invented any new Algorithms?

Different ELO level

Hey,
this is really great, and as soon as there is a distributable I will donate some time on my machine.

Do you consider to store the weights for different ELO level on you server? This way, we wouldn't just have an amazing AI to work with, but could kinda generate a teaching tool. Having a player slightly better then you, might help you improve faster than playing against SUPER-OVERPOWERED-AI :)

Running on Mac with Sabaki

This issue is meant to share the experience to run leela-zero on Mac and I plan to add corresponding instructions like #7 .

I was building leela-zero on my MacBook Pro (Retina, 13-inch, Mid 2014) with OS X El Capitan 10.11.6, my steps are as follows:

# Install blas
brew tap homebrew/science
brew install openblas



# In src:

#Add the following in Makefile
# CXXFLAGS += -I/usr/local/opt/openblas/include
# LDFLAGS += -L/usr/local/opt/openblas/lib

# Comment the following in Makefile
# DYNAMIC_LIBS += -lOpenCL

# Uncomment the following in Makefile
# for MacOS
# LIBS += -framework Accelerate
# LIBS += -framework OpenCL
# for MacOS
# CXXFLAGS += -I/System/Library/Frameworks/Accelerate.framework/Versions/Current/Headers

# Download https://github.com/KhronosGroup/OpenCL-CLHPP/blob/master/input_cl2.hpp into src/CL as cl2.hpp
# input_cl2.hpp seems to be working like input_cl.hpp
 
# OpenCL ICD loader seems to be unnecessary on Mac.

make
chmod a+x leelaz

# Downloaded https://sjeng.org/zero/best.txt.zip and unzip into src/data/

# Test mannually first
./leelaz --gtp -w ./data/weights.txt
Using 1 thread(s).
Initializing OpenCL
Detected 1 OpenCL platforms
Platform version: OpenCL 1.2 (Jun 30 2016 20:18:53)
Platform profile: FULL_PROFILE
Platform name:    Apple
Platform vendor:  Apple
Device ID:     0
Device name:   Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
Device type:   CPU
Device vendor: Intel
Device driver: 1.1
Device speed:  2600 MHz
Device cores:  4 CU
Device score:  512
Device ID:     1
Device name:   Iris
Device type:   GPU
Device vendor: Intel
Device driver: 1.2(Jun 30 2016 20:43:33)
Device speed:  1100 MHz
Device cores:  40 CU
Device score:  612
Selected platform: Apple
Selected device: Iris
with OpenCL 1.2 capability
Wavefront/Warp size: 16
Max workgroup size: 512
Max workgroup dimensions: 512 512 512
Detecting residual layers...256 channels...12 layers
Transferring weights to GPU...done

genmove B
Thinking at most 50.0 seconds...
NN eval=0.317682
Playouts: 8, Win: 31.99%, PV: F16 O16
Playouts: 18, Win: 31.95%, PV: F17 D14
Playouts: 28, Win: 31.94%, PV: J16 F16
Playouts: 38, Win: 31.94%, PV: J16 F16
Playouts: 48, Win: 31.94%, PV: J16 F16
Playouts: 58, Win: 31.94%, PV: J16 F16
Playouts: 68, Win: 31.93%, PV: J16 F16
Playouts: 78, Win: 31.93%, PV: J16 F16
Playouts: 88, Win: 31.94%, PV: J16 F16
Playouts: 97, Win: 31.94%, PV: O16 F4 O4
Playouts: 107, Win: 31.94%, PV: Q15 F4 Q10
Playouts: 117, Win: 31.94%, PV: F16 O16 F4
Playouts: 126, Win: 31.94%, PV: F16 O16 F4
Playouts: 135, Win: 31.94%, PV: F16 O16 F4
Playouts: 144, Win: 31.93%, PV: F16 O16 F4
Playouts: 153, Win: 31.93%, PV: F16 O16 F4
Playouts: 162, Win: 31.93%, PV: F16 O16 F4
Playouts: 171, Win: 31.93%, PV: F16 O16 F4

 F16 ->       2 (V: 50.00%) (N:  2.2%) PV: F16 O16 F4
 K16 ->       2 (V: 49.90%) (N:  2.2%) PV: K16 F4 O4
 Q15 ->       2 (V: 49.84%) (N:  2.2%) PV: Q15 F4 Q10
 R10 ->       2 (V: 49.82%) (N:  1.8%) PV: R10 F16 K16
 O16 ->       2 (V: 49.78%) (N:  2.4%) PV: O16 F4 O4
 J16 ->       1 (V: 68.42%) (N:  1.0%) PV: J16 F16
 E11 ->       1 (V: 68.34%) (N:  0.2%) PV: E11 D14
  D9 ->       1 (V: 68.32%) (N:  0.3%) PV: D9 D14
  Q6 ->       1 (V: 68.31%) (N:  0.2%) PV: Q6 Q14
  D6 ->       1 (V: 68.31%) (N:  0.2%) PV: D6 D14
 M16 ->       1 (V: 68.30%) (N:  0.7%) PV: M16 F16
 O11 ->       1 (V: 68.28%) (N:  0.6%) PV: O11 P16
  C8 ->       1 (V: 68.27%) (N:  0.2%) PV: C8 D6
  P9 ->       1 (V: 68.26%) (N:  0.2%) PV: P9 Q14
 P11 ->       1 (V: 68.26%) (N:  0.5%) PV: P11 Q6
 L15 ->       1 (V: 68.26%) (N:  0.5%) PV: L15 F16
 M18 ->       1 (V: 68.25%) (N:  0.3%) PV: M18 D14
 S12 ->       1 (V: 68.25%) (N:  0.3%) PV: S12 O4
 R16 ->       1 (V: 68.25%) (N:  0.5%) PV: R16 Q6
 F15 ->       1 (V: 68.24%) (N:  0.3%) PV: F15 D14
 C12 ->       1 (V: 68.23%) (N:  0.5%) PV: C12 D6
  R9 ->       1 (V: 68.22%) (N:  0.2%) PV: R9 Q14
 J17 ->       1 (V: 68.22%) (N:  0.4%) PV: J17 O16
 H17 ->       1 (V: 68.22%) (N:  0.5%) PV: H17 Q14
 R13 ->       1 (V: 68.21%) (N:  0.2%) PV: R13 Q6
 C10 ->       1 (V: 68.21%) (N:  0.2%) PV: C10 F4
 N16 ->       1 (V: 68.20%) (N:  0.8%) PV: N16 Q14
  P7 ->       1 (V: 68.19%) (N:  0.2%) PV: P7 F4
 P13 ->       1 (V: 68.19%) (N:  0.3%) PV: P13 F16
 C17 ->       1 (V: 68.18%) (N:  0.4%) PV: C17 F16
 R17 ->       1 (V: 68.18%) (N:  0.4%) PV: R17 O16
 E13 ->       1 (V: 68.18%) (N:  0.3%) PV: E13 D14
 F17 ->       1 (V: 68.18%) (N:  1.1%) PV: F17 D14
 O13 ->       1 (V: 68.17%) (N:  0.2%) PV: O13 Q14
 H11 ->       1 (V: 68.17%) (N:  0.3%) PV: H11 O4
 Q14 ->       1 (V: 68.17%) (N:  0.9%) PV: Q14 Q6
 P17 ->       1 (V: 68.16%) (N:  1.0%) PV: P17 Q14
 G17 ->       1 (V: 68.16%) (N:  0.7%) PV: G17 Q14
 Q17 ->       1 (V: 68.15%) (N:  0.4%) PV: Q17 O4
 H13 ->       1 (V: 68.15%) (N:  0.2%) PV: H13 F16
 G12 ->       1 (V: 68.15%) (N:  0.3%) PV: G12 D14
 S16 ->       1 (V: 68.15%) (N:  0.4%) PV: S16 O16
 G15 ->       1 (V: 68.15%) (N:  1.3%) PV: G15 Q14
 C14 ->       1 (V: 68.13%) (N:  0.3%) PV: C14 F4
 O17 ->       1 (V: 68.13%) (N:  1.4%) PV: O17 D14
 D11 ->       1 (V: 68.13%) (N:  0.4%) PV: D11 F4
 Q11 ->       1 (V: 68.13%) (N:  1.1%) PV: Q11 O4
 R14 ->       1 (V: 68.13%) (N:  0.3%) PV: R14 Q6
 C11 ->       1 (V: 68.13%) (N:  0.5%) PV: C11 Q14
 R18 ->       1 (V: 68.12%) (N:  0.2%) PV: R18 Q14
 Q16 ->       1 (V: 68.12%) (N:  1.3%) PV: Q16 Q6
  R8 ->       1 (V: 68.12%) (N:  0.5%) PV: R8 D6
  S8 ->       1 (V: 68.12%) (N:  0.2%) PV: S8 Q6
 D15 ->       1 (V: 68.11%) (N:  0.6%) PV: D15 D6
 D17 ->       1 (V: 68.11%) (N:  0.2%) PV: D17 E4
 C16 ->       1 (V: 68.11%) (N:  0.5%) PV: C16 Q15
 E15 ->       1 (V: 68.11%) (N:  1.1%) PV: E15 D6
  G8 ->       1 (V: 68.11%) (N:  0.2%) PV: G8 D14
 E14 ->       1 (V: 68.11%) (N:  0.4%) PV: E14 D6
 O15 ->       1 (V: 68.11%) (N:  1.2%) PV: O15 F16
  L7 ->       1 (V: 68.10%) (N:  0.2%) PV: L7 D14
 P18 ->       1 (V: 68.10%) (N:  0.5%) PV: P18 Q14
  S7 ->       1 (V: 68.10%) (N:  0.2%) PV: S7 O4
 F18 ->       1 (V: 68.10%) (N:  0.4%) PV: F18 D14
 L12 ->       1 (V: 68.10%) (N:  0.5%) PV: L12 D14
 L18 ->       1 (V: 68.10%) (N:  0.3%) PV: L18 O4
 S11 ->       1 (V: 68.10%) (N:  0.5%) PV: S11 D14
  J3 ->       1 (V: 68.09%) (N:  0.2%) PV: J3 D6
 L19 ->       1 (V: 68.09%) (N:  0.2%) PV: L19 O16
  H8 ->       1 (V: 68.08%) (N:  0.3%) PV: H8 F16
 H12 ->       1 (V: 68.08%) (N:  0.3%) PV: H12 F4
 M12 ->       1 (V: 68.08%) (N:  0.6%) PV: M12 D14
 B16 ->       1 (V: 68.08%) (N:  0.4%) PV: B16 D14
  M6 ->       1 (V: 68.07%) (N:  0.2%) PV: M6 F16
 O12 ->       1 (V: 68.07%) (N:  0.4%) PV: O12 D6
  R5 ->       1 (V: 68.07%) (N:  0.3%) PV: R5 Q14
 C15 ->       1 (V: 68.07%) (N:  0.5%) PV: C15 D6
 R15 ->       1 (V: 68.07%) (N:  1.3%) PV: R15 Q6
 K15 ->       1 (V: 68.07%) (N:  1.3%) PV: K15 D14
 F19 ->       1 (V: 68.07%) (N:  0.2%) PV: F19 F16
 D12 ->       1 (V: 68.07%) (N:  0.2%) PV: D12 O4
 Q12 ->       1 (V: 68.07%) (N:  0.7%) PV: Q12 F4
  F8 ->       1 (V: 68.07%) (N:  0.2%) PV: F8 F16
 F12 ->       1 (V: 68.07%) (N:  0.3%) PV: F12 F4
 G18 ->       1 (V: 68.07%) (N:  0.3%) PV: G18 F16
  H7 ->       1 (V: 68.06%) (N:  0.2%) PV: H7 Q6
 S14 ->       1 (V: 68.06%) (N:  0.2%) PV: S14 Q14
  M8 ->       1 (V: 68.06%) (N:  0.2%) PV: M8 Q14
 M11 ->       1 (V: 68.05%) (N:  1.1%) PV: M11 F16
  S6 ->       1 (V: 68.05%) (N:  0.2%) PV: S6 D14
 O18 ->       1 (V: 68.05%) (N:  0.6%) PV: O18 F4
 O14 ->       1 (V: 68.05%) (N:  0.2%) PV: O14 F16
 K13 ->       1 (V: 68.04%) (N:  0.2%) PV: K13 Q6
 Q19 ->       1 (V: 68.04%) (N:  0.4%) PV: Q19 Q10
  R7 ->       1 (V: 68.03%) (N:  0.3%) PV: R7 D6
  N7 ->       1 (V: 68.03%) (N:  0.2%) PV: N7 F4
 P12 ->       1 (V: 68.03%) (N:  0.4%) PV: P12 F4
 H15 ->       1 (V: 68.03%) (N:  0.6%) PV: H15 Q6
 E12 ->       1 (V: 68.03%) (N:  0.9%) PV: E12 O4
 D13 ->       1 (V: 68.03%) (N:  0.2%) PV: D13 O4
 E17 ->       1 (V: 68.02%) (N:  0.7%) PV: E17 O4
 S18 ->       1 (V: 68.02%) (N:  0.2%) PV: S18 Q10
 K11 ->       1 (V: 68.01%) (N:  0.6%) PV: K11 K4
  K8 ->       1 (V: 68.01%) (N:  0.4%) PV: K8 D6
 D18 ->       1 (V: 68.01%) (N:  0.4%) PV: D18 O4
 J12 ->       1 (V: 68.01%) (N:  0.2%) PV: J12 O16
 M17 ->       1 (V: 68.00%) (N:  0.7%) PV: M17 D6
 J13 ->       1 (V: 68.00%) (N:  0.2%) PV: J13 D6
  J7 ->       1 (V: 68.00%) (N:  0.2%) PV: J7 D14
 M14 ->       1 (V: 68.00%) (N:  0.3%) PV: M14 Q6
 O10 ->       1 (V: 68.00%) (N:  0.2%) PV: O10 O4
 N18 ->       1 (V: 68.00%) (N:  0.3%) PV: N18 O4
 H14 ->       1 (V: 68.00%) (N:  0.4%) PV: H14 F4
 S15 ->       1 (V: 68.00%) (N:  0.6%) PV: S15 Q6
 E16 ->       1 (V: 67.99%) (N:  0.7%) PV: E16 F4
 R11 ->       1 (V: 67.99%) (N:  0.7%) PV: R11 F4
 C18 ->       1 (V: 67.99%) (N:  0.5%) PV: C18 K16
  P8 ->       1 (V: 67.99%) (N:  0.2%) PV: P8 D6
 M15 ->       1 (V: 67.99%) (N:  1.0%) PV: M15 O4
  O7 ->       1 (V: 67.99%) (N:  0.3%) PV: O7 D14
  D7 ->       1 (V: 67.99%) (N:  0.2%) PV: D7 O4
 Q13 ->       1 (V: 67.99%) (N:  0.5%) PV: Q13 F16
  Q9 ->       1 (V: 67.99%) (N:  0.2%) PV: Q9 F4
 L16 ->       1 (V: 67.99%) (N:  1.1%) PV: L16 Q6
 N12 ->       1 (V: 67.99%) (N:  0.5%) PV: N12 F16
  Q7 ->       1 (V: 67.98%) (N:  0.3%) PV: Q7 D14
 L11 ->       1 (V: 67.98%) (N:  0.4%) PV: L11 F16
 J11 ->       1 (V: 67.98%) (N:  0.6%) PV: J11 D6
  S4 ->       1 (V: 67.98%) (N:  0.3%) PV: S4 Q10
 Q18 ->       1 (V: 67.98%) (N:  0.3%) PV: Q18 K16
 L13 ->       1 (V: 67.98%) (N:  0.4%) PV: L13 O4
 N11 ->       1 (V: 67.98%) (N:  0.5%) PV: N11 D14
 P15 ->       1 (V: 67.98%) (N:  1.4%) PV: P15 O4
 N17 ->       1 (V: 67.98%) (N:  0.9%) PV: N17 Q6
  N5 ->       1 (V: 67.97%) (N:  0.2%) PV: N5 D14
 J15 ->       1 (V: 67.97%) (N:  1.1%) PV: J15 F4
 M10 ->       1 (V: 67.97%) (N:  0.2%) PV: M10 D10
 K12 ->       1 (V: 67.97%) (N:  0.4%) PV: K12 K4
  Q8 ->       1 (V: 67.96%) (N:  0.3%) PV: Q8 F4
 H16 ->       1 (V: 67.96%) (N:  1.0%) PV: H16 D6
 K17 ->       1 (V: 67.96%) (N:  0.5%) PV: K17 Q6
  F3 ->       1 (V: 67.96%) (N:  0.2%) PV: F3 Q14
  R6 ->       1 (V: 67.96%) (N:  0.3%) PV: R6 F16
 K10 ->       1 (V: 67.95%) (N:  0.3%) PV: K10 K16
 H18 ->       1 (V: 67.95%) (N:  0.4%) PV: H18 O4
 D10 ->       1 (V: 67.94%) (N:  0.3%) PV: D10 Q14
 Q10 ->       1 (V: 67.94%) (N:  0.8%) PV: Q10 D14
 N14 ->       1 (V: 67.94%) (N:  0.3%) PV: N14 Q6
 R12 ->       1 (V: 67.94%) (N:  0.7%) PV: R12 F16
 K14 ->       1 (V: 67.94%) (N:  0.4%) PV: K14 D6
 D16 ->       1 (V: 67.94%) (N:  0.3%) PV: D16 O4
 L17 ->       1 (V: 67.93%) (N:  0.6%) PV: L17 Q6
 L14 ->       1 (V: 67.93%) (N:  0.3%) PV: L14 Q14
 F11 ->       1 (V: 67.93%) (N:  0.2%) PV: F11 O16
 J14 ->       1 (V: 67.93%) (N:  0.4%) PV: J14 D6
 D14 ->       1 (V: 67.93%) (N:  1.1%) PV: D14 Q6
  E8 ->       1 (V: 67.92%) (N:  0.2%) PV: E8 O4
 P10 ->       1 (V: 67.92%) (N:  0.3%) PV: P10 D14
 M19 ->       1 (V: 67.92%) (N:  0.2%) PV: M19 Q14
 G16 ->       1 (V: 67.92%) (N:  0.5%) PV: G16 F4
 G19 ->       1 (V: 67.91%) (N:  0.3%) PV: G19 F4
 J18 ->       1 (V: 67.91%) (N:  0.2%) PV: J18 Q6
  O8 ->       1 (V: 67.91%) (N:  0.2%) PV: O8 F4
 K18 ->       1 (V: 67.89%) (N:  0.4%) PV: K18 Q6
 P16 ->       1 (V: 67.88%) (N:  0.8%) PV: P16 D6
 E18 ->       1 (V: 67.88%) (N:  0.3%) PV: E18 Q6
 N15 ->       1 (V: 67.87%) (N:  1.5%) PV: N15 O4
 F14 ->       1 (V: 67.86%) (N:  0.2%) PV: F14 O4
 G11 ->       1 (V: 67.85%) (N:  0.3%) PV: G11 F16
  N9 ->       1 (V: 67.85%) (N:  0.3%) PV: N9 O4
 P14 ->       1 (V: 67.85%) (N:  0.2%) PV: P14 D6
177 visits, 63893 nodes, 176 playouts, 3 n/s

= F16

After that I add Leela zero as an engine to Sabaki with the same parameters and let it play against Leela 0.11.0, the result is:

image

image

autogtp could pile up more work on my GPU

I've a Titan X Pascal. When running autogtp.exe the memory usage on the GPU is a few percent points, GPU load is less than 10%, and power consumption is under 25% - all these measured with the GPU-Z app.

I think the software should pile up more work if the GPU can take it.

zlib1g-dev needs to be installed to compile

I had to install zlib1g-dev in order to compile leelaz.

Otherwise I'd get this error:
g++ -I/usr/include/openblas -I. -Wall -Wextra -pipe -O3 -g -ffast-math -flto -march=native -std=c++14 -DNDEBUG -MD -MP -c -o Training.o Training.cpp
Training.cpp:26:18: fatal error: zlib.h: No such file or directory
compilation terminated.

node status not updated in play_simulation for two consecutive passes

In play_simulation method from UCTSearch.cpp:

When we have two consecutive passes, node->create_children will return false. In this case, the result.valid() is false, hence all its parent nodes will get invalid result and their node status will not be updated.

My understanding is we need use the final result of game simulation to update the previous nodes when we descend along the game tree. In this case, we don't have a valid result returned, then how can we update the node in MCTS when the game simulation is finished (with two passes) ?

Update:
I read the paper, the result of self-play is never used in MCTS, but just used in training the network, so never mind for this question. Thanks!

Spread the word

Since looking at the statistics on the server there are 44 clients sending games at the moment. I was thinking to tell around about this project. I might have access to a big base of Go player. I might be able to contact someone on youtube that can promote our project. What I want to know is if I am allowed to do it.
Second would be really cool if the last autogtp version would be compiled under Windows and put on GitHub for downloading.

Additional option? Handicap.

It would be nice to have additional option like "-e x", where x stands for maximum
handicap. Part of the day I run leelaz bot on KGS ( as LeelaZeroT ) to promote CPU/GPU participation.

Some weaker players have tendency to get 9 or 8 stones handicap and occupy the bot several times a day making observation boring. If handicap limit is for example 3 ("-e 3") and leelaz just exits by resignation, it would be great.

A question, what is your guess, after how many games will leelaz game get less random enough to be resemble regular player? 100K? 200K?

The advantage would be make players to be able to see/enjoy progress and encourage them to contribute by sharing their PCs.

leela-zero-0.4-windows not working

Hi,
I have download the zip file from the release page.
I unzip it and open the autogtp.exe.

But the autogitp.exe closed automatically,maybe something wrong with it.
I have check the folder, didd not find any log.

Can you add some log to the exe?

reverse rotate after nn forwarding ?

In Network.cpp,
for (size_t idx = 0; idx < outputs.size(); idx++) { ... auto rot_idx = rev_rotate_nn_idx(idx, rotation); auto val = outputs[rot_idx]; int x = idx % 19; int y = idx / 19; int vtx = state->board.get_vertex(x, y);
as input matrix has been rotated, should we use rot_idx instead of idx to get_vertex ?

Redundancy

This project looks really interesting, and I will gladly donate compute time for it.

Have you thought about result redundancy ?
It could protect against wrong results. They may be intentional or not.

Is there any way to validate a result, other than recomputing it on another client ?

Thanks for your time on this project.

Training network

What should I do with train.txt? And how can I improve weights.txt?

Boost error "what(): character conversion failed"

Compiling works fine, executing the binary gives following error:

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injectorstd::logic_error >'
what(): character conversion failed

I have Boost 1.58.0 installed on ubuntu.

AutoGTP for Windows v2

I just finished a 1st AutoGTP game on my PC.
Since a NN is on early stage it requires not to huge resources - in my case CPU 20-30% GPU 5-10%.
So I've started 4 instances of AutoGTP at one time and now CPU usage is 100% and GPU 20-30%.

The question is if that's OK for the building the NN?

autogtp only runs 1 game?

Okay I've tried running autogtp on my Mac. Leela Zero compiles with a few warnings, but doesn't look too bad. autogtp compiles fine.

executing it results in

autogtp v1
Best network hash: d645af975ed5b9d08530d092d484482d9aee014f9498c7afcde8570743f85751
Required client version: 1 (OK)
Already downloaded network.
Engine has started.
Infinite thinking time set.
1 games played.

It finishes afterwards and I would have to restart it. Is this desired behavior?

As of now 46 clients are listet on: http://zero-test.sjeng.org/
Since I haven't contributed yet, I kinda expected it to increase to 47, which it didn't.

ls output:

Game.cpp
Game.h
Game.o
Makefile
README.md
autogtp
autogtp.pro
d645af975ed5b9d08530d092d484482d9aee014f9498c7afcde8570743f85751
d645af975ed5b9d08530d092d484482d9aee014f9498c7afcde8570743f85751.gz
main.cpp
main.o

so it downloads the current best weights.

How to Run on Windows with Sabaki

C:\Users\ZCH>F:\weiqi\leela-zero-0.2-windows\leelaz.exe --gtp -w F:\weiqi\leela-zero-0.2-windows\weights.txt
Using 1 thread(s).
Initializing OpenCL
Detected 2 OpenCL platforms
Platform version: OpenCL 2.0
Platform profile: FULL_PROFILE
Platform name: Intel(R) OpenCL
Platform vendor: Intel(R) Corporation
Device ID: 0
Device name: Intel(R) HD Graphics 5500
Device type: GPU
Device vendor: Intel(R) Corporation
Device driver: 10.18.15.4248
Device speed: 900 MHz
Device cores: 24 CU
Device score: 620
Device ID: 1
Device name: Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
Device type: CPU
Device vendor: Intel(R) Corporation
Device driver: 5.2.0.10039
Device speed: 2200 MHz
Device cores: 4 CU
Device score: 520
Platform version: OpenCL 1.2 CUDA 8.0.0
Platform profile: FULL_PROFILE
Platform name: NVIDIA CUDA
Platform vendor: NVIDIA Corporation
Device ID: 2
Device name: GeForce 840M
Device type: GPU
Device vendor: NVIDIA Corporation
Device driver: 376.54
Device speed: 1124 MHz
Device cores: 3 CU
Device score: 1112
Selected platform: NVIDIA CUDA
Selected device: GeForce 840M
with OpenCL 1.2 capability
Wavefront/Warp size: 32
Max workgroup size: 1024
Max workgroup dimensions: 1024 1024 64
Detecting residual layers...v1...128 channels...6 blocks
Transferring weights to GPU...done
BLAS Core: Nehalem

I set Sabaki parameters:
103101.png

What i will to do ?

Lack of precision in the readme concerning weights format

In the readme, under the "Weights format" section, it is not specified in which order the value head and the policy head should be put into the weight file.

Furthermore, it is not said in which "order" the weights should be put in each weight line: by browsing the next branch, I saw in tfprocess.py the following comment:

#TF
# [filter_height, filter_width, in_channels, out_channels]
# Leela
# (output, input, filter_size, filter_size]

Which indicates that leela reads weights in a different order than how tensorflow formats them. These details should be specified in the readme so people can properly format the weights.txt file.

Question about distributed learning

Hello!
Since it required huge amount of computing resources to teach network - is it possible to create some distributed system, where everyone who is willing can join and contribute their machine resources?
According their paper, 40 days is needed to overcome previous version, but for AlphaGo Lee version 3 days is enough. So it seems less than 150 years is needed :D
If 10-100 people contribute machine resources - it seems possible to make some progress. Also may donation is option to rent some powerful GPU based server (this should be even simpler since no need to build any distributed system).
Sorry if question is silly :)

Could you estimate - does it possible to achieve any tangible progress with this network learning on GTX1080? (by tangible I mean - to achieve at least low dan lvl for a month of time for example)

Thank you!

clCreateContext fails

Running this on a fresh Ubuntu 16.04 install, following your quick compile instructions.

Initializing OpenCL
Detected 1 OpenCL platforms
Platform version: OpenCL 1.2 CUDA 9.1.0
Platform profile: FULL_PROFILE
Platform name:    NVIDIA CUDA
Platform vendor:  NVIDIA Corporation
Device ID:     0
Device name:   GeForce GTX 960
Device type:   GPU
Device vendor: NVIDIA Corporation
Device driver: 387.12
Device speed:  1177 MHz
Device cores:  8 CU
Device score:  1112
Selected platform: NVIDIA CUDA
Selected device: GeForce GTX 960
with OpenCL 1.2 capability
Error creating OpenCL context: clCreateContext: 999terminate called after throwing an instance of 'cl::Error'
  what():  clCreateContext
Aborted (core dumped)

Question about alphago zero evaluator

Here is a extract from the original paper.

Evaluator. To ensure we always generate the best quality data, we evaluate each new neural network checkpoint against the current best network θ∗f before using it for data generation. The neural network θfi is evaluated by the performance of an MCTS search αθi that uses θfi to evaluate leaf positions and prior probabilities (see Search algorithm). Each evaluation consists of 400 games, using an MCTS with 1,600 simulations to select each move, using an infinitesimal temperature τ→ 0 (that is, we deterministically select the move with maximum visit count, to give the strongest possible play). If the new player wins by a margin of > 55% (to avoid selecting on noise alone) then it becomes the best player αθ∗, and is subse-quently used for self-play generation, and also becomes the baseline for subsequent comparisons.

If we use temperature = 0, the selection is deterministic. As I don't believe their is another source of randomness in the play algorithm, all 400 games should always be the same. Am I missing something and only the tested player plays deterministically while the Best model still plays with temperature=1 for the first 30 moves ?
I am trying to write an implementation to better understand how alphagozero works, and I don't understand how the players will play different games. Do you have any ideas ?

Incomplete dump_training?

In the paper, they say the following thing : "The rules of Go are invariant under rotation and reflection; this knowledge has been used in AlphaGo Zero both by augmenting the dataset during training to include rotations and reflections of each position, and to sample random rotations or reflections of the position during MCTS (see Search algorithm)."

It seems to imply that each position generated during self-play was duplicated for every possible rotation*reflection, so each position translates to 8 different training examples. Maybe leelaz could do it, too when she dumps the training.

Anaconda Python installs a conflicting qmake

Getting the following error when running "make" (qmake runs and creates a Makefile) in Ubuntu 16.04. I updated all the packages per the leelaz compile instructions.

user@box:~/Code/repos/leela-zero/autogtp$ make
g++ -Wl,-O1 -Wl,-rpath,/home/user/anaconda3/lib -o autogtp main.o Game.o   -L/home/user/anaconda3/lib -lQt5Core -lpthread 
main.o: In function `Game::~Game()':
main.cpp:(.text._ZN4GameD0Ev[_ZN4GameD5Ev]+0x88): undefined reference to `operator delete(void*, unsigned long)'
collect2: error: ld returned 1 exit status
Makefile:165: recipe for target 'autogtp' failed
make: *** [autogtp] Error 1

Move selection in deep endgames is broken

https://sjeng.org/zero/cap.sgf

This is a game between a random network and a network trained from 9k games where the random network won. The position of interest is around move 430 (loadsgf cap.sgf 430).

We can see that the 9k version was easily winning here, but it played in the 2nd last liberty of its own group and lost. The search should see the capture easily, and the 9k version should have at least some understanding that losing so many stones is bad, so it is weird that it makes this mistake. Running the search on the same position again reveals what is happening:

Playouts: 54749, Win: 71.24%, PV: K17 G6 P11 R16 

 K17 ->      16 (V: 70.62%) (N: 11.2%) PV: K17 G6 P11 R16 
 C18 ->      13 (V: 70.23%) (N:  8.4%) PV: C18 G6 H3 R16 
  H3 ->      12 (V: 66.63%) (N:  8.9%) PV: H3 N1 P11 N2 
  G3 ->      12 (V: 52.24%) (N: 12.6%) PV: G3 R16 Q10 H3 
 Q10 ->      11 (V: 75.94%) (N:  7.0%) PV: Q10 R16 H3 G3 
 B17 ->      11 (V: 69.14%) (N:  9.3%) PV: B17 G3 P11 R16 
 P11 ->      10 (V: 65.98%) (N:  8.3%) PV: P11 R16 G3 H3 
pass ->       8 (V: 88.23%) (N:  3.7%) PV: pass D1 G3 
  T1 ->       4 (V: 98.38%) (N:  0.8%) PV: T1 P6 S1 
97 visits, 937 nodes, 57340 playouts, 1147 n/s

We can see that the value head properly understands that passing, or capturing the black group in the lower right are very good. But the move decision is made on the number of simulations, and this is very low. In fact, we have very few visits for all moves (instead of the expected 1600 total). Yet the playout number is very high. What's going on?

I think this is the code pointed out in issue #38 backfiring. Every time there are two passes, there will be no expansion past that and the number of visits for this path won't be updated on a playout. So all paths that quickly lead to two passes in the optimal case won't get much if any visits, meaning that even if the value network understands the move, the search can't choose it.

Can Leelaz support different size?

Hi,

I tried to execute leelaz with smaller size
leelaz -boardsize 9
But it's incorrect. Is there any way to setting the boardsize for Leelaz?

Compiling under Linux Mint 18.2 Sonya by changing Makefile

I was able to compile leelaz under Linux Mint 18.2 Sonya.

Other than installing dependencies I had to make these changes in the Makefile (I've commented the original line and added the one that worked on my system):
#CXXFLAGS += -I/opt/OpenBLAS/include
CXXFLAGS += -I/usr/include/openblas/
#LDFLAGS += -L/opt/OpenBLAS/lib
LDFLAGS += -L/usr/lib

Problem with training

I am tring to train the net

marcuzzo@marcuzzo: ~/workspace/leela-zero[next]training/tf/parse.py build/train.0
Found 0 chunks
marcuzzo@marcuzzo: ~/workspace/leela-zero[next]$ training/tf/parse.py build/train.1
Found 0 chunks
marcuzzo@marcuzzo: ~/workspace/leela-zero[next]$ training/tf/parse.py build/train.2
Found 0 chunks

what am I doing wrong?

Inconsistency between readme and files provided

In the readme, it says about the weights that "The zero_mini.prototxt file describes the 12 residual layer case that was used for the example supervised network listed in 'I just want to play'.".

I looked into the weights.txt file and it seems to have only 6 residual layers instead of 12, and the convolutions output 128 features instead of 256.

I made a program that outputs the number of values on each line of the file and it displayed:
20736
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
147456
128
128
128
256
2
2
2
261364
362
128
1
1
1
92416
256
256
1

You can see clearly here the bias lines contain 128 values (so 128 output features), and there are 12 convolutions with 147456 weights, which corresponds to 6 residual layers (2 convolutions per layer).

Is Leela able to handle "any" number of weights if all that is changed is the number of output features and/or the board size?

Error when compile

I try to compile and it says:

SGFParser.cpp:239:23: error: 'isascii' was not declared in this scope

Can you fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.