An example of an environment for machine learning programmed with Rust and using different languages to interact with the environment.
- WebAssembly & Tensorflow.js:
- Live example: https://holli.github.io/rusted_cart_pole/
- www/index.js
- Python & Pytorch: examples/python_pytorch.py
- git clone [email protected]:holli/rusted_cart_pole.git
- cargo build
- to run the game environment in Rust without any machine learning
- cargo run --bin game
The implemention of the cart pole is mostly copied from OpenAi Gym. Although in this implementation you are able to do nothing so that it's more intuitive to make an interface for humans. Graphics are drawn using Plotters which has backends to be used natively or in web assembly.
For ffi example to be used in e.g. Python check out src/ffi_lib.rs and the Python example. Good general resources on how to expose FFI from the Rust library #1 or #2. Wasm related infos can be found from the (live example)[https://holli.github.io/rusted_cart_pole/].