fsparv / leelawatcher Goto Github PK
View Code? Open in Web Editor NEWA GUI for watching Leela Zero self train
License: Apache License 2.0
A GUI for watching Leela Zero self train
License: Apache License 2.0
Can we get an update for the most recent Leela releases? I understand it's just a simple Regex change (there is already a pull for this). I tried changing the jar manually on my end, but failed completely. Can @fsparv make this quick change if he has any spare time? Thanks!
Though I didn't capture one at the time, a couple times I saw swing exceptions (usually relating to the scroll pane) probably caused by my modifications of the UI from a non-swing thread.
From what I can see, leela-zero could always output "resign" as a move. But looking at Pattern MOVE, that was never understood as a legal move by LeelaWatcher.
Probably, the earlier networks were not prone to resigning, but now they are, which leads to:
255 (resign) Move:resign
oh noes!!!
java.lang.RuntimeException: BAD MOVE: resign
at leelawatcher.parser.AutoGtpOutputParser.parseMove(AutoGtpOutputParser.java:129)
at leelawatcher.parser.AutoGtpOutputParser.lambda$start$0(AutoGtpOutputParser.java:90)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Resignation was recently turned on and LeelaWatcher crashes on it.
How do we watch training games in LeelaWatcher, when LeelaZero self-train on Google Colaboratory?
leelawatcher can't display game after leela zero Latest commit fc83ec7
It seems Leela zero problem.
It seems there are still holes in game logic. I think the problems reported in #4 and #9 were closed too soon (assuming because of the fix suggested in #5 and thus writing this here again) as I have managed to pinpoint the source of #9:
LeelaWatcher doesn't even get to capture logic in the problem mentioned there, which is why the fix won't affect it.
The problem is that isLegalMove() returns false on moves which are legal in all rule systems, before any such logic is reached.
Example cases found:
(To stick to the issue and not get sidetracked, I have constrained myself to look ONLY at the first occurrence of the problem encountered in a game, as further strange artifacts encountered with illegal moves could be an entirely different issue)
example 1:
WatcherOutput1.zip
2nd-262-2017-11-29T13_59_20.908Z.sgf.zip
Move 261 is Black's A10. The next move received, as is seen in WatcherOutput1, is white's S12, which is, while a horrible move, legal in any rule system.
example2:
WatcherOutput2.zip
1st-419-2017-11-29T13_54_19.179Z.sgf.zip
Move 418 is white's Q16, and the next move received is black's m1, which isLegalMove() says is illegal, and therefore is skipped, despite it being a perfectly legal move.
I do realize the very next move placed by LeelaWatcher in the SGF betrays another potential bug, but it's not healthy to consider multiple issues in 1 place...
Not only does the code never get to capture logic at all, but, as example 1 shows, it sometimes isn't even related to it. I will try to pinpoint it further by testing those exact positions on the legality functions when I have the time.
leela-zero/leela-zero#1535 (comment) mentions that q+Enter stops AutoGTP, saving the data for the next time AutoGTP is run.
When LeelaWatcher is closed, q+Enter should be sent to the autogtp process.
Currently, when LeelaWatcher is run after AutoGTP saved training and game data, AutoGTP correctly finishes the game, yet LeelaWatcher does not show the game in progress, which should also be fixed.
Recently I ran into a case where I only seemed to be able to create one SGF file at a time. Multiple processes appeared to overwrite the same file with a new name. This of course is impossible and much head scratching ensued. Eventually I realized that autogtp is gratuitously doing the equivalent of rm -f *.sgf after it sends every file to clear out the file it creates for sending to the server, which also clears out the files previously written by LeelaWatcher. So in case others stumble onto the same perplexing situation I'll document here that the "fix" is to not run LeelaWatcher from the autogtp directory.
I can run autogtp 11 with leelawatcher, but the moves don't show, same as #19
BTW this works: C:\Users...\Downloads\LeelaZero>java -jar ../LeelaWatcher-1.0.2.jar . autogtp.exe , but somehow this fails, why?
C:\Users...\Downloads>java -jar LeelaWatcher-1.0.2.jar C:\Users...\Downl
oads\leelazero autogtp.exe
java.io.IOException: Cannot run program "autogtp.exe" (in directory "C:\Users...\Downloads\leelazero"): CreateProcess error=2, The system cannot find the fi
le specified
at java.lang.ProcessBuilder.start(Unknown Source)
at leelawatcher.gui.LeelaWatcher.lambda$main$1(LeelaWatcher.java:70)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP
rivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find th
e file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 16 more
Although LeelaWatcher can run with autogtp_next, no stones are displayed on the board as moves are generated.
Hi, stone's aren't appearing on the board with the latest version (0.11) of Leela Zero.
I'm running LeelaWatcher with the usual cmd line:
java -jar LeelaWatcher-1.0.2.jar . autogtp.exe
There is a comment in the Move class that reads:
This class is due for a refactoring, it does too much. It * should be divided into a MoveNode, a SetupNode and a RootNode which inherit * from an AbstractNode. This will also bring the object model in closer * correspondence with the structure of an SGF file.
There will also be a need to write a GameInfo class and provide a place
I run the program with following command
D:\leelaz5>type run.bat
@echo off
autogtp -k sga
D:\leelaz5>start javaw -jar LeelaWatcher-1.0.jar . run.bat
or
D:\leelaz5>javaw -jar LeelaWatcher-1.0.jar . run.bat
If I close the gui by click the [x] button, then the leelaz still run in background, I have to finish the process with taskmgr
I can see games when running
java -jar LeelaWatcher-1.1.0.jar . autogtp.exe
with version 0.16 of leela-zero, but it does not work when using 0.17 of leela-zero.
It's possible that the format of the moves has changed again. I recall a similar problem with an earlier release.
9 lines can be replaced with 1 using toUppercase instead of all the permutations. I'll make a PR.
I found a surprisingly commonly occurring problem when using LeelaWatcher.
Many moves that the watcher correctly read from autogtp/Leela zero (and shown it read them) are completely skipped in the SGF, creating a completely false representation of the game.
An example:
Here's the SGF Leela was showing and writing during play:
http://eidogo.com/#1cWKYlvGj
Suspicious-game-2017-11-27T20_58_38.724Z.sgf.zip
Here's the program's output:
Suspicious game.zip
Initially I thought it was a problem with legal/Illegal moves, as near the end of the game MANY illegal moves were skipped; However, going over the game from move 1, the first omission, on move 326 in the program's output, shows a completely legal move (actually 4 in a row) not being added to the SGF.
Looking ahead, it seems it happened dozens of times during the game, often with an odd number of moves, so eventually a black move was placed as a white move etc.
This turned more of the moves later in the game to illegal ones.
Stones that were captured by white in the actual moves Leela was giving were connected by black in this
sgf/LeelaWatcher view, and later Leela tried to play in the open spaces created where the captured stones were, which was, of course, illegal, etc.
The problem doesn't seem to be a rare one and I have noticed it in several games.
I cant find the .jar file and dont know what your talking about when you ask to change the binary file name to the one supplied. when i try to enter in the supplied command into my command line after changing to the proper directory it only tells me that the associated jar file cannot be run.
TL/DR: I need a "for dummies" explanation of how to get this to run properly on windows.
also, as a side note; a more user friendly version overall of this program may do wonders for getting people to contribute to the Leela Zero project. Perhaps a version that runs as a simple screen saver.
The UI suddenly stopped but the game kept going, later comparing the sgf with the stuck game I found out that something along the way had gone wrong because the game was never in a state the UI suggested. I attached them so you can debug what went wrong.
These are just some features that would make watching a lot more enjoyable.
(In addition to board coordinates and last played indicators from #2)
I will look through your code and try to make a PR, but I also wanted to write down the list first, so others can help as well.
What do you think?
also result is missing.
This is minor, but I noticed a couple of deprecation warnings when I built using "./gradlew build".
A problem was found with the configuration of task ':shadowJar'. Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated and is scheduled to be removed in Gradle 5.0.
- No value has been specified for property 'mainClassName'.
The SimpleWorkResult type has been deprecated and is scheduled to be removed in Gradle 5.0. Please use WorkResults.didWork() instead.
:startShadowScripts
Using TaskInputs.file() with something that doesn't resolve to a File object has been deprecated and is scheduled to be removed in Gradle 5.0. Use TaskInputs.files() instead.
Leela: loadsgf test.sgf
? cannot load file
In other entirely NOT shocking news, the code I wrote 15 years ago when I was first learning java seems to have a memory leak...
51 (A3) Move:A3
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x000000079b500000, 572522496, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 572522496 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /home/gus/leelaz/leela-zero/hs_err_pid89296.log
error message is following.
Game data 28f32483346bf8881e99eebc9fdcf122a334486f5053dfdd3300521e7b98fa70 stored in database
3 game(s) played in 1127 minutes = 22552 seconds/game, last game took 53497 seconds.
Best network hash: 1ac2638de9d4d3f9eef43f2afb6b1b4c090a7c350fde4d2d77e00e39eba6fde0
Required client version: 2 (OK)
Already downloaded network.
Engine has started.
Infinite thinking time set.Couldn't save game:java.io.IOException: Incorrect filename, directory name, or volume。
1 (L9)
New Game Started!
Move:L9
the version 1.0.1 can automatic save sgf now.
but I found the format is diff that of leela zero.
for example here the pass step is wroted to W[ ],not W[tt]
There seems to be quite a bit of code that might have been added for some other project, but it not needed for LeelaWatcher. I plan to remove it to simplify what is there.
It would be nice to fix some of the warnings and add some tests as well.
There are a few things about the MarkablePosition class that I think can be improved. Some are very minor.
I'll make the changes in a PR and you can decide if you want to merge them.
In autogtp v6 leela sometimes resigns, which is not handled by the parser and causes a crash.
help for understand very long time games
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.