K-Infer
Inference library for running models
kinfer
is a package for doing inference on K-Scale models, by providing a standard interface for trained policies. This lets you take a trained policy, compile it to a kinfer
model binary, and run the same binary in simulation and on a real robot.
Each kinfer
model has three parts:
- An
init
function, which initializes the model carry - A
step
function, which processes one computation step - Some additional
metadata
telling downstream implementations how to use the model input and outputs
The control loop for a kinfer
model can be thought of as follows:
carry = init() # Onnx graph
while True:
model_input = get_model_input() # Implemented by provider
model_output, carry = step(model_input, carry) # Onnx graph
do_model_output(model_output) # Implemented by provider
sleep()
This provides a common interface for running models in simulation and on the real robot, making sim2real transfer straightforward.
Updated 6 days ago