sounds, install

This commit is contained in:
Sander Land committed 2020-07-01 17:32:42 +02:00
1 parent 26f71166a2
commit 24bfdf3e4a
14 files changed
+112 -59

No files matched your search

+1
View File
@@ -47,6 +47,7 @@ Many thanks to these additional authors:
* "Dontbtme" for detailed feedback and early testing of v1.0+.
* "nowoowoo" for a fix to the parser for SGF files with extra line breaks.
* "nimets123" for the timer sound effects.
* "JSinSeaward" for stone sounds.
* "fohristiwhirl" for the Gibo format parsing code.
## Translators
+81 -50
View File
@@ -1,31 +1,42 @@
# KaTrain Installation
# Installation for MacOS users
* [Quick install guide for MacOS](#MacQuick)
* [Troubleshooting and installation from sources](#MacSources)
* [Quick install guide for Windows](#WindowsQuick)
* [Troubleshooting and installation from sources](#WindowsSources)
* [Quick install guide for Linux](#LinuxQuick)
* [Troubleshooting and installation from sources](#LinuxSources)
## <a name="MacPrereq"></a>Installation pre-requisites
* Install [Homebrew](https://brew.sh) by running the following command in terminal:
* ```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```
* Install Python using [Homebrew](https://brew.sh/) by executing `brew install python3`
* Alternatively download and install [Python 3.7.5](https://www.python.org/downloads/release/python-375/)
* Install Katago using [Homebrew](https://brew.sh/) by executing `brew install katago`
* You can also follow instructions [here](https://github.com/lightvector/KataGo) to compile KataGo yourself.
* If you encounter SSL errors on downloading model files, you may need to follow [these](https://stackoverflow.com/questions/52805115/certificate-verify-failed-unable-to-get-local-issuer-certificate) instructions to fix your certificates.
## <img src="https://upload.wikimedia.org/wikipedia/commons/5/5f/Windows_logo_-_2012.svg" alt="drawing" width="25"/> Installation for MacOS users
## Installation and running KaTrain from PyPi
* Run `pip3 install katrain`
* Run the program by executing `katrain` in a terminal.
* If you see an error about initializing KataGo:
* Open the settings dialog by clicking on the gear icon at the bottom right of the window and change the path of the 'katago'
setting under 'engine' to `/usr/local/bin/katago`, or the path where you compiled KataGo.
### <a name="MacQuick"></a>Quick install guide
# Installation for Windows users
[Open a terminal](https://support.apple.com/guide/terminal/open-or-quit-terminal-apd5265185d-f365-44cb-8b09-71a064a42125/mac) and enter the following commands:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install python3
brew install katago
pip3 install katrain
```
Now you can start KaTrain by simply typing `katrain` in a terminal.
## Downloadable .exe files
These commands install [Homebrew](https://brew.sh), which simplifies installing packages,
followed by the programming language Python, the KataGo AI, and KaTrain itself.
You can find downloadable .exe files for windows [here](https://github.com/sanderland/katrain/releases). Simply download and run, everything is included.
### <a name="MacSources"></a>Troubleshooting and Installation from sources
## Installation from sources for Windows users
Installation from sources is essentially the same as for Linux, see [here](#LinuxSources).
If you encounter SSL errors on downloading model files, you may need to follow [these](https://stackoverflow.com/questions/52805115/certificate-verify-failed-unable-to-get-local-issuer-certificate) instructions to fix your certificates.
## <img src="https://upload.wikimedia.org/wikipedia/commons/5/5f/Windows_logo_-_2012.svg" alt="drawing" width="25"/> Installation for Windows users
### <a name="WindowsQuick"></a>Quick install guide
You can find downloadable .exe files for windows [here](https://github.com/sanderland/katrain/releases).
Simply download and run, everything is included.
### <a name="WindowsSources"></a>Installation from sources
* Download the repository by clicking the green *Clone or download* on this page and *Download zip*. Extract the contents.
* Make sure you have a python installation, I will assume Anaconda (Python 3.7), available [here](https://www.anaconda.com/products/individual#download-section).
@@ -33,50 +44,70 @@ You can find downloadable .exe files for windows [here](https://github.com/sande
* Execute the command `pip3 install .`
* Start the app by running `katrain` in the directory where you downloaded the scripts.
# <a name="LinuxSources"></a>Installation from sources for Linux users
## Installation for Linux users
### <a name="LinuxQuick"></a>Quick install guide
If you have a working Python 3.6/3.7 available, you should be able to simply:
* Run `pip3 install katrain`
* Run the program by executing `katrain` in a terminal.
### <a name="LinuxSources"></a>Installation from sources
This section describes how to install KaTrain from source,
in case you want to run it in a local directory or have more control over the process.
It assumes you have a working Python 3.6+ installation.
* This assumed you have a working Python 3.6/3.7 installation as a default. If your default is python 2, use pip3/python3.
Kivy currently does not have a release for Python 3.8.
* Open a terminal.
* Run the command `git clone https://github.com/sanderland/katrain.git` to download the repository.
* Changing directory using `cd katrain`
* Run the command `pip3 install .` to install the package globally, or use `--user` to install locally, then run the program by typing `katrain` in the terminal.
* If you prefer not to install, run without installing using `python3 -m katrain` after installing the kivy dependencies mentioned in the next section.
* A binary for KataGo is included, but if you have compiled your own, point the 'engine/katago' setting to the relevant KataGo v1.4+ binary.
* Run the command `git clone https://github.com/sanderland/katrain.git` to download the repository and
change directory using `cd katrain`
* Run the command `pip3 install .` to install the package globally, or use `--user` to install locally.
* Run the program by typing `katrain` in the terminal.
* If you prefer not to install, run without installing using `python3 -m katrain` after installing the
dependencies from `requirements.txt`.
## Troubleshooting
A binary for KataGo is included, but if you have compiled your own, press F8 to open general settings and change the
KataGo executable path to the relevant KataGo v1.4+ binary.
Older linux machines may have trouble installing, you can try to manually install dependencies to resolve some issues.
### Troubleshooting and advanced installation from sources
The following packages may help resolve missing OS packages for Kivy or KataGo.
```
You can try to manually install dependencies to resolve some issues relating to missing dependencies,
e.g. the binary 'wheel' is not provided, KataGo is not starting, or sounds are not working.
First install the following packages, which are either required for building Kivy,
or may help resolve missing dependencies for Kivy or KataGo.
```bash
sudo apt-get install python3-pip build-essential git python3 python3-dev ffmpeg libsdl2-dev libsdl2-image-dev\
libsdl2-mixer-dev libsdl2-ttf-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev zlib1g-dev\
libgstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good libpulse\
pkg-config libgl-dev opencl-headers ocl-icd-opencl-dev python3-pygame
pkg-config libgl-dev opencl-headers ocl-icd-opencl-dev
```
Then, try installing python package dependencies using:
```bash
pip3 install -r requirements.txt
pip3 install screeninfo # Skip on MacOS, not working
```
pip3 install -U cython wheel setuptools
pip3 install kivy==2.0.0rc2 kivymd==0.104.1
In case the sound is not working, or there is no available wheel for your OS or Python version, try:
```bash
pip3 uninstall kivy
pip3 install --no-binary kivy kivy==2.0.0rc2
```
You can also install kivy from source using `pip install git+https://github.com/kivy/kivy.git@2.0.0rc3` which may help issues with audio on linux.
In case KataGo does not start, an alternative is to go [here](https://github.com/lightvector/KataGo) and compile KataGo yourself.
# Configuring the GPU(s) KataGo uses
## Configuring the GPU(s) KataGo uses
In most cases KataGo detects your configuration correctly, automatically searching for OpenCL devices and select the highest scoring device.
However, if you have multiple GPUs or want to force a specific device you will need to edit the 'analysis_config.cfg' file in the KataGo folder.
To see what devices are available and which one KataGo is using. Look for the following lines in the terminal after starting KaTrain:
```
Found 3 device(s) on platform 0 with type CPU or GPU or Accelerator
Found OpenCL Device 0: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (Intel) (score 102)
Found OpenCL Device 1: Intel(R) UHD Graphics 630 (Intel Inc.) (score 6000102)
Found OpenCL Device 2: AMD Radeon Pro 5500M Compute Engine (AMD) (score 11000102)
Using OpenCL Device 2: AMD Radeon Pro 5500M Compute Engine (AMD) OpenCL 1.2
Found 3 device(s) on platform 0 with type CPU or GPU or Accelerator
Found OpenCL Device 0: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (Intel) (score 102)
Found OpenCL Device 1: Intel(R) UHD Graphics 630 (Intel Inc.) (score 6000102)
Found OpenCL Device 2: AMD Radeon Pro 5500M Compute Engine (AMD) (score 11000102)
Using OpenCL Device 2: AMD Radeon Pro 5500M Compute Engine (AMD) OpenCL 1.2
```
The above devices were found on a 2019 MacBook Pro with both an on-motherboard graphics chip, and a separate AMD Radeon Pro video card.
@@ -94,10 +125,10 @@ openclDeviceToUseThread1 = 2
* Run `python3 -m katrain` and confirm that KataGo is now using both devices, by
checking the output from the terminal, which should indicate two devices being used. For example:
```
Found 3 device(s) on platform 0 with type CPU or GPU or Accelerator
Found OpenCL Device 0: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (Intel) (score 102)
Found OpenCL Device 1: Intel(R) UHD Graphics 630 (Intel Inc.) (score 6000102)
Found OpenCL Device 2: AMD Radeon Pro 5500M Compute Engine (AMD) (score 11000102)
Using OpenCL Device 1: Intel(R) UHD Graphics 630 (Intel Inc.) OpenCL 1.2
Using OpenCL Device 2: AMD Radeon Pro 5500M Compute Engine (AMD) OpenCL 1.2
Found 3 device(s) on platform 0 with type CPU or GPU or Accelerator
Found OpenCL Device 0: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (Intel) (score 102)
Found OpenCL Device 1: Intel(R) UHD Graphics 630 (Intel Inc.) (score 6000102)
Found OpenCL Device 2: AMD Radeon Pro 5500M Compute Engine (AMD) (score 11000102)
Using OpenCL Device 1: Intel(R) UHD Graphics 630 (Intel Inc.) OpenCL 1.2
Using OpenCL Device 2: AMD Radeon Pro 5500M Compute Engine (AMD) OpenCL 1.2
```
+4 -5
View File
@@ -51,9 +51,8 @@ but has since grown to include a wide range of features, including:
## <a name="install"></a> Installation
* See the [releases tab](https://github.com/sanderland/katrain/releases) for pre-built installers for windows.
* Alternatively use `pip3 install -U katrain` to install the latest version from PyPI on any 64-bit OS.
* Note that on MacOS you will need to set up KataGo using brew, as described [here](INSTALL.md).
* See [here](INSTALL.md#MacPrereq) for detailed instructions for running from source files on Window, Linux and MacOS,
as well as setting up KataGo to use multiple GPUs.
* See [here](INSTALL.md) for detailed instructions for Window, Linux and MacOS,
as well as troubleshooting and setting up KataGo to use multiple GPUs.
## <a name="ai"></a> Play against AI
@@ -142,7 +141,7 @@ In addition to shortcuts mentioned above and those shown in the main menu:
* **[Ctrl-V]**: Load SGF from clipboard and do a 'fast' analysis of the game (with a high priority normal analysis for the last move).
* **[Ctrl-C]**: Save SGF to clipboard.
## <a name="faq"></a FAQ
## <a name="faq"></a> FAQ
* The program is running too slowly. How can I speed it up?
* Adjust the number of visits or maximum time allowed in the settings.
@@ -157,7 +156,7 @@ In addition to shortcuts mentioned above and those shown in the main menu:
## <a name="support"></a> Support / Contribute
[![GitHub issues](https://img.shields.io/github/issues/sanderland/katrain)](https://github.com/sanderland/katrain/issues)
[![Contributors](https://img.shields.io/static/v1?label=contributors&message=15&color=dcb424)](CONTRIBUTIONS.md)
[![Contributors](https://img.shields.io/static/v1?label=contributors&message=16&color=dcb424)](CONTRIBUTIONS.md)
[![Liberapay patrons](https://img.shields.io/liberapay/patrons/sanderbaduk)](https://liberapay.com/sanderbaduk/)
[![Github sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=dcb424&link=https://github.com/sponsors/sanderland/)](https://github.com/sponsors/sanderland)
-1
View File
@@ -504,7 +504,6 @@ class KaTrainApp(MDApp):
kv_file = find_package_resource("katrain/gui.kv")
popup_kv_file = find_package_resource("katrain/popups.kv")
resource_add_path(PATHS["PACKAGE"])
Builder.load_file(kv_file)
Window.bind(on_request_close=self.on_request_close)
+5 -1
View File
@@ -1,9 +1,11 @@
import copy
import math
import random
import time
from typing import List, Optional
from kivy.clock import Clock
from kivy.core.audio import SoundLoader
from kivy.core.window import Window
from kivy.graphics.context_instructions import Color
from kivy.graphics.vertex_instructions import Ellipse, Line, Rectangle
@@ -27,6 +29,7 @@ from katrain.gui.style import *
class BadukPanWidget(Widget):
def __init__(self, **kwargs):
super(BadukPanWidget, self).__init__(**kwargs)
self.stones_sounds = [SoundLoader.load(f"sounds/stone{i}.wav") for i in [1, 2, 3, 4, 5]]
self.trainer_config = {}
self.ghost_stone = []
self.gridpos_x = []
@@ -37,7 +40,6 @@ class BadukPanWidget(Widget):
self.animating_pv = None
self.last_mouse_pos = (0, 0)
Window.bind(mouse_pos=self.on_mouse_pos)
self.redraw_board_contents_trigger = Clock.create_trigger(self.draw_board_contents)
self.redraw_trigger = Clock.create_trigger(self.redraw)
self.bind(size=self.redraw_trigger)
@@ -102,6 +104,8 @@ class BadukPanWidget(Widget):
katrain = self.katrain
if self.ghost_stone and ("button" not in touch.profile or touch.button == "left"):
katrain("play", self.ghost_stone)
if self.katrain.config("timer/sound"):
random.choice(self.stones_sounds).play()
elif not self.ghost_stone:
xd, xp = self._find_closest(touch.x, self.gridpos_x)
yd, yp = self._find_closest(touch.y, self.gridpos_y)
+1 -1
View File
@@ -70,7 +70,7 @@ class ControlsPanel(BoxLayout):
self.status_state = (None, -1e9, None)
self.active_comment_node = None
self.last_timer_update = (None, 0, False)
self.beep = SoundLoader.load("beep.wav")
self.beep = SoundLoader.load("sounds/countdownbeep.wav")
self.beep_start = 5.2
self.timer_interval = 0.07
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
certifi==2020.6.20
chardet==3.0.4
Cython==0.29.14
dataclasses==0.6
docutils==0.16
idna==2.10
Kivy==2.0.0rc2
Kivy-Garden==0.1.4
kivymd==0.104.1
Pillow==7.2.0
pygame==1.9.6
Pygments==2.6.1
requests==2.24.0
urllib3==1.25.9
+6 -1
View File
@@ -14,7 +14,12 @@ a = Analysis(
datas=[
("..\\katrain\\gui.kv", "katrain"),
("..\\katrain\\popups.kv", "katrain"),
("..\\katrain\\beep.wav", "katrain"),
("..\\katrain\\countdownbeep.wav", "katrain"),
("..\\katrain\\stone1.wav", "katrain"),
("..\\katrain\\stone2.wav", "katrain"),
("..\\katrain\\stone3.wav", "katrain"),
("..\\katrain\\stone4.wav", "katrain"),
("..\\katrain\\stone5.wav", "katrain"),
("..\\katrain\\config.json", "katrain"),
("..\\katrain\\KataGo", "katrain\\KataGo"),
("..\\katrain\img", "katrain\\img"),