A converter which converts a Leela Zero weight file to a .mlmodel(Core ML) file.
curl gunzip pyenv pipenv
You need to prepare two files on the Internet, one is a JSON file for information, the other is .mlmodel file. The below is an example using GX89 in Leela Master by 章鱼围棋(Octopus Go) & 袁泉(pangafu@github).
{
"url": "https://dl.dropboxusercontent.com/s/66xjj1uuk3yv8b7/LeelaMaster_GX89_fp16.mlmodel",
"size": 19,
"komi": 7.5,
"version": 1
}
The property "size" means board size, "komi" is target komi of the weight, "version" means Leela Zero weight format version, which is extended "3" for PhoenixGo (17 input planes), "4" for minigo (17 input planes, value for black).
See Usage to make .mlmodel file. About file name, the app shows the head part of file name of .mlmodel, which is from head upto before the second underscore "_". The example model is shown as "LeelaMaster_GX89". So please put user-recognizable name in the head part and detail info such as "_fp16" or hash in the rest part.
Put "https://dl.dropboxusercontent.com/s/4ue9d86yaglengl/LeelaMaster_GX89_fp16.json" into the URL field in setting model on the app and press enter key.
./make.sh <board size> <URL of weight>
An example for Leela Zero #221
./make.sh 19 https://zero.sjeng.org/networks/92f828bf13087837dfed4058df85afe634a028492e29418cbff41ab47023d42e.gz
Then please prepare JSON file according to the above information. You can download Leela Zero #221 as "https://dl.dropboxusercontent.com/s/i5zjw56v5i9vo21/LeelaZero_221_fp16.json"
- convert_coreml.py
- converts TensorFlow model to .mlmodel format
- convert_fp16.py
- converts .mlmodel to fp16 .mlmodel
- save_graph.py
- saves TensorFlow graph and checkpoint from Leela Zero text weight file
- Makefile
- process flow from downloading Leela Zero wight file to fp16 .mlmodel
GPL v3 or later. (same as Leela Zero project(https://github.com/leela-zero/leela-zero))