This document shows how you can install and start using Learn Kit in your projects.
Learn Kit is a fully standalone ML module for Godot Engine, requiring no external dependencies. You can use it either as a separate workspace for experiments or embed it directly into your own game/application.
- Godot Engine 4.x+ (requires Vulkan for compute shader support) (
4.6is recommended) - GPU with Vulkan‑compatible drivers
- Optional: Familiarity with GDScript and GLSL for extending networks or runners
- Clone/Download the Repository
git clone https://github.com/mkh-user/learn-kit.gitOr download repository from GitHub (https://github.com/mkh-user/learn-kit) and extract it.
- Open in Godot
- Launch Godot.
- If you want to use Learn Kit as a separate workspace for experiments:
- Click on Import.
- Navigate to project folder and select
project.godotfile.
- If you want to embed Learn Kit to an existing project:
- Copy
addons/folder of Learn Kit repository in your project root. - Open your project in Godot.
- Go to Project > Project Settings... > Plugins and enable LearnKit plugin.
- Copy
!!! note
Currently you can use all Learn Kit functionality without enabling it.
- Verify GPU Compatibility
- Ensure your GPU supports Vulkan and compute shaders.
- Verify these settings in Project > Project Settings... > General:
rendering/rendering_device/driver:vulkanfor all target platformsrendering/renderer/rendering_method:forward_plusfor main setting
- Usage
The framework is built for fast prototyping and easy integration. You can create networks, set up GPU runners, train models, and export/import them — all from GDScript with a very clean API.
var network := LearnKit.nn.network(
[4, 32, 16, 3], # Layers
null, # Use default forward pass runner
LearnKit.ActivationType.RELU, # Hidden activations
LearnKit.ActivationType.SOFTMAX, # Output activation
LearnKit.WeightInitialization.KAIMING # Weights init
)var trainer := LearnKit.nn.trainer(
network, # Network
null, # Use default backward pass runner
LearnKit.LossFunction.CCE, # Loss: Categorical Cross Entropy
1e-2, # LR
0, # l2 regularization lambda
300, # Num epochs
16, # Batch size
LearnKit.nn.schedular.cosine(1e-2, 300, 3e-4), # Schedular (start_lr, n_epochs, min_lr)
LearnKit.nn.optimizer(true, 1.0) # Grad clip optimizer
)
var split := LearnKit.data.train_test_split(inputs, targets, 0.2)
var time := trainer.train(split.train_inputs, split.train_targets)
var train_acc := LearnKit.evaluate.evaluate_model_soft_max(network, split.train_inputs, split.train_targets) * 100.0
var test_acc := LearnKit.evaluate.evaluate_model_soft_max(network, split.test_inputs, split.test_targets) * 100.0
print("Elapsed %d ms" % time)
print("Train acc: %f" % train_acc)
print("Test acc: %f" % test_acc)LearnKit.serialize.export(network, "user://model.json")network = LearnKit.serialize.import("user://model.json")
# Use network for inference...