Skip to content

Commit

Permalink
Add google colab notebook (#7)
Browse files Browse the repository at this point in the history
* Update setup.py -- remove upper bound for python version requirement.

* Update .gitmodules - relative path for isaacgymenvs

* Update .gitmodules -- remove non-existing isaacgym submodule

* Revert "Update setup.py -- remove upper bound for python version requirement."

This reverts commit 91a562a.

* add getting started google colab notebook. REQUIRES: PR change on humanoidgym submodule

---------

Co-authored-by: Jos <[email protected]>
Co-authored-by: Jos <[email protected]>
  • Loading branch information
3 people authored May 3, 2024
1 parent 7bb19f2 commit 416d6ed
Show file tree
Hide file tree
Showing 2 changed files with 179 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "third_party/isaacgym"]
path = third_party/isaacgym
url = ../../kscalelabs/isaacgym.git
[submodule "third_party/humanoid-gym"]
path = third_party/humanoid-gym
url = ../../kscalelabs/humanoid-gym.git
[submodule "third_party/IsaacGymEnvs"]
path = third_party/IsaacGymEnvs
url = [email protected]:kscalelabs/IsaacGymEnvs.git
url = ../../kscalelabs/IsaacGymEnvs.git
178 changes: 178 additions & 0 deletions getting_started_colab_sim.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"gpuType": "L4"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"source": [
"This Notebook works on L4 and A100 GPUs"
],
"metadata": {
"id": "sRtNitKlw1zw"
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "iYqTHUm8hv1F"
},
"outputs": [],
"source": [
"from google.colab import drive\n",
"drive.mount('/content/drive', force_remount=True)"
]
},
{
"cell_type": "code",
"source": [
"%cd /content/drive/MyDrive\n",
"!git clone https://github.com/kscalelabs/sim.git"
],
"metadata": {
"id": "16UZ4d3Nm1PY"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"cd /content/drive/MyDrive/sim"
],
"metadata": {
"id": "pQ7Ev2668RqY"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!apt-get update -y\n",
"!apt-get install python3.8 python3.8-distutils\n",
"!update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1\n",
"!update-alternatives --config python3\n",
"!apt-get install python3-pip\n",
"!python3 -m pip install --upgrade pip --user"
],
"metadata": {
"id": "dmwa4ir7OfMU"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!sudo apt-get install libpython3.8-dev\n",
"!pip install numpy"
],
"metadata": {
"id": "TrLr6NG20IN4"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!make install-dev"
],
"metadata": {
"id": "HGAYjhc33_Ad"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Manually download IsaacGym_Preview_4_Package.tar.gz from https://developer.nvidia.com/isaac-gym\n",
"# And place it in your sim folder in google drive.\n",
"# OR use this slower upload option below\n",
"from google.colab import files\n",
"uploaded = files.upload()"
],
"metadata": {
"id": "xl-_w0pIwgZH"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!tar -xvf IsaacGym_Preview_4_Package.tar.gz\n",
"%env ISAACGYM_PATH=`pwd`/isaacgym\n",
"!export ISAACGYM_PATH=$(pwd)/isaacgym\n",
"!make install-third-party-external"
],
"metadata": {
"id": "H52XAPEPOZ0k"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!wget https://media.kscale.dev/stompy.tar.gz && tar -xzvf stompy.tar.gz\n",
"!python sim/scripts/create_fixed_torso.py"
],
"metadata": {
"id": "fVReUppMRDEm"
},
"execution_count": 10,
"outputs": []
},
{
"cell_type": "code",
"source": [
"%env MODEL_DIR=stompy"
],
"metadata": {
"id": "j_7WABU14nHI"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!python sim/humanoid_gym/train.py --task=legs_ppo --num_envs=4096 --headless"
],
"metadata": {
"id": "xR7Wpx8aSJQX"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Untested\n",
"!python sim/humanoid_gym/play.py --task legs_ppo --sim_device cpu"
],
"metadata": {
"id": "Gzgj4q5vV0TY"
},
"execution_count": null,
"outputs": []
}
]
}

0 comments on commit 416d6ed

Please sign in to comment.