-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android binary #321
Comments
this will be a great feature for the phone. |
ahq weiqi pro includes it. http://www.flygo.net/bbs/forum.php?mod=viewthread&tid=112497&extra=page%3D1&mobile=2 |
@l1t1 I seem to have the wrong site. do you have another link? is this program paid? |
@cryptpark |
@portkata could you please describe what do you mean by the "calibrated ai equation"? FYI after I posted this, somebody on reddit pointed the aki65 stuff to me and I manage to reverse engineer the binary out of it. It's still not great as the guy did not put the scripts online, just the resulting APK and he or she might not build a newer version. Not having an official build is a big miss IMHO. I am planning to include the AI into the free app OnlineGo (https://play.google.com/store/apps/details?id=io.zenandroid.onlinego&hl=en). I have solved most technical problems I think, I just need to tweak some things so that it doesn't beat us mere mortals too badly :) |
@acristescu Thank you for your work :) |
link to download http://aqgo.ezandroid.cn/AQGoPro_1.3.0_2020-09-27.apk |
What?!?! $15 for just integrating the hard work of other people into an android app? That is highway robbery... Now I feel like a schmuck for giving the app for free :) As for Katrain, yes, I am aware of that (see for example this reddit thread in which both me and @sanderland are discussing it). Thank you for pointing out the equation in the Katrain code, I'm going to give it a honest go at implementing it in the app, but @sanderland put a lot of work and thought into this I'm pretty sure I will not be able to do nearly as good a job as him/her. Perhaps @sanderland could be persuaded to contribute that aspect to my open-source app once I manage to get the integration going? :) |
@acristescu wait until you see things like this - when you pick a license you know what people can do with it, and I can't get worked up about it. |
@sanderland would it be very difficult for you to write the code for the calibrated ai in @acristescu's apk if he does the gui and katago implementation? Thanks for the time. |
That would be awesome, otherwise I'll have to "git gud" at magic such as this:
|
well if you ignore the name of the function, which is |
Maybe the calibrated ai was too much to ask. Does this zip file have all the files necessary to run katago in android in the command line? https://drive.google.com/file/d/12QNGdFx0e0GHfpzB6GFWcsHoq1TRJklg/view?usp=drivesdk |
@portkata all that you need is available in the APKs you've initially posted ( https://github.com/aki65/aki65.github.io/releases ). You just have to unzip the APK, then locate a file called That being said, I still think the initial request of this issue is a valid one: a katago binary that I don't have to basically steal from somebody that is ripping people off with $15 price tags would be great (but beyond my skill). |
(edited) Thanks for all the detailed replies and hard work towards this. Sorry, probably stupid, but just one last question. So if I'm understanding correctly the 3 files in the zip file attached below |
I'm not sure where that zip file is coming from, but the binary in the aki65 repository above does not need any |
Maybe @lightvector can ask akigo how he compiled the android binary? Akigo is fluent in English. Then if lightvector puts it on his github page, the community can update it if needed in the future if the run restarts. edit: wow, there is a new update by akigo to badukai with the calibrated ai included. You guys are geniuses. His calibrated rank is based on Sanderland's algorithm but better in that he somehow gets in to go all the way up to 9d. I'm guessing you have to use the 15b net? He must have found a way to use multiple playouts as well. His program has definitely moved the katago project forward in a great way. |
From issue #74 in KaTrain it seemed to me, that the calibration was recently adapted to 20b, but I may be wrong. Surely, @sanderland can clarify here. And no, I did not change anything from KaTrain's algorithm. I just allowed entering up to 9-dan for experimental purposes to see how the formulas behave when the rank is extended beyond 4-dan. Should I cut this off ? |
Hi @aki65 and welcome to the party. I think the issue here is not with Sanderland's formula (although we got a bit side-tracked here), the request was to basically integrate whatever you did to create an android binary into the main release so that there is an official android binary. Is that something that can be achieved? |
@akigo I had the impression it was based on the 20b too, but he said 15b when asked a couple days ago on reddit, so not 100% sure. Either will give you good results. The policy network at full strength is roughly 4 dan or so, so higher numbers, won't do much, as the algorithm is meant to weaken the policy. A better thing would be to set all the integers above his highest "kyu-rank" value to not use the algorithm but instead run katago using only 1 thread and x number for "maxPlayouts" in the config file instead of maxvisits. If it was me, I'd set it based on the 20b (which does work well with his algorithm as well) and do 6 playouts for the 4 dan equivalent kyu_rank, 8 for 5 dan, 10 for 6 dan, 12 for 7 dan, 14 for 8 dan, and 16 for 9 dan. Using 1 thread only and maxPlayouts ensures the same strength on any hardware. I know 1 thread 16 playouts can easily beat the gtp4zen 9d zen7 setting. Thanks to everyone for all these great projects, it's so exciting! Lastly if it is too much work to alter the kyu_rank but you still want to change it to include the high dan ranks, a simpler adjustment might be to just add 3 boxes to adjust maxPlayouts, maxVisits, and numSearchThreads. That would give the end user very precise control of high dan strength. Or if there is a way to place the config file in a location where that the user has access to it would accomplish the same thing. |
it's still on 15b since that's the default, but the strengths are approximate anyway and they don't differ that much between 15b and 20b due to the weirdness of the algorithm.
It doesn't make much sense, as it converges to pure policy-based play for strength to infinity, which is around ogs 5 dan. At these levels the lack of reading becomes clearer as well, and players get a bit annoyed at how the AI seems to die. I'm working on some new ais which may fill this gap as well (see https://online-go.com/player/767655/ and #322) |
Since we're on the subject, which net should I bake into the app? So far I've been using the 10b one (g170e-b10c128-s1141046784-d204142634.bin) and it's reasonably fast, however it seems to me weaker than LeelaZero (15b-270 0c4ade) running on the same phone. It's kinda hard to say since I am about 10k and both of them beat me to a pulp, but Kata does make some weird moves such as putting both his first two moves in the same corner to enclose instead of grabbing an empty one. So the bottom line is, which net should I choose, keeping in mind that APK size is a concern (these nets are bigger than my entire APK!!!)? |
The 6b and 10b are really stepping stones in early phase training and not so suitable to distribute, the 15b went a lot longer, and the 20b/30b/40b to the end. |
Thank you, 15b it is... Is there a way to force kata to accept a model file that is not ending with .gz? The way Android resources are packed in an APK destroys archives, and kata is just throwing a fit if I rename the file:
|
would it be possible for you to be able to package the .gz net file as contained in a folder inside of an archive with an extension you change to .mp3, then have the .mp3 file extension be changed and unpacked upon installation of the apk? Like private.mp3? May be a crazy idea... |
I don't have write permissions in that folder so I can't rename it (crazy Android 10 restrictions). I can copy them manually to another temp folder under the right name if they don't already exist... That's the workaround I'm doing right now, but it's a hassle, I was hoping there's a |
@acristescu : there is not, since it needs the extension to figure out what to do with the file. See desc.cpp |
@acristescu Take a look at the code starting at that line and below. KataGo uses the extension to figure out whether it should try to load the file as compressed or uncompressed, and what format it is, because there are multiple possible formats that it tries to accept, for legacy reasons. As Sander said, if you're already compiling it yourself, a quick workaround would just be to edit the code here a little to just make it so that the extension that you want to use falls into the proper case instead of hitting the |
I think so, but there is still work to be done. Keep in mind that my goal was just to create a working binary within my personal development environment in order to get BadukAI up and running. Therefore I had no qualms to spread machine-dependent settings and paths all over my scripts. This has to be factored out as far as possible before sharing them makes any sense. Furthermore, I just made every code syntax change in KataGo that was necessary to make the android cross-compiler happy. Some of these changes will probably break builds for other platforms. So I have to refine this (probably using some #ifdef directives) before the code changes can be merged into the KataGo repository. |
Is there a new version of the android binary please? I spent way too much time figuring out that the parameter _Edit: sorry, found it, I was confusing lightvector with aki65 and looking for the release in the wrong place 🤦♂️ _ |
unclear. if unpack the apk, then unpack "private.mp3", like a zip, there is a part of the code that completely coincides with the official network g170e-b20c256x2-s5303129600-d1228401921.bin.gz. (7ED1600h arm64-v8a-rel-0.21) |
The old network is still there, but now there's a new file called |
this is very interesting, but it doesn't work for me v64. so is there a new network or not? or is it not clear? |
only @aki65 can answer these questions for certain.
Do you mean LazyBaduk does not work for you or that you cannot run the new katago binary? I can't get it to work either... |
only 32bit version works on my devices. for some reason also on the nox emulator (probably there is no 64bit support, I will find out) |
do you mean "BadukAI"? and which network? Can this network be pulled out of the apk? how to find? |
the sizes of unpacked files "private" v17 and v18 - 198MB and 225MB. little space for another network |
imagine after distributed training when the 40b policy reaches 9 dan and he optimizes that network. The kyu rank mode will be awesome. turning on the opening book, they play well all the way down to kyu rank 10. they go up to kyu rank -8. Cryptpark has tested against crazystone zero, i think it can already beat the 7d setting? |
All of that is great, too bad is not open source so that other open source projects could use it... :| |
what are the meaning of these files in the apk
|
the 15b and 40b are for leela zero, they 20b is for the optimized katago, which is now faster than leela zero, setting numsearchthreads to 1. |
to summarize for this thread, aki65 said there should be no change in invoking katago to use the tensorflow optimized net. Can someone run the optimized net in android command line and confirm? This net is really great for calibrated ai because it is so much faster. One can run the kyu rank bots on very old mobile processors now with instant moves; together with his opening book for the first moves, the kyu rank bot plays great and fast from kyu rank 10 and stronger. |
I just tried by unzipping the files provided, using I have spent some 3 hours during the weekend trying every which way, with different versions of the libraries command lines, etc. The same method worked for the old katago, leela zero and SAI. I must be missing something... |
just saw the new icon in your app, it looks great! I still wish katago used half as many playouts though. or maybe have easy, medium and hard settings? Thanks for putting in all the time! |
Plan A was to put in a scaling mechanism as the one in katrain, but I just can't find the time for such an undertaking. Plan B was to basically have the app compute the number of playouts per second it gets and then scale the number of playouts for the next moves so as to keep the time per move to 1s on any device. This requires less development, but would make the AI be inconsistent. Plan C would be to at least temporarily have a global setting in the settings page where you can tweak this to your heart's desire. Might go with this in the next version. |
oh wow this is going to be great, thanks! |
aki65 added support for the new distributed kata1 weights on android. https://github.com/aki65/aki65.github.io/releases |
thanks |
aki65 released optimized s580 40b distributed training weight. It is extremely, extremely fast. https://github.com/aki65/aki65.github.io/releases/tag/v1.4.1 Imagine if in 2018, when Leela Zero was first starting, if someone would have told you that 3 years later there would be an app that was able to play from 10kyu - 9d on a $100 smartphone, making it's moves almost instantly. And it could play with variable komi and no ladder weaknesses. |
If we could also have that open-source, that would be a dream... |
Sorry to bother you all after so long! I'm an amateur in programming and I'm not sure whether this Issue is discussing a full apk or something that just works? Because I can't stand LeelaZero only can play Go games on a 19x19 board, which is too big on a phone screen. Today, I try to compile KataGo in Ubuntu in Termux on Android, it works and works fine, all you need to do is to read the guide here: |
I was able to compile for android with opencl support using my branch: now in the runtime when I try to use it, I get a crash during the tuning process: No existing tuning parameters found or parseable or valid at: /data/user/0/nl.jopdorp.opengoban/files/.katago/opencltuning/tune11_gpuMaliG710r0p0_x19_y19_c128_mv8.txt ...... Tuning hGemmWmma for convolutions |
@acristescu do you use OpenCL in the Sente app? If so how did you do the tuning, and would you have some tune files I could try? |
Now that we have a CPU-only version of the engine, would it be possible to add arm7 and/or arm64 to the compiled binary of the release? I couldn't get it going, but then I haven't compiled any C++ since I finished uni many years ago :) It should be possible though as there are several of these floating around for both Leela Zero and SAI (for example https://github.com/Grant-Tao/compiled-leelaz-0.17-for-android-phones and https://github.com/evdwerf/leela-zero/tree/android ).
The second repo above even has the modifications to the Makefile for Android (see this comparison leela-zero/leela-zero@next...evdwerf:android ).
Is that something that could be achieved?
The text was updated successfully, but these errors were encountered: