Merge branch 'low_mem' of github.com:sanderland/katrain into low_mem
This commit is contained in:
commit
a7341adfe3
15 files changed
+13
-100
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -58,6 +58,7 @@ but has since grown to include a wide range of features, including:
|
|||||||
## Manual
|
## Manual
|
||||||
|
|
||||||
### Play
|
### Play
|
||||||
|
|
||||||
Under the 'play' tab you can select who is playing black and white.
|
Under the 'play' tab you can select who is playing black and white.
|
||||||
* Human is simple play with potential feedback, but without auto-undo.
|
* Human is simple play with potential feedback, but without auto-undo.
|
||||||
* Teach will give you instant feedback, and auto-undo bad moves to give you a second chance.
|
* Teach will give you instant feedback, and auto-undo bad moves to give you a second chance.
|
||||||
@@ -80,6 +81,7 @@ In short, if you are a weaker player you should mostly on large dots that are re
|
|||||||
while stronger players can pay more attention to smaller mistakes.
|
while stronger players can pay more attention to smaller mistakes.
|
||||||
|
|
||||||
#### AIs
|
#### AIs
|
||||||
|
|
||||||
Available AIs, with strength indicating an estimate for the default settings, are:
|
Available AIs, with strength indicating an estimate for the default settings, are:
|
||||||
|
|
||||||
* **[9p+]** **Default** is full KataGo, above professional level.
|
* **[9p+]** **Default** is full KataGo, above professional level.
|
||||||
@@ -115,7 +117,6 @@ Keyboard shortcuts are shown with **[key]**.
|
|||||||
* **[s]**: Equalize: Re-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.
|
* **[s]**: Equalize: Re-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.
|
||||||
* **[d]**: Sweep: Evaluate all possible next moves. This can take a bit of time even though 'fast_visits' is used, but the result is nothing if not colourful.
|
* **[d]**: Sweep: Evaluate all possible next moves. This can take a bit of time even though 'fast_visits' is used, but the result is nothing if not colourful.
|
||||||
|
|
||||||
|
|
||||||
## Keyboard and mouse shortcuts
|
## Keyboard and mouse shortcuts
|
||||||
|
|
||||||
In addition to shortcuts mentioned above, there are:
|
In addition to shortcuts mentioned above, there are:
|
||||||
@@ -136,7 +137,6 @@ In addition to shortcuts mentioned above, there are:
|
|||||||
* **[Ctrl-n]**: Load SGF from clipboard
|
* **[Ctrl-n]**: Load SGF from clipboard
|
||||||
* **[space]**: Pass
|
* **[space]**: Pass
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Configuration is stored in `config.json`. Most settings are now available to edit in the program, but some advanced options are not.
|
Configuration is stored in `config.json`. Most settings are now available to edit in the program, but some advanced options are not.
|
||||||
@@ -173,9 +173,12 @@ If you ever need to reset to the original settings, simply re-download the `conf
|
|||||||
* The first startup of KataGo can be slow due to GPU tuning, after that it should be much faster.
|
* The first startup of KataGo can be slow due to GPU tuning, after that it should be much faster.
|
||||||
* The program is running too slowly. How can I speed it up?
|
* The program is running too slowly. How can I speed it up?
|
||||||
* Adjust the number of visits or maximum time allowed in the settings.
|
* Adjust the number of visits or maximum time allowed in the settings.
|
||||||
|
* KataGo crashes with out of memory errors, how can I prevent this?
|
||||||
|
* Try using a lower number for `nnMaxBatchSize` in `KataGo/analysis_config.cfg`, and avoid using the board size 29 version.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
* Feedback and pull requests are both very welcome.
|
* Feedback and pull requests are both very welcome.
|
||||||
* For suggestions and planned improvements, see the 'issues' tab on github.
|
* For suggestions and planned improvements, see the 'issues' tab on github.
|
||||||
* You can also contact me on discord (Sander#3278) or [reddit](http://reddit.com/u/sanderbaduk) to give feedback, or simply show your appreciation.
|
* You can also contact me on discord (Sander#3278) or [reddit](http://reddit.com/u/sanderbaduk) to give feedback, or simply show your appreciation.
|
||||||
|
|
||||||
+1
-1
@@ -15,7 +15,7 @@ if True or bot in ["dev", "local"]:
|
|||||||
else:
|
else:
|
||||||
GTP2OGS = "node ../stable-gtp2ogs"
|
GTP2OGS = "node ../stable-gtp2ogs"
|
||||||
BOT_SETTINGS = f" --maxconnectedgames {MAXGAMES} --maxhandicapunranked 25 --maxhandicapranked 1 --boardsizesranked 19 --boardsizesunranked all --komisranked automatic,5.5,6.5,7.5 --komisunranked all"
|
BOT_SETTINGS = f" --maxconnectedgames {MAXGAMES} --maxhandicapunranked 25 --maxhandicapranked 1 --boardsizesranked 19 --boardsizesunranked all --komisranked automatic,5.5,6.5,7.5 --komisunranked all"
|
||||||
if 'beta' in bot:
|
if "beta" in bot:
|
||||||
BOT_SETTINGS += " --beta"
|
BOT_SETTINGS += " --beta"
|
||||||
else:
|
else:
|
||||||
BOT_SETTINGS += "" # --rankedonly"
|
BOT_SETTINGS += "" # --rankedonly"
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"engine": {
|
"engine": {
|
||||||
"katago": "KataGo/katago-bs",
|
"katago": "KataGo/katago",
|
||||||
"model": "KataGo/models/b15-1.3.2.txt.gz",
|
"model": "KataGo/models/b15-1.3.2.txt.gz",
|
||||||
"config": "KataGo/analysis_config.cfg",
|
"config": "KataGo/analysis_config.cfg",
|
||||||
"threads": 8,
|
"threads": 16,
|
||||||
"max_visits": 500,
|
"max_visits": 500,
|
||||||
"fast_visits": 50,
|
"fast_visits": 50,
|
||||||
"max_time": 3.0,
|
"max_time": 3.0,
|
||||||
|
|||||||
+4
-4
@@ -212,7 +212,7 @@ class SGFNode:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def next_player(self):
|
def next_player(self):
|
||||||
if "B" in self.properties or "AB" in self.properties: # root or black moved
|
if "B" in self.properties or "AB" in self.properties: # root or black moved
|
||||||
return "W"
|
return "W"
|
||||||
else:
|
else:
|
||||||
return "B"
|
return "B"
|
||||||
@@ -222,7 +222,7 @@ class SGFNode:
|
|||||||
if "B" in self.properties or "AB" in self.properties:
|
if "B" in self.properties or "AB" in self.properties:
|
||||||
return "B"
|
return "B"
|
||||||
else:
|
else:
|
||||||
return "W" # nb root is considered white played if no handicap stones are placed
|
return "W" # nb root is considered white played if no handicap stones are placed
|
||||||
|
|
||||||
|
|
||||||
class SGF:
|
class SGF:
|
||||||
@@ -239,10 +239,10 @@ class SGF:
|
|||||||
if not encoding:
|
if not encoding:
|
||||||
match = re.search(rb"CA\[(.*?)\]", bin_contents)
|
match = re.search(rb"CA\[(.*?)\]", bin_contents)
|
||||||
if match:
|
if match:
|
||||||
encoding = match[1].decode("ascii")
|
encoding = match[1].decode("ascii", errors="ignore")
|
||||||
else:
|
else:
|
||||||
encoding = "ISO-8859-1" # default
|
encoding = "ISO-8859-1" # default
|
||||||
decoded = bin_contents.decode(encoding=encoding)
|
decoded = bin_contents.decode(encoding=encoding, errors="ignore")
|
||||||
return cls.parse(decoded)
|
return cls.parse(decoded)
|
||||||
|
|
||||||
def __init__(self, contents):
|
def __init__(self, contents):
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ class ConfigPopup(QuickConfigGui):
|
|||||||
if not old_proc:
|
if not old_proc:
|
||||||
self.katrain.game.analyze_all_nodes() # old engine was broken, so make sure we redo any failures
|
self.katrain.game.analyze_all_nodes() # old engine was broken, so make sure we redo any failures
|
||||||
self.katrain.update_state()
|
self.katrain.update_state()
|
||||||
|
|
||||||
Clock.schedule_once(restart_engine, 0)
|
Clock.schedule_once(restart_engine, 0)
|
||||||
|
|
||||||
self.katrain.debug_level = self.config["debug"]["level"]
|
self.katrain.debug_level = self.config["debug"]["level"]
|
||||||
|
|||||||
-42
@@ -1,42 +0,0 @@
|
|||||||
# This is a stand-alone script that generates a review for an SGF
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
|
|
||||||
from core.common import OUTPUT_INFO
|
|
||||||
from core.engine import KataGoEngine
|
|
||||||
from core.game import Game, KaTrainSGF
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
exit(1)
|
|
||||||
inputfile = sys.argv[1]
|
|
||||||
|
|
||||||
with open("config.json") as f:
|
|
||||||
settings = json.load(f)
|
|
||||||
sgf_settings = settings["sgf"]
|
|
||||||
engine_settings = settings["engine"]
|
|
||||||
game_settings = settings["game"]
|
|
||||||
trainer_settings = settings["trainer"]
|
|
||||||
|
|
||||||
#engine_settings['threads'] = 32
|
|
||||||
engine_settings["max_time"] = 1000
|
|
||||||
|
|
||||||
class Logger:
|
|
||||||
def log(self, msg, level):
|
|
||||||
if level <= OUTPUT_INFO:
|
|
||||||
print(msg)
|
|
||||||
|
|
||||||
|
|
||||||
logger = Logger()
|
|
||||||
|
|
||||||
engine = KataGoEngine(logger, engine_settings)
|
|
||||||
move_tree = KaTrainSGF.parse_file(inputfile)
|
|
||||||
game = Game(logger, engine, game_settings, move_tree=None, analyze_fast=True)
|
|
||||||
game.root=move_tree
|
|
||||||
reverse_nodes = game.root.nodes_in_tree[::-1]
|
|
||||||
|
|
||||||
for n in reverse_nodes[::10]:
|
|
||||||
n.analyze(engine=engine)
|
|
||||||
while not n.analysis_ready:
|
|
||||||
time.sleep(0.01)
|
|
||||||
print(n.single_move,'done')
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# This is a stand-alone script that generates a review for an SGF
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
|
|
||||||
from core.common import OUTPUT_INFO
|
|
||||||
from core.engine import KataGoEngine
|
|
||||||
from core.game import Game, KaTrainSGF
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
exit(1)
|
|
||||||
inputfile = sys.argv[1]
|
|
||||||
|
|
||||||
with open("config.json") as f:
|
|
||||||
settings = json.load(f)
|
|
||||||
sgf_settings = settings["sgf"]
|
|
||||||
engine_settings = settings["engine"]
|
|
||||||
game_settings = settings["game"]
|
|
||||||
trainer_settings = settings["trainer"]
|
|
||||||
|
|
||||||
engine_settings['threads'] = 16
|
|
||||||
#engine_settings['katago'] = 'KataGo/katago-bs'
|
|
||||||
engine_settings["max_time"] = 1000
|
|
||||||
engine_settings["max_visits"] = 50
|
|
||||||
|
|
||||||
class Logger:
|
|
||||||
def log(self, msg, level):
|
|
||||||
if level <= OUTPUT_INFO:
|
|
||||||
print(msg)
|
|
||||||
|
|
||||||
|
|
||||||
logger = Logger()
|
|
||||||
|
|
||||||
engine = KataGoEngine(logger, engine_settings)
|
|
||||||
move_tree = KaTrainSGF.parse_file(inputfile)
|
|
||||||
game = Game(logger, engine, game_settings, move_tree=move_tree, analyze_fast=False)
|
|
||||||
nodes = game.root.nodes_in_tree
|
|
||||||
remaining = len(nodes)
|
|
||||||
while remaining > 0:
|
|
||||||
remaining = sum(not n.analysis_ready for n in nodes)
|
|
||||||
print(f"Waiting for {remaining} queries")
|
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
msg = game.write_sgf(
|
|
||||||
sgf_settings["sgf_save"],
|
|
||||||
trainer_config=trainer_settings,
|
|
||||||
save_feedback=sgf_settings["save_feedback"],
|
|
||||||
eval_thresholds=trainer_settings["eval_thresholds"],
|
|
||||||
)
|
|
||||||
Reference in new issue
Block a user