This repository contains ONNX-converted versions of
KataGo neural network models for the game of Go (Baduk/Weiqi).
These models power the
Kaya app, a web-based Go application with AI-powered game analysis and move suggestions.
These models are converted from the official KataGo PyTorch checkpoints to ONNX format for use in web-based and cross-platform applications.
1import onnxruntime as ort
2import numpy as np
3
4# Load the model (use .fp32.onnx for browser/WASM, .fp16.onnx for native apps)
5session = ort.InferenceSession("kata1-b28c512nbt-adam-s11165M-d5387M.fp32.onnx")
6
7# Prepare inputs (batch_size, channels, height, width)
8bin_input = np.random.randn(1, 22, 19, 19).astype(np.float32)
9global_input = np.random.randn(1, 19).astype(np.float32)
10
11# Run inference
12outputs = session.run(None, {
13 "bin_input": bin_input,
14 "global_input": global_input
15})
16
17policy, value, miscvalue, moremiscvalue, ownership, scoring, futurepos, seki, scorebelief = outputs
1import * as ort from "onnxruntime-web";
2
3// Use .fp32.onnx for WASM backend, or .uint8.onnx for smaller download size
4const session = await ort.InferenceSession.create(
5 "kata1-b28c512nbt-adam-s11165M-d5387M.fp32.onnx"
6);
7
8const binInput = new ort.Tensor(
9 "float32",
10 new Float32Array(1 * 22 * 19 * 19),
11 [1, 22, 19, 19]
12);
13const globalInput = new ort.Tensor(
14 "float32",
15 new Float32Array(1 * 19),
16 [1, 19]
17);
18
19const results = await session.run({
20 bin_input: binInput,
21 global_input: globalInput,
22});
These models are derived from the
KataGo project by David J. Wu (lightvector).
The original KataGo neural network weights are released under the
MIT License.
This ONNX conversion and the associated tooling are also released under the MIT License.
1@article{wu2019accelerating,
2 title={Accelerating Self-Play Learning in Go},
3 author={Wu, David J.},
4 journal={arXiv preprint arXiv:1902.10565},
5 year={2019}
6}