Leela Zero - Le Bottin des Jeux Linux

Leela Zero

🗃️ Specifications

📰 Title: Leela Zero 🕹️ / 🛠️ Type: Tool
🗃️ Genre: Puzzle 🚦 Status: 06. To be re-tested (status)
🏷️ Category: Puzzle ➤ Board Game ➤ Go ➤ Engine 🌍️ Browser version:
🔖 Tags: Puzzle; Board Game; Go Engine; Deep-learning; Monte Carlo Tree Search; GTP Protocol 📦️ Package Name: leela-zero
🐣️ Approx. start: 2017-10-25 📦️ Arch package: ✓
🐓️ Latest: 2019-04-04 📦️ RPM package:
📍️ Version: Latest: 0.17 / Dev: 3f29788 📦️ Deb package: ✓
🏛️ License type: 🕊️ Libre 📦️ Flatpak package:
🏛️ License: GPL-3 📦️ AppImage package:
🏝️ Perspective: Third person 📦️ Snap package:
👁️ Visual: Text ⚙️ Generic binary:
⏱️ Pacing: Turn-Based 📄️ Source: ✓
👫️ Played: Single 📱️ PDA support:
🎖️ This record: 5 stars 🕳️ Not used:
🎀️ Game design: 5 stars 👫️ Contrib.: goupildb & Louis
🎰️ ID: 15433 🐛️ Created: 2018-07-15
🐜️ Updated: 2023-05-21

📖️ Summary

