Life In 19x19 http://www.lifein19x19.com/ |
|
KaTrain Questions http://www.lifein19x19.com/viewtopic.php?f=18&t=19175 |
Page 3 of 3 |
Author: | kvasir [ Sat Jun 10, 2023 2:37 am ] |
Post subject: | Re: KaTrain Questions |
It works for me. If I wait long enough the message "GTP ready, beginning main protocol loop" is printed and I can type GTP commands and the response is quick. I'm sure I can set the shell to echo what I type to make it more convenient. However, you had this error message "ERROR: Unexpected exception Expecting value: line 1 column 1 (char 0) while processing KataGo output b'? unknown command'" which would indicate that you sent an unknown command. Maybe, at least in that one case you typed something that was not a command? There are other possibilities like for example character set mismatch but it seems less likely, but not impossible You can at least test if it works by typing something like this on the command line. It is more reliable than waiting for the prompt and typing when it presents itself. Code: echo name | .\katago-v1.13.1-trt8.5-cuda11.2-windows-x64\katago.exe gtp -model .\models\b18c384nbt-optimisticv13-s5971M.bin.gz -config .\kataecho name | .\katago-v1.13.1-trt8.5-cuda11.2-windows-x64\katago.exe gtp -model .\models\b18c384nbt-optimisticv13-s5971M.bin.gz -config .\katago-v1.13.1-trt8.5-cuda11.2-windows-x64\analysis_config.cfg Which should eventually output as follows (not so long anymore, now that I have 13.1 ). Code: KataGo v1.13.1 Using Japanese rules initially, unless GTP/GUI overrides this Initializing board with boardXSize 19 boardYSize 19 Loaded config .\katago-v1.13.1-trt8.5-cuda11.2-windows-x64\analysis_config.cfg Loaded model .\models\b18c384nbt-optimisticv13-s5971M.bin.gz Model name: kata1-b18c384nbt-softplusfixv13-s5971481344-d3261785976 GTP ready, beginning main protocol loop = KataGo If you get parsing errors then you need to make sure that your config file is correct (does it work with other commands) and that all paths are correct on the command line. If you get "command unknown" then KataGo and GTP are working but the command as transmitted was not found. If you can use this "echo <gtp-command> | katago.exe gtp ..." pattern then I think that can tell you more about what is going on. |
Author: | RobertJasiek [ Sat Jun 10, 2023 4:06 am ] |
Post subject: | Re: KaTrain Questions |
kvasir, exactly what works for you? At exactly which procedural step do you have to wait long enough? You seem to be using KataGo 1-13-1 TrensorRT while I have tried KataGo 1-13-0 OpenCl with KaTrain. I may try the echo chamber if I understand its syntax correctly. |
Author: | kvasir [ Sat Jun 10, 2023 5:04 am ] |
Post subject: | Re: KaTrain Questions |
Now, I am confused. I thought you had a problem using GTP with KataGo, that is what I was saying works and how you can test it. If you are having a problem using GTP with Katrain then that has a reason. Katrain doesn't use GTP. KataGo and Katrain don't communicate using GTP. You can configure the KataGo executable used by Katrain, including by giving a path to the executable file. You can also override the whole command used to start KataGo but this can easily fail if you don't know what Katrain wants and this is also not needed to change the executable used or the model file and config file. Since Katrain and KataGo don't communicate using GTP you wouldn't override the command with something like "katago.exe gtp ..." but with something else. I think something like: katago.exe analysis -model MMMM -config CCCC -analysis-threads XXXX -override-config "homeDataDir=DDDD" might be necessary since that is what Katrain uses if you don't try to override the command yourself. Basically, overriding the command is tricky and unnecessary. Maybe I still didn't understand what the problem was. I hope it is useful information that GTP has nothing to do with Katrain. |
Author: | RobertJasiek [ Sat Jun 10, 2023 5:52 am ] |
Post subject: | Re: KaTrain Questions |
That KaTrain does not communicate via GTP with KataGo is new to me. Does this mean for the Override command in KaTrain that it a) may never contain the GTP flag and b) may never contain -config referring to a gtp-version of a CFG file? I will try to understand your additional remarks later. Meanwhile, let me report on the echo tests below. Maybe this gives you a better idea of the problem or what is not the problem so that your suggestions on what to write in the KaTrain Override command can become more specific and then easier for me to understand. Below, I execute some commands in the Windows command line and state the outputs. ****************************************************** C:\echo is the KataGo OpenCL folder. Code: C:\echo>echo name | katago.exe gtp -model b18.bin.gz -config .\kataecho name | katago.exe gtp -model b18.bin.gz -config gtp_custom.cfg Code: C:\echo>katago.exe gtp -help Code: C:\echo>echo -h | katago.exe gtp -model b18.bin.gz -config .\kataecho -h | katago.exe gtp -model b18.bin.gz -config gtp_custom.cfg Code: C:\echo>echo -version | katago.exe gtp -model b18.bin.gz -config .\kataecho -version | katago.exe gtp -model b18.bin.gz -config gtp_custom.cfg |
Author: | kvasir [ Sat Jun 10, 2023 6:20 am ] |
Post subject: | Re: KaTrain Questions |
Sorry. I seem to have copied the command onto itself, probably right after I checked that it was correct. I always have trouble spotting mistakes in the edit window. I think it is that the small, old and unusual font is hard for me to read. Also the cursor in the edit window often vanishes. It was supposed to be like shown next and it is only a way to make sure that he right GTP command is sent to the katago program. Code: echo name | .\katago-v1.13.1-trt8.5-cuda11.2-windows-x64\katago.exe gtp -model .\models\b18c384nbt-optimisticv13-s5971M.bin.gz -config .\katago-v1.13.1-trt8.5-cuda11.2-windows-x64\analysis_config.cfg RobertJasiek wrote: Does this mean for the Override command in KaTrain that it a) may never contain the GTP flag and b) may never contain -config referring to a gtp-version of a CFG file? The override should be something like this if used: Code: katago.exe analysis -model MMMM -config CCCC -analysis-threads XXXX -override-config "homeDataDir=DDDD" a) If you override it then it has to use the "analysis" subcommand (not "gtp") and have the "-model" and "-config" flags but I don't know if "-analysis-threads" or the rest is necessary. b) Katrain looks for some configurations in the CFG file and reports errors if they are not there, or did so in older versions. I think this is the only limitation on the CFG file but they have to be acceptable to KataGo of course. |
Author: | RobertJasiek [ Sat Jun 10, 2023 6:47 am ] |
Post subject: | Re: KaTrain Questions |
That a command was copied on itself was my suspicion:) I will try your second echo syntax. Again, I will guess that "name" is a parameter, for which to insert one of KataGo's GTP commands. Quote: katago.exe analysis -model MMMM -config CCCC -analysis-threads XXXX -override-config "homeDataDir=DDDD" [...] I don't know if "-analysis-threads" or the rest is necessary. Assuming -analysis-threads XXXX -override-config "homeDataDir=DDDD" is partially or fully needed, can you please give an example for this command part? |
Author: | RobertJasiek [ Sat Jun 10, 2023 7:04 am ] |
Post subject: | Re: KaTrain Questions |
Each of the following commands creates the same output. Code: C:\echo>echo -h | katago.exe gtp -model b18.bin.gz -config gtp_custom.cfg C:\echo>echo -version | katago.exe gtp -model b18.bin.gz -config gtp_custom.cfg C:\echo>echo -model | katago.exe gtp -model b18.bin.gz -config gtp_custom.cfg C:\echo>echo -config | katago.exe gtp -model b18.bin.gz -config gtp_custom.cfg |
Author: | RobertJasiek [ Sat Jun 10, 2023 7:14 am ] |
Post subject: | Re: KaTrain Questions |
The following citation of katago analysis -help might help somebody: |
Author: | kvasir [ Sat Jun 10, 2023 7:40 am ] |
Post subject: | Re: KaTrain Questions |
RobertJasiek wrote: That a command was copied on itself was my suspicion:) I will try your second echo syntax. Again, I will guess that "name" is a parameter, for which to insert one of KataGo's GTP commands. "name" is a GTP command that outputs the name of the engine. "list_commands" is another one that outputs the list of commands. RobertJasiek wrote: Assuming -analysis-threads XXXX -override-config "homeDataDir=DDDD" is partially or fully needed, can you please give an example for this command part? From Task Manager (and I also tested it in the Katrain). Code: C:\Users\Thor\Desktop\katago\katago-v1.13.1-trt8.5-cuda11.2-windows-x64\katago.exe analysis -model C:\Users\Thor\Desktop\katago\models\b18c384nbt-optimisticv13-s5971M.bin.gz -config C:\Users\Thor\Desktop\katago\katago-v1.13.1-trt8.5-cuda11.2-windows-x64\analysis_config.cfg -analysis-threads 12 -override-config homeDataDir=C:\Users\Thor/.katrain For whatever reason '-analysis-threads' is 12, maybe this is a workaround in case 'numAnalysisThreads' is not in the CFG file. 'homeDataDir' is set to a directory that Katrain uses various data, I guess this is useful if you want different versions of KataGo to share things like TensorRT plan files and the results of OpenCL tuning. |
Author: | RobertJasiek [ Sat Jun 10, 2023 8:57 am ] |
Post subject: | Re: KaTrain Questions |
Do you think my second echo outputs indicate a working KataGo? list_commands: I see, will study that much later... From my current tests, it appears that KaTrain expects several parameters submitted by the referred CFG file or by additional command paramaters. The gtp_custom.cfg has too few of those parameters KaTrain expects so I have become creative and copied analysis_example.cfg to analysis_config.cfg then set the following Override command: C:\echo\katago.exe analysis -model C:\echo\b18.bin.gz -config C:\echo\analysis_config.cfg KataGo engine is ready. Processes: Playing. GPU load 97%. It works! Many thanks for enabling the start! So it seems KaTrain is not buggy after all but a description of the syntax in its manual is essential. Now, a fundamental problem remains: in the Windows command line, gtp_custom.cfg has been created for a purpose: better tuning of KataGo. So far instead only the renamed analysis_example.cfg works. Apparently, it will be necessary to merge both. Since the file is a) read by KaTrain and b) submitted as a parameter to KataGo when calling it, then this should achieve both: get KaTrain going and tuning KataGo. So tuning will be even more difficult. Besides getting the essential parameters right, one must also edit and merge both CFG files. Anyway, the main insight is: a GUI and KataGo communicate in one of a few possible different modes, among which there are gtp and analysis. Some GUIs run on gtp mode while other GUIs run on analysis mode. KaTrain uses the latter. How could earlier eager users of KaTrain figure out this without description in manuals? |
Author: | kvasir [ Sat Jun 10, 2023 10:06 am ] |
Post subject: | Re: KaTrain Questions |
RobertJasiek wrote: Do you think my second echo outputs indicate a working KataGo? Yes, the error is about the command being unknown. Prior to printing that error some information about loading the model and other things is printed in the output. I also saw that you managed to get it to play moves in KaTrain. RobertJasiek wrote: Now, a fundamental problem remains: in the Windows command line, gtp_custom.cfg has been created for a purpose: better tuning of KataGo. So far instead only the renamed analysis_example.cfg works. Apparently, it will be necessary to merge both. Since the file is a) read by KaTrain and b) submitted as a parameter to KataGo when calling it, then this should achieve both: get KaTrain going and tuning KataGo. So tuning will be even more difficult. Besides getting the essential parameters right, one must also edit and merge both CFG files. You can use 'katago.exe genconfig ...' to create a good config. It will ask some questions first and then run a benchmark to search for good parameters that affect performance. I guess you could run it like this to create a new config 'C:\echo\new_analysis_config.cfg'. I haven't tested this exact command line, but I think you can figure it out. Code: C:\echo\katago.exe genconfig -model C:\echo\b18.bin.gz -output C:\echo\new_analysis_config.cfg You will have to add 'nnMaxBatchSize = xx', where 'xx' is some number, to the config file or there will be an error when you start KaTrain. Maybe this is something that is unique to the TensorRT version, since it is really the only thing that is missing. I guess 'nnMaxBatchSize' can be same number as 'numSearchThreads' but it is not clear to me. In my case I see that KaTrain specifies '-analysis-threads 12' on the command line, my config has 'numSearchThreads = 64' but I don't really know if it matters if nnMaxBatchSize is any number between 12 and 12 * 64 (I don't think I will run out of memory). I have always just set it to be same as numSearchThreads. RobertJasiek wrote: How could earlier eager users of KaTrain figure out this without description in manuals? KaTrain comes with a working KataGo and you can download new versions in the program. You can also download different versions (OpenCL, Eigen, ...) but when it comes to CUDA and TensorRT they are not available in this way for Windows at least. For CUDA and TensorRT you have to install lot of libraries, like you have done, before they will run and there is no way around that. Still, the KataGo versions that you can download in KaTrain really work out of the box. I think the documentation for KataGo and KaTrain is actually surprisingly good. If you look for it then you can find many text files in the GitHub repositories, that are documentation about various things, and KaTrain even has a manual. |
Author: | RobertJasiek [ Sat Jun 10, 2023 10:38 am ] |
Post subject: | Re: KaTrain Questions |
kvasir wrote: KaTrain comes with a working KataGo and you can download new versions in the program. My use of programs differs from some of their programmers' directed intentions: I use go AI software offline for PC security reasons. I prefer to download files manually under a separate online Windows user account. Quote: I think the documentation for KataGo and KaTrain is actually surprisingly good. If you look for it then you can find many text files in the GitHub repositories, that are documentation about various things Oh. It seems I need to dig deeply. So far, I have mostly noticed the main manuals of every GitHub project, and those are totally missing relevant information. A few days ago, my opinion was that installing and using go AI well is 20 times as difficult as installing a large ordinary software suite. Meanwhile, I rather think it is 30 or 40 times as difficult. I know, there are the quick installers to get something running. However, it does not make sense to only get things running somehow when different KataGo versions and tuning affect speed apparently more than the difference between slowest and fastest GPUs of a generation. |
Author: | RobertJasiek [ Sun Jun 11, 2023 1:13 am ] |
Post subject: | Re: KaTrain Questions |
REFLECTION OF AN EARLY ATTEMPT Having revisted various information of this week, I notice that there was an early hint to a command line like this: Code: <path>\katago.exe analysis -model <path>\<model_name>.gz -config <path>\analysis_config.cfg -analysis-threads 12 -override-config homeDataDir=C:\Users\<username>/.katrain KaTrain reported errors. At that time, I lacked background knowledge to judge whether the errors were meaningful or, as suggested on KataGo's information page, the result of the GUI not knowing how to interpret KataGo's error messages. Meanwhile, I have got some background knowledge and find KaTrain's error messages useful if they are specific (a char(0) error still tells me nothing). At that time (and still now), the missing syntax description was (and remains) the major hurdle. At that time, I think there might have been two causes for the errors: 1) analysis_config.cfg might have been missing; 2) the parameter -analysis-threads 12 should not have been used if analysis_config.cfg existed with the number of threads already declared there. At that time, however, I knew nothing about possible causes for the errors. Instead, I had to guess causes. I thought: - I gave the parameter analysis a chance but since it failed, I should revert back to trying the paramter gtp according to KataGo's information page. - The parameter analysis seemed to be for also specifying an "analysis" type of config file, such as analysis_config.cfg. Since various sources of information suggested to specify gtp_custom.cfg, I thought that this would be more likely together with the allegedly expected gtp parameter. UNCLEAR SUCCESS OF COMMAND LINE Code: <path>\katago.exe analysis -model <path>\<model_name>.gz -config <path>\analysis_config.cfg -analysis-threads 12 -override-config homeDataDir=C:\Users\<username>/.katrain Whether this works seems to depend on whether -analysis-threads 12 is needed or number of threads already specified in analysis_config.cfg. It is unclear whether -override-config homeDataDir=C:\Users\<username>/.katrain is needed. SUCCESSFUL BUT COMPLICATED COMMAND LINE Instead of my earlier reported successful command line, the following is an alternative but complicated one and with an error the user must ignore: Code: <path>\katago.exe analysis -model <path>\<model_name>.bin.gz -config <path>\analysis_config.cfg -override-config homeDataDir=C:\Users\<user_name>\.katrain This lets KaTrain tune, then output this error: ERROR: ERROR: Could not find any configuration that worked Despite the error, then playing with GPU load 96% works. |
Author: | Gomoto [ Sun Jun 11, 2023 4:04 am ] |
Post subject: | Re: KaTrain Questions |
Isn't it possible that the system uses the existing configuration without overwriting it due to the error? |
Page 3 of 3 | All times are UTC - 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |