Home

Awesome

<a name="manual"></a> KaTrain

Latest Release License:MIT GitHub Downloads PyPI Downloads Discord

KaTrain is a tool for analyzing games and playing go with AI feedback from KataGo:

Manual

<table> <td> <td>

<a href="http://github.com/sanderland/katrain/blob/master/README.md"><img alt="English" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-uk.png" width=50></a> <a href="http://translate.google.com/translate?sl=en&tl=de&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="German" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-de.png" width=50></a> <a href="http://translate.google.com/translate?sl=en&tl=fr&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="French" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-fr.png" width=50></a> <a href="http://translate.google.com/translate?sl=en&tl=ru&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Russian" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-ru.png" width=50></a> <a href="http://translate.google.com/translate?sl=en&tl=tr&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Turkish" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-tr.png" width=50></a> <br/>

<a href="http://translate.google.com/translate?sl=en&tl=zh-CN&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Simplified Chinese" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-cn.png" width=50></a> <a href="http://translate.google.com/translate?sl=en&tl=zh-TW&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Traditional Chinese" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-tw.png" width=50></a> <a href="http://translate.google.com/translate?sl=en&tl=ko&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Korean" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-ko.png" width=50></a> <a href="http://translate.google.com/translate?sl=en&tl=ja&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Japanese" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-jp.png" width=50></a>

</td> </table>

<a name="preview"></a> Preview and Youtube Videos

<img alt="screenshot" src="https://raw.githubusercontent.com/sanderland/katrain/master/screenshots/analysis.png" width="550">
Local Joseki AnalysisAnalysis TutorialTeaching Game Tutorial
Local Joseki Analysis VideoAnalysis Tutorial Teaching Game Tutorial

<a name="install"></a> Installation

<a name="kata"></a> Configuring KataGo

KaTrain comes pre-packaged with a working KataGo (OpenCL version) for Windows, Linux, and pre-M1 Mac operating systems, and the rather old 15 block model.

To change the model, open 'General and Engine settings' in the application and 'Download models'. You can then select the model you want from the dropdown menu.

To change the katago binary, e.g. to the Eigen/CPU version if you don't have a GPU, click 'Download KataGo versions'. You can then select the KataGo binary from the dropdown menu. There are also CUDA and TensorRT versions available on the KataGo release site. Particularly the latter may offer much better performance on NVIDIA GPUs, but will be harder to set up: see here for more details.

Finally, you can override the entire command used to start the analysis engine, which can be useful for connecting to a remote server. Do keep in mind that KaTrain uses the analysis engine of KataGo, and not the GTP engine.

<a name="ai"></a> Play against AI

Instant feedback

The dots on the move indicate how many points were lost by that move.

In short, if you are a weaker player you should mostly focus on large dots that are red or purple, while stronger players can pay more attention to smaller mistakes. If you want to hide some colours on the board, or not output details for them in SGFs,you can do so under 'Configure Teacher'.

AIs

This section describes the available AIs.

In the 'AI settings', settings which have been tested and calibrated are at the top and have a lighter color, changing these will show an estimate of rank. This estimate should be reasonably accurate as long as you have not changed the other settings.

The Engine based AIs (KataGo, ScoreLoss, KataJigo) are affected by both the model and choice of visits and maximum time, while the policy net based AIs are affected by the choice of model file, but work identically with 1 visit.

Further technical details and discussion on some of these AIs can be found on this thread at the life in 19x19 forums.

<a name="analysis"></a> Analysis

Analysis options in KaTrain allow you to explore variations and request more in-depth analysis from the engine at any point in the game.

KeyShort DescriptionDetails
<kbd>Tab</kbd>Switch between analysis and play modesAI moves, teaching mode and timers are suspended in analysis mode. The state of the analysis options and right-hand side panels and options is saved independently for 'play' and 'analyze', allowing you to quickly switch between a more minimalistic 'play' mode and more complex 'analysis' mode.

The checkboxes at the top of the screen:

KeyShort DescriptionDetails
<kbd>q</kbd>Child moves are shownOn by default, can turn it off to avoid obscuring other information or when wanting to guess the next move.
<kbd>w</kbd>Show all dotsToggles showing coloured evaluation 'dots' on the last few moves or not. You can configure the thresholds, along with how many of the last moves they are shown for under 'Teaching/Analysis Settings'.
<kbd>e</kbd>Top movesShow the next moves KataGo considered, colored by their expected point loss. Small/faint dots indicate high uncertainty and never show text (lower than your 'fast visits' setting). Hover over any of them to see the principal variation.
<kbd>r</kbd>Policy movesShow KataGo's policy network evaluation, i.e. where it thinks the best next move is purely from the position, and in the absence of any 'reading'. This turns off the 'top moves' setting as the overlap is often not useful.
<kbd>t</kbd>Expected territoryShow expected ownership of each intersection.

The analysis options available under the 'Analysis' button are used for deeper evaluation of the position:

