Page 1 of 2

Python version of CGOS by Zakki

Posted: Thu Dec 29, 2022 3:40 pm
by Rémi Coulom

Re: Python version of CGOS by Zakki

Posted: Fri Jan 13, 2023 5:30 pm
by zakki
Now I'm trying lz-genmove_analyze and lizzie style extension at CGOS server.
https://github.com/zakki/cgos/tree/genmove_analyze
https://twitter.com/k_matsuzaki/status/ ... 1746693120

If engine supports "kata-genmove_analyze" or "lz-genmove_analyze", clinet-python sends pv and winrates to server.
I think we need to define a subset of them, both to limit network traffic and to simplify the implementation.

Re: Python version of CGOS by Zakki

Posted: Fri Jan 13, 2023 6:25 pm
by Rémi Coulom
Hi,

Great to have you here. Welcome to the forum!

It is really great to be able to visualize evaluation plots from CGOS. What are the specs of those gtp extensions so that I can implement it in my program?

Rémi

Re: Python version of CGOS by Zakki

Posted: Sat Jan 14, 2023 8:59 am
by zakki
Current implementation uses LeelaZero's lz-genmove_analyze and KataGo's kata-genmove_analyze specification, and wgo viewer uses 'move', 'winrate', 'pv' and 'ownership' attributes.

https://github.com/zakki/cgos/wiki/GTP- ... -expansion

Re: Python version of CGOS by Zakki

Posted: Mon Jan 23, 2023 7:08 am
by Hiroshi Yamashita
Current test CGOS server is running.
http://203.138.189.63/cgos/19x19/standings.html
you can see ownership by selecting left top menu "CGOS mode".
http://203.138.189.63/cgos/viewer.cgi?1 ... /23/13.sgf
You can also see multiple candidates move's pv by focusing mouse on stones which are printed winrate and score.

Any comment is welcome!

https://github.com/zakki/cgos/tree/genmove_analyze
https://github.com/zakki/cgos/wiki/GTP- ... -extension

example of genmove. (without ownership)
cgos-genmove_analyze w
=
{"moves": [{"move": "O15", "winrate": 0.135, "score": -11.21, "pv": "O15 P17 O18 N17 O8 P6 N7 Q7 O6 P5"}]}
play O15

How to connect:
https://github.com/zakki/cgos/tree/genm ... python/src
All 5 *.py on src directory, and write sample.cfg, and make sgf directory, and run this.
$ python3 ../src/cgosclient.py sample.cfg

$ cat sample.cfg
Common:
KillFile = abort.txt
GTPEngine:
Name = dummy_name
CommandLine = ../../katago_1.12.1/cpp/katago gtp -model ../../kata_dist/b18c384nbt-uec.bin.gz -config ../../katago_1.12.1/gtp_v50.cfg
ServerHost = 203.138.189.63
ServerPort = 6819
ServerUser = kata1_b18_uec_v50
ServerPassword = yoursecret
NumberOfGames = 5
SGFDirectory = sgf

Re: Python version of CGOS by Zakki

Posted: Tue Jan 24, 2023 11:41 pm
by Rémi Coulom
Great job!

Strangely, I could not see any data from the sgf you linked. But I could on this one:
http://203.138.189.63/cgos/viewer.cgi?1 ... 24/207.sgf

It is difficult to guess the meaning of the plot. Which color is which player?

I am a bit busy now, but I plan to implement the gtp extension in Crazy Stone soon, and connect to the server.

Rémi

Re: Python version of CGOS by Zakki

Posted: Thu Jan 26, 2023 7:26 pm
by Rémi Coulom
Hi,

So I made a first try today. This is the game it produced:
http://203.138.189.63/cgos/viewer.cgi?1 ... 26/425.sgf

It is a bit strange, because in order to produce a plot, I have to go to the end of the game, and undo moves one by one. Otherwise, nothing is displayed.

I started the game with the wrong version of the client (from trunk). In the middle of the game, I stopped the client and upgraded to the good branch. I am using cgos-genmove_analyze to send data. The data I sent is wrong, because the engine automatically starts pondering after generating a move, and the json was from the root of the pondering tree, not the tree that produced the move. I will fix this tomorrow.

One question: what is the difference between "Name" and "ServerUser" in the cfg file?

Rémi

Re: Python version of CGOS by Zakki

Posted: Thu Jan 26, 2023 7:33 pm
by Rémi Coulom
Another remark: do you plot the win rate of the most visited move? Instead of plotting the win_rate and score of a single move, it would seem better to provide the win_rate and score (and visit count) at the root.

Re: Python version of CGOS by Zakki

Posted: Fri Jan 27, 2023 5:29 am
by zakki
Rémi Coulom wrote: Thu Jan 26, 2023 7:26 pm It is a bit strange, because in order to produce a plot, I have to go to the end of the game, and undo moves one by one. Otherwise, nothing is displayed.
Enable "CGOS mode" in "≡" menu. When CGOS mode is off, plot seems something wrong, I'll fix it later.
Rémi Coulom wrote: Thu Jan 26, 2023 7:26 pm One question: what is the difference between "Name" and "ServerUser" in the cfg file?
"Name" is used for local logging, and "ServerUser" is used for server login.
Rémi Coulom wrote: Thu Jan 26, 2023 7:33 pm Another remark: do you plot the win rate of the most visited move? Instead of plotting the win_rate and score of a single move, it would seem better to provide the win_rate and score (and visit count) at the root.
It seems good idea.
Lizzie aggregates all hands and uses a weighted average winning percentage.
I would consider adding winrate and score to root element and adding a converter to client-python for lz-genmove_analyze and kata-genmove_analyze.

Re: Python version of CGOS by Zakki

Posted: Sun Jan 29, 2023 12:48 am
by Rémi Coulom
Hi,

I fixed my bug: I was sending a multi-line json. Only the closing "}" was sent as analysis. That may have been a source of problems on your side. It may be worth documenting that the json must be on a single line.

I now send a single json line without spaces. It seems to be working better. I'll let it play a few games.

I may implement ownership later.

Rémi