[en]: A libre and multi-platform AI for the game of Go (an AI specialized in this type of games) using Deep Learning (via a cutting-edge technique called AlphaGo Zero for learning the rules of the game of Go). It is ranked among the best in the world (power estimated at 4892 Elo/16D for v.17 273, ranked 6th on GitHub in March 2021; humans reach 3800 Elo), communicating with the GTP protocol.It uses the MCTS algorithm (Monte Carlo Tree Search, a heuristic search algorithm, without Monte Carlo diffusion) and a convolutional neural network stack (aka Deep Learning). [fr]: Une IA libre et multi-plateforme pour le jeu de Go (une IA spécialisée dans ce type de jeux) faisant appel au Deep Learning (via une technique de pointe dénommée AlphaGo Zero pour l'apprentissage des règles du jeu de Go). Elle est classée parmi les meilleures au monde (puissance estimée à 4892 Elo/16D pour la v.17 273, classée 6ème sur GitHub en Mars 2021 ; les humains atteignent 3800 Elo), communiquant avec le protocole GTP. Elle utilise l'algorithme MCTS (Monte Carlo Tree Search, un algorithme de recherche heuristique, sans diffusion Monte Carlo) et une pile de réseaux neuronaux convolutif (aka Deep Learning).

🎥️ Videos


🎲️ Gameplay: (202xxx), (202xxx), (202xxx),

🕸️ Links

🏡️ Website & videos
[Homepage] [Dev site] [Features/About] [Screenshots] [Videos t(202xxx) gd(202xxx) gu(202xxx) r(202xxx) lp(202xxx) g(202xxx) g(202xxx) g(202xxx) g[fr](202xxx) g[de](202xxx) g[ru](202xxx) g[pl](202xxx) g[cz](202xxx) g[sp](202xxx) g[pt](202xxx) g[it](202xxx) g[tr](202xxx)] [WIKI] [FAQ] [RSS] [Changelog 1 2 3]

💰 Commercial: (empty)

🍩️ Resources
• Go-playing AI, based on the AlphaGo Zero approach: [ELF, by Facebook] [ELF (a work-in-progress successor to the original ELF platform)] [Senseis (ELF OpenGo introduction)]
(can be run on Leela Zero, stronger than the standard Leela Zero network)

🛠️ Technical informations
[PCGamingWiki] [MobyGames] [KGS (Aide sur le classement) [fr]] [Sensei's Library (Leela)] [ICGA Tournaments (Leela)] [ICGA Tournaments (Go tournaments & Programs)] [Go AI Ratings on GitHub] [Go Ratings (humans)]

🦣️ Social
Devs (Leela Zero Team 1 2 [fr] [en]): [Site 1 2] [Chat] [mastodon] [PeerTube] [YouTube] [PressKit] [Interview 1(202xxx) 2(202xxx)]
Devs (Gian-Carlo Pascutto (gcp, Garf) [fr] [en]): [Site 1 2] [Chat] [mastodon] [PeerTube] [YouTube] [PressKit] [Interview 1(202xxx) 2(202xxx)]
The Project: [Blog] [Chat] [Forums] [mastodon] [PeerTube] [YouTube] [PressKit] [reddit] [Discord]

🐝️ Related
[Wikipedia (Leela Zero) [fr] [en] [de]]
[Wikipedia (Weighted network) [fr] [en] [de]]
[Wikipedia (Tensor processing unit) [fr] [en] [de]]
[Wikipedia (Go) [fr] [en] [de]]
[Debian/Ubuntu] [Sjeng.org]

📦️ Misc. repositories
[Repology] [pkgs.org] [Generic binary] [Arch Linux / AUR] [openSUSE] [Debian/Ubuntu] [Flatpak] [AppImage(author's repo)] [Snap] [PortableLinuxGames]

🕵️ Reviews
[HowLongToBeat] [metacritic] [OpenCritic] [iGDB]

📰 News / Source of this Entry (SotE) / News (SotN)
[Changes with v. 0.17 (20190404)]

🕊️ Source of this Entry: [Site (date)]

🦣️ Social Networking Update (on mastodon)

🛠️ Title:
🦊️ What's:
🏡️
🐣️
🔖
📦️
📖 Our entry: https://www.lebottindesjeuxlinux.tuxfamily.org/en/online/lights-on/

🥁️ Update:
⚗️
📌️ Changes:
🦣️ From: 📶️

🏝️ https://www.youtube.com/embed/
🦉️ https://www.youtube.com/embed/
🦝️ https://www.youtube.com/embed/
🦝️ https://www.youtube.com/embed/
🕵️ https://www.youtube.com/embed/
🕯️ https://www.youtube.com/embed/
🕯️ https://www.youtube.com/embed/
🎲️ https://www.youtube.com/embed/
🎲️ https://www.youtube.com/embed/
🎲️ https://www.youtube.com/embed/
🎲️[fr] https://www.youtube.com/embed/
🎮️ https://www.youtube.com/embed/
🎮️ https://www.youtube.com/embed/
🐧 https://www.youtube.com/embed/
🐧 https://www.youtube.com/embed/

📕 Description [en]

📕🐧"A libre AI for the game of Go using Deep Learning and ranked among the best in the world"🐧📕.

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

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

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.


I just want to play right now

Download the best known network weights file from: https://zero.sjeng.org/best-network

And head to the Usage section of this README.

If you prefer a more human style, a network trained from human games is available here: https://sjeng.org/zero/best_v1.txt.zip.


Usage

The engine supports the GTP protocol, version 2.

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.

Sabaki is a very nice looking GUI with GTP 2 capability. It should work with this engine. 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!


🍥️ Debian:

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

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.

https://deepmind.com/documents/119/agz_unformatted_nature.pdf

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, the author recommends 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.

Recomputing the AlphaGo Zero weights will take about 1700 years on commodity hardware. Upstream is running a public, distributed effort to repeat this 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). To help with this effort, run the leelaz-autogtp binary provided in this package. The best-known network weights file is at https://zero.sjeng.org/best-network


🌍️ Wikipedia:

Leela Zero is a free and open-source computer Go program released on 25 October 2017. It is developed by Belgian programmer Gian-Carlo Pascutto, the author of chess engine Sjeng and Go engine Leela.

Leela Zero's algorithm is based on DeepMind's 2017 paper about AlphaGo Zero. Unlike the original Leela, which has a lot of human knowledge and heuristics programmed into it, the program code in Leela Zero only knows the basic rules and nothing more. The knowledge that makes Leela Zero a strong player is contained in a neural network, which is trained based on the results of previous games that the program played.

Leela Zero is trained by a distributed effort, which is coordinated at the Leela Zero website. Members of the community provide computing resources by running the client, which generates self-play games and submits them to the server. The self-play games are used to train newer networks. Generally, over 500 clients have connected to the server to contribute resources. The community has provided high quality code contributions as well.

Leela Zero finished third at the BerryGenomics Cup World AI Go Tournament in Fuzhou, Fujian, China on 28 April 2018. The New Yorker at the end of 2018 characterized Leela and Leela Zero as "the world’s most successful open-source Go engines".

In early 2018, another team branched Leela Chess Zero from the same code base, also to verify the methods in the AlphaZero paper as applied to the game of chess. AlphaZero's use of Google TPUs was replaced by a crowd-sourcing infrastructure and the ability to use graphics card GPUs via the OpenCL library. Even so, it is expected to take a year of crowd-sourced training to make up for the dozen hours that AlphaZero was allowed to train for its chess match in the paper.

📕 Description [fr]

Une IA pour le jeu de Go faisant appel au Deep Learning, par la Leela Zero Team, initié par Gian-Carlo Pascutto (gcp, Garf).

Leela Zero est une IA libre et multi-plateforme pour le jeu de Go (une IA spécialisée dans ce type de jeux) faisant appel au Deep Learning (via une technique de pointe dénommée AlphaGo Zero pour l'apprentissage des règles du jeu de Go). Elle est classée parmi les meilleures au monde (puissance estimée à 4892 Elo/16D pour la v.17 273, classée 6ème sur GitHub en Mars 2021 ; les humains atteignent 3800 Elo), communiquant avec le protocole GTP. Elle utilise l'algorithme MCTS (Monte Carlo Tree Search, un algorithme de recherche heuristique, sans diffusion Monte Carlo) et une pile de réseaux neuronaux convolutif (aka Deep Learning).

Le revers de la médaille de ce type d'IA, est que pour qu'elle soit forte, elle doit effectuer un calcul préalable très lourd (1700 ans d'un matériel ordinaire) des poids du réseau. Néanmoins un outil spécifique permet d'utiliser les ressources de Google et/ou celles de ses utilisateurs via un calcul distribué pourvu qu'ils disposent d'un bon GPU.


Un moteur de Go sans connaissances humaines, sur le modèle du document AlphaGo Zero.

Quoi

Un programme de Go sans connaissances humaines. Utilisation de MCTS (NdT : Monte Carlo Tree Search, un algorithme de recherche heuristique) (mais sans diffusion Monte Carlo) et d'une pile de réseaux neuronaux convolutif (NdT : Deep Learning).

Ceci est une ré-implémentation assez fidèle du système décrit dans le document Alpha Go Zero "Maîtriser le jeu de Go sans connaissances humaines". À toutes fins pratiques, il s'agit d'un AlphaGo Zero open source.

Attendez, Quoi ?

Si vous vous demandez quel est le truc : vous avez toujours besoin des poids du réseau (NdT : Weighted network, un réseau dans lequel des poids différents sont assignés aux liens entre noeuds). Aucun poids de réseau ne se trouve dans ce dépôt (NdT : GitHub). Si vous parvenez à obtenir les poids AlphaGo Zero, ce programme pourra être considéré comme fort, sous condition que vous disposiez également de quelques Tensor Processing Unit (NdT : aka TPU, un processeur matériel spécifiquement conçu par Google et utilisé dans ses serveurs pour accélérer un réseau neuronal artificiel ou un algorithme d'apprentissage statistique aka machine learning). En l'absence de ces TPU, je recommanderais un GPU haut de gamme - ce qui n'est pas exactement la même chose, mais le résultat serait toujours un moteur beaucoup plus fort que les meilleurs humains.

Donne-moi les poids (NdT : weights)

Recalculer les poids AlphaGo Zero prendra environ 1700 ans à un matériel classique.

L'une des raisons de la publication de ce programme est que nous menons un effort public et distribué pour répéter le travail. En travaillant ensemble, et surtout en commençant à plus petite échelle, il faudra moins de 1700 ans pour obtenir un bon réseau (que vous pouvez alimenter / fournir à ce programme, le rendant soudain fort).

Je veux aider

Vous avez besoin d'un PC avec un GPU, c'est-à-dire une classique carte graphique conçue par NVIDIA ou AMD, de préférence pas trop ancienne, et avec les pilotes les plus récents installés.

Il est possible d'exécuter le programme sans GPU, mais les performances seront beaucoup plus faibles. Si votre processeur n'est pas très récent (Haswell ou plus récent, Ryzen ou plus récent), les performances seront carrément mauvaises, et il est probablement inutile d'essayer de rejoindre l'effort distribué. Mais vous pouvez toujours jouer, surtout si vous êtes patient.


Je veux juste jouer maintenant

Téléchargez le fichier de poids de réseau le plus connu à partir de: https://zero.sjeng.org/best-network

Et dirigez-vous vers la section Utilisation (NdT : ci-dessous)

Si vous préférez un style plus humain, un réseau formé à partir de jeux humains est disponible ici: https://sjeng.org/zero/best_v1.txt.zip.


Utilisation

Le moteur prend en charge le protocole GTP, version 2.

Leela Zero n'est pas destiné à être utilisé directement. Vous avez besoin d'une interface graphique qui va s'interfacer avec Leela Zero via le protocole GTP.

Sabaki est une très belle interface graphique supportant GTP 2. Cela devrait fonctionner avec ce moteur. Beaucoup de logiciels peuvent interagir avec un moteur via GTP, alors regardez autour de vous.

Ajoutez l'option --gtp commandline sur la ligne de commande du moteur pour activer le support GTP de Leela Zero. Vous aurez besoin d'un fichier de poids, spécifiez-le avec l'option -w.

Toutes les commandes requises sont supportées, ainsi que le sous-ensemble de tournoi, et "loadsgf". La liste complète complète peut être obtenue avec l'option "list_commands" (NdT : $ src/leelaz --list_commands ou $ src/leelaz -h). Le contrôle de temps peut être spécifié via GTP via la commande time_settings. L'extension kgs-time_settings est également prise en charge. Elle doit être fournie par l'interface GTP 2, et non pas via la ligne de commande!

🚧️ Installation ➜ 🚀️ Launching [fr]

➥Test préalable du support OpenCL et de la compatibilité de votre installation :

Lancez au préalable les commandes suivantes :
# apt install clinfo
$ clinfo


✔ ⚙️ Installation à partir du binaire

Le moteur est en dépôt, installez le paquet leela-zero

Téléchargez dans le répertoire souhaité le fichier best-network, en lançant en console : wget https://zero.sjeng.org/best-network


✔ 📄️ Installation à partir du source

▸ Installation des dépendances :
• Installez au préalable les paquets suivants (via apt): # apt install libboost-dev libboost-program-options-dev libopenblas-dev opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev zlib1g-dev

▸ Téléchargement du source (sur GitHub):
(ne chargez pas le source via le bouton de GitHub : ça ne fonctionnera pas)

Version stable, dans le répertoire souhaité, lancez : $ git clone -b "Nom_de_la_release" --recursive https://github.com/gcp/leela-zero
Nom_de_la_release : à remplacer par le nom d'une release valide indiquée sur la page de développement : sur GitHub, dans la section Release, le nom valide est l'étiquette située à gauche du titre, ou cliquez sur "Tags" pour obtenir la liste des étiquettes valides).
ou Version récente (non stable), dans le répertoire souhaité, lancez : $ git clone --recursive https://github.com/gcp/leela-zero

▸ Compilation :
• Dans son répertoire racine lancez successivement :
$ cd leela-zero/src
$ make
(ou, pour accélérer la compilation, "$ make -j8" si vous disposez d'un processeur 8 threads, à adapter pour vous)
$ cd ..
$ wget https://zero.sjeng.org/best-network


🚀️ LANCEMENT DU MOTEUR :

• Si vous avez installé le jeu à partir d'un paquet, placez-vous dans le répertoire où se trouve le fichier best-network et saisissez en console : /usr/games/leelaz --weights best-network
• Si vous avez compilé le jeu à partir de son source, en console dans son répertoire racine lancez : $ ./src/leelaz --weights best-network

🕵️ Test [fr]

🕵️ Test (0.15) par goupildb :

🎯️ Objectif: rédiger/mettre à jour/valider sa notice d'installation et tester son fonctionnement.

L'idée était de tester le moteur des dépôts avec l'interface Sabaki (dans le Bottin).
Comme je ne suis pas parvenu à le faire fonctionner avec cette interface, j'ai tenté de le compiler (pour voir si le souci ne venait pas du paquet).
Ce qui m'a permis de voir (en lisant mieux la doc sur GitHub) qu'il avait aussi besoin d'un fichier de poids de réseau qui n'est ni livré dans le paquet ni disponible en dépôt (doc d'installation mise à jour ci-avant).

Le moteur se compile bien.
Le moteur compilé comme le moteur des dépôts fonctionnent.

Malheureusement les deux aboutissent au même message d'erreur :

$ src/leelaz --weights best-network
ou :
$ /usr/games/leelaz --weights best-network
Using 2 thread(s).
RNG seed: 13233562359525831694
Leela Zero 0.15 Copyright (C) 2017-2018 Gian-Carlo Pascutto and contributors
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see the COPYING file for details.

Detecting residual layers...v1...192 channels...15 blocks.
Initializing OpenCL.
OpenCL: clGetPlatformIDs
terminate called after throwing an instance of 'cl::Error'
what(): clGetPlatformIDs
Abandon

En essayant d'installer les pilotes nvidia les plus récents pour tenter de faire fonctionner l'OpenCL, j'ai oublié que ma carte graphique nVidia ne supportait que l'ancien pilote nvidia-legacy-340xx (en 340.107) et j'ai installé le pilote 390.67. Résultat : j'ai perdu l'accélération graphique, et j'ai mis 20 bonnes minutes à finalement désinstaller les précédents paquets nvidia et j'utilise à présent le pilote nouveau sur le PC du Bottin :)).

Je n'ai exploré qu'une petite partie de l'outil et de la doc. Le sujet est vaste et demande un certain investissement en temps.
N'étant pas sûr d'avoir fait tout ce qu'il fallait, je laisse le sujet de côté pour l'instant (donc pas de notation), faute de temps, mais je vous invite à le tester si vous avez le matériel et le temps.