KeyShort DescriptionDetails
<kbd>a</kbd>Deeper analysisRe-evaluate the position using more visits, usually resulting in a more accurate evaluation.
<kbd>s</kbd>Equalize visitsRe-evaluate all currently shown next moves with the same visits as the current top move. Useful to increase confidence in the suggestions with high uncertainty.
<kbd>d</kbd>Analyze all movesEvaluate all possible next moves. This can take a bit of time even though 'fast_visits' is used, but can be useful to see how many reasonable next moves are available.
<kbd>f</kbd>Find alternativesIncreases analysis of current candidate moves to at least the 'fast visits' level, and request a new query that excludes all current candidate moves.
<kbd>g</kbd>Select area of interestSet an area and search only for moves in this box. Good for solving tsumegos. Note that some results may appear outside the box due to establishing a baseline for the best move, and the opponent can tenuki in variations.
<kbd>h</kbd>Reset analysisThis reverts the analysis to what the engine returns after a normal query, removing any additional exploration.
<kbd>i</kbd>Start insertion modeAllows you to insert moves, to improve analysis when both players ignore an important exchange or life and death situation. Press again to stop inserting and copy the rest of the branch.
<kbd>l</kbd>Play out the game until the end and add as a collapsed branch, to visualize the potential effect of mistakesThis is done in the background, and can be started at several nodes at once when comparing the results at different starting positions.
<kbd>Space</kbd>Turn continuous analysis on/off.This will continuously improve analysis of the current position, similar to Lizzie's 'pondering', but only when there are no other queries going on.
<kbd>Shift</kbd> + <kbd>Space</kbd>As above, but does not turn 'top moves' hints on when it is off.
<kbd>Enter</kbd>AI moveMakes the AI move for the current player regardless of current player selection.
<kbd>F2</kbd>Deeper full game analysisAnalyze the entire game to a higher number of visits.
<kbd>F3</kbd>Performance reportShow an overview of performance statistics for both players.
<kbd>F10</kbd>Tsumego FrameAfter placing a life and death problem in a corner/side, use this to fill up the rest of the board to improve AI's ability in solving life and death problems.

<a name="keyboard"></a> Keyboard and mouse shortcuts

In addition to shortcuts mentioned above and those shown in the main menu:

KeyShort DescriptionDetails
<kbd>Alt</kbd>Open the main menu
<kbd>~</kbd> or <kbd>`</kbd> or <kbd>F12</kbd>Cycles through more minimalistic UI modes
<kbd>k</kbd>Toggle display of board coordinates
<kbd>p</kbd>Pass
<kbd>Pause</kbd>Pause/Resume timer
<kbd></kbd> or <kbd>z</kbd>Undo moveHold shift for 10 moves at a time, or ctrl to skip to the start.
<kbd></kbd> or <kbd>x</kbd>Redo moveHold shift for 10 moves at a time, or ctrl to skip to the end.
<kbd></kbd>/<kbd></kbd>Switch branchAs would be expected from the move tree.
<kbd>Home</kbd>/<kbd>End</kbd>Go to the beginning/end of the game
<kbd>PageUp</kbd>Make the currently selected node the main branch
<kbd>Ctrl</kbd> + <kbd>Delete</kbd>Delete current node
<kbd>c</kbd>Collapse/Uncollapse the branch from the current node to the previous branching point
<kbd>b</kbd>Go back to the previous branching point
<kbd>Shift</kbd> + <kbd>b</kbd>Go back the main branch
<kbd>n</kbd>Go to one move before the next mistake (orange or worse) by a human playerAs in clicking the forward red arrow
<kbd>Shift</kbd> + <kbd>n</kbd>Go to one move before the previous mistakeAs in clicking the backward red arrow
Scroll MouseRedo/Undo move or Scroll through principal variationWhen hovering the cursor over the right panel: Redo/Undo move. When hovering over a candidate move: Scroll through principal variation.
Middle Scroll Wheel ClickAdd principal variation to the move treeWhen scrolling, only moves up to the point you are viewing are added.
Click on a MoveSee detailed statistics for a previous moveAlong with expected variation that was best instead of this move
Double Click on a MoveNavigate directly to just before that point in the game
<kbd>Ctrl</kbd> + <kbd>v</kbd>Load SGF from the clipboard and do a 'fast' analysis of the gameWith a high priority normal analysis for the last move.
<kbd>Ctrl</kbd> + <kbd>c</kbd>Save SGF to clipboard
<kbd>Escape</kbd>Stop all analysis

<a name="distributed"></a> Contributing to distributed training

Starting in December 2020, KataGo started distributed training. This allows people to all help generate self-play games to increase KataGo's strength and train bigger models.

KaTrain 1.8.0+ makes it easy to contribute to distributed training: simply select the option from the main menu, register an account, and click run. During this mode you can do little more than watch games.

Keep in mind that partial games are not uploaded, so it is best to plan to keep it running for at least an hour, if not several, for the most effective contribution.

A few keyboard shortcuts have special functions in this mode:

KeyShort DescriptionDetails
<kbd>Space</kbd>Switch between manually navigating the current gameAnd automatically advancing it.
<kbd>Escape</kbd>Sends the quit command to KataGoWhich starts a slow shutdown, finishing partial games but not starting new ones. Only works on v1.11+.
<kbd>Pause</kbd>Pauses/resumes contributions via the pause and resume commandsIntroduced in KataGo v1.11

<a name="themes"></a> Themes

See these instructions for how to modify the look of any graphics or colours, and creating or install themes.

<a name="faq"></a> FAQ

<a name="support"></a> Support / Contribute

GitHub issues Contributors