Show HN: Train and deploy your own open-source humanoid

5 days ago 1

You can use this repository as a GitHub template or as a Google Colab.

You can quickly try out the humanoid benchmark by running the training notebook in Google Colab.

  1. Read through the current leaderboard submissions and through the ksim examples
  2. Create a new repository from this template by clicking here
  3. Clone the new repository you create from this template:
git clone [email protected]:<YOUR USERNAME>/ksim-gym.git cd ksim-gym
  1. Create a new Python environment (we require Python 3.11 or later and recommend using conda)
  2. Install the package with its dependencies:
pip install -r requirements.txt pip install 'jax[cuda12]' # If using GPU machine, install JAX CUDA libraries python -c "import jax; print(jax.default_backend())" # Should print "gpu"
  1. Train a policy:
  • Your robot should be walking within ~80 training steps, which takes 30 minutes on an RTX 4090 GPU.
  • Training runs indefinitely, unless you set the max_steps argument. You can also use Ctrl+C to stop it.
  • Click on the TensorBoard link in the terminal to visualize the current run's training logs and videos.
  • List all the available arguments with python -m train --help.
# You can override default arguments like this python -m train max_steps=100
  1. To see the TensorBoard logs for all your runs:
tensorboard --logdir humanoid_walking_task
  1. To view your trained checkpoint in the interactive viewer:
  • Use the mouse to move the camera around
  • Hold Ctrl and double click to select a body on the robot, and then left or right click to apply forces to it.
python -m train run_mode=view load_from_ckpt_path=humanoid_walking_task/run_<number>/checkpoints/ckpt.bin
  1. Convert your trained checkpoint to a kinfer model, which can be deployed on a real robot:
python -m convert /path/to/ckpt.bin /path/to/model.kinfer
  1. Visualize the converted model in kinfer-sim:
kinfer-sim assets/model.kinfer kbot --start-height 1.2 --save-video video.mp4
  1. Commit the K-Infer model and the recorded video to this repository
  2. Push your code and model to your repository, and make sure the repository is public (you may need to use Git LFS)
  3. Write a message with a link to your repository on our Discord in the "【🧠】submissions" channel
  4. Wait for one of us to run it on the real robot - this should take about a day, but if we are dragging our feet, please message us on Discord
  5. Voila! Your name will now appear on our leaderboard

If you encounter issues, please consult the ksim documentation or reach out to us on Discord.

To see all the available command line arguments, use the command:

To visualize running your model without using kinfer-sim, use the command:

python -m train run_mode=view

To see an example of a locomotion task with more complex reward tuning, see our kbot-joystick task which was generated from this template. It also contains a pretrained checkpoint that you can initialize training from by running

python -m train load_from_ckpt_path=assets/ckpt.bin

You can also visualize the pre-trained model by combining these two commands:

python -m train load_from_ckpt_path=assets/ckpt.bin run_mode=view

If you want to use the Jupyter notebook and don't want to commit your training logs, we suggest using pre-commit to clean the notebook before committing:

pip install pre-commit pre-commit install
Read Entire Article