-
Notifications
You must be signed in to change notification settings - Fork 89
Update to New RSL-RL - Enable multi gpu #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alessandroassirelli98
wants to merge
7
commits into
NVlabs:main
Choose a base branch
from
alessandroassirelli98:squash-new-rsl_rl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d19a716
use new rsl-rl configuration
232c608
add doc for multi gpu
9992b91
update readme
bd8a497
Merge remote-tracking branch 'mygithub/main' into squash-new-rsl_rl
f91d8bd
implement abstract method
2f74665
update test
797dc3f
fix unittest
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
|
|
||
| {"python.analysis.extraPaths": [ | ||
| "${workspaceFolder}/../../IsaacLab/source/isaaclab", | ||
| "${workspaceFolder}/../../IsaacLab/source/isaaclab_mimic", | ||
| "${workspaceFolder}/../../IsaacLab/source/isaaclab_tasks", | ||
| "${workspaceFolder}/../../IsaacLab/source/isaaclab_assets", | ||
| "${workspaceFolder}/../../IsaacLab/source/extensions", | ||
| "${workspaceFolder}/../../IsaacLab/source/standalone", | ||
| "${workspaceFolder}/../../IsaacLab/source/isaaclab_rl" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,10 +50,6 @@ demonstrations and to link to the original implementation in Isaac Gym, please v | |
|
|
||
| 1. Install Isaac Lab, see the [installation guide](https://isaac-sim.github.io/IsaacLab/v2.0.0/source/setup/installation/index.html). | ||
| **Note**: Currently HOVER has been tested with Isaac Lab versions 2.0.0. After you clone the Isaac Lab | ||
| repository, check out the specific tag before installation. Also note that the `rsl_rl` | ||
| package is renamed to `rsl_rl_lib` with the current `v2.0.0` tag of Isaac Lab, causing installation issues. | ||
| This will be fixed once a new tag is created on the Isaac Lab repo. | ||
| This error would not affect this repo, as we have our own customized `rsl_rl` package. | ||
| ```bash | ||
| git fetch origin | ||
| git checkout v2.0.0 | ||
|
|
@@ -70,7 +66,7 @@ demonstrations and to link to the original implementation in Isaac Gym, please v | |
| 4. Install this repo and its dependencies by running the following command from the root of this | ||
| repo: | ||
| ```bash | ||
| ./install_deps.sh | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| # Training | ||
|
|
@@ -121,35 +117,40 @@ folder as the included data library will handle relative path searching, which i | |
|
|
||
| For more details, refer to the [human2humanoid repository](https://github.com/LeCAR-Lab/human2humanoid/tree/main?tab=readme-ov-file#motion-retargeting). | ||
|
|
||
| If you have a configured conda environment with Isaaclab you can launch the scripts with `python`, otherwise use the python bundled with Isaaclab `${ISAACLAB_PATH:?}/isaaclab.sh -p` | ||
| ## Teacher Policy | ||
|
|
||
|
|
||
| In the project's root directory, | ||
|
|
||
| ```bash | ||
| ${ISAACLAB_PATH:?}/isaaclab.sh -p scripts/rsl_rl/train_teacher_policy.py \ | ||
| python scripts/rsl_rl/train_teacher_policy.py \ | ||
| --num_envs 1024 \ | ||
| --reference_motion_path neural_wbc/data/data/motions/stable_punch.pkl | ||
| --reference_motion_path neural_wbc/data/data/motions/stable_punch.pkl # you can omit this as it's the default | ||
| ``` | ||
|
|
||
| The max iteration of the teacher policy is set to 10,000,000 by default. The resulting checkpoint is stored in `neural_wbc/data/data/policy/h1:teacher/` and the filename is `model_<iteration_number>.pt`. | ||
| The user can interrupt the training at anytime. Normally, a good policy can be trained between `50k` to `80k` iterations. | ||
| The max iteration of the teacher policy is set to 10,000,000 by default. The resulting checkpoint is stored in `<data_time>` and the filename is `model_<iteration_number>.pt`. The user can interrupt the training at anytime. Normally, a good policy can be trained between `50k` to `80k` iterations. | ||
|
|
||
|
|
||
| ## Student Policy | ||
|
|
||
|
|
||
| In the project's root directory, | ||
| ```bash | ||
| ${ISAACLAB_PATH:?}/isaaclab.sh -p scripts/rsl_rl/train_student_policy.py \ | ||
| python scripts/rsl_rl/train_student_policy.py \ | ||
|
huihuaNvidia2023 marked this conversation as resolved.
|
||
| --num_envs 1024 \ | ||
| --reference_motion_path neural_wbc/data/data/motions/stable_punch.pkl \ | ||
| --teacher_policy.resume_path neural_wbc/data/data/policy/h1:teacher \ | ||
| --teacher_policy.checkpoint model_<iteration_number>.pt | ||
| --headless | ||
| ``` | ||
| This assumes that you have already trained the teacher policy as there is no provided teacher policy in the repo. Change the filename to match the checkpoint you trained. | ||
| The exact path of the teacher policy does not matter, but it is recommended to store it in the data folder. If stored outside the data folder, you might need to provide the full path. | ||
|
|
||
| ## Multi-GPU | ||
| It is possible to train on a node with multiple gpus or multiple nodes with multiple gpues. | ||
| In order to train the teacher on a machine with 4 gpus: | ||
| ```bash | ||
| python -m torch.distributed.run --nnodes=1 --nproc_per_node=4 scripts/rsl_rl/train_teacher.py --num_envs=1024 --headless --distributed | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ``` | ||
| This will generate 4 IsaacSim simulation, each containing 1024 environments. | ||
|
|
||
| ## General Remarks for Training | ||
|
|
||
|
|
@@ -159,16 +160,15 @@ The exact path of the teacher policy does not matter, but it is recommended to s | |
| results we recommend to train with the full amass dataset. | ||
| - Per default the trained checkpoints are stored to `logs/teacher/` or `logs/student/`. | ||
| - If you don't want to train from scratch you can resume training from a checkpoint using the | ||
| options `--teacher_policy.resume_path`/`--student_policy.resume_path` and | ||
| `--teacher_policy.checkpoint`/`--student_policy.checkpoint`. For example to resume training of | ||
| options `--load_run=<date_time>` and/or `--checkpoint=<model_iter.pt>`. For example to resume training of | ||
| the teacher use | ||
|
|
||
| ```bash | ||
| ${ISAACLAB_PATH:?}/isaaclab.sh -p scripts/rsl_rl/train_teacher_policy.py \ | ||
| python scripts/rsl_rl/train_teacher_policy.py \ | ||
|
huihuaNvidia2023 marked this conversation as resolved.
|
||
| --num_envs 10 \ | ||
| --reference_motion_path neural_wbc/data/data/motions/stable_punch.pkl \ | ||
| --teacher_policy.resume_path neural_wbc/data/data/policy/h1:teacher \ | ||
| --teacher_policy.checkpoint model_<iteration_number>.pt | ||
| --load_run 2025-05-09_09-23-50 \ | ||
| --checkpoint model_500.pt | ||
|
|
||
| ``` | ||
|
|
||
| - Training requires a single GPU, we found the following performance when training on different | ||
|
|
@@ -234,24 +234,21 @@ In both cases the same commands from above can be used to launch the training. | |
| In the project's root directory, | ||
|
|
||
| ```bash | ||
| ${ISAACLAB_PATH:?}/isaaclab.sh -p scripts/rsl_rl/play.py \ | ||
| python scripts/rsl_rl/play.py \ | ||
| --num_envs 10 \ | ||
| --reference_motion_path neural_wbc/data/data/motions/stable_punch.pkl \ | ||
| --teacher_policy.resume_path neural_wbc/data/data/policy/h1:teacher \ | ||
| --teacher_policy.checkpoint model_<iteration_number>.pt | ||
| ``` | ||
| This will run the latest checkpoint in the latest run. | ||
| Alternatively you can specify the run from which you want to load the checkpoint from by passing `--load_run=logs/rsl_rl/teacher_policy/h1/<date_time>`, which will use the latest checkpoint in the folder. You can also specify a specific checkpoint by passing `--checkpoint=<model_iter.pt>` | ||
|
|
||
| ## Play Student Policy | ||
|
|
||
| In the project's root directory, | ||
|
|
||
| ```bash | ||
| ${ISAACLAB_PATH:?}/isaaclab.sh -p scripts/rsl_rl/play.py \ | ||
| python scripts/rsl_rl/play.py \ | ||
| --num_envs 10 \ | ||
| --reference_motion_path neural_wbc/data/data/motions/stable_punch.pkl \ | ||
| --student_player \ | ||
| --student_path neural_wbc/data/data/policy/h1:student \ | ||
| --student_checkpoint model_<iteration_number>.pt | ||
| ``` | ||
|
|
||
| # Evaluation | ||
|
|
@@ -297,13 +294,17 @@ The evaluation script, `scripts/rsl_rl/eval.py`, uses the same arguments as the | |
| `scripts/rsl_rl/play.py`. You can use it for both teacher and student policies. | ||
|
|
||
| ```bash | ||
| ${ISAACLAB_PATH}/isaaclab.sh -p scripts/rsl_rl/eval.py \ | ||
| # For a teacher | ||
| python scripts/rsl_rl/eval.py \ | ||
|
huihuaNvidia2023 marked this conversation as resolved.
|
||
| --num_envs 10 \ | ||
| --teacher_policy.resume_path neural_wbc/data/data/policy/h1:teacher \ | ||
| --teacher_policy.checkpoint model_<iteration_number>.pt | ||
| ``` | ||
|
|
||
|
|
||
| ``` bash | ||
| # For a student | ||
| python scripts/rsl_rl/eval.py \ | ||
| --num_envs 10 \ | ||
| --student_player | ||
| ``` | ||
| # Overwriting Configuration Values | ||
|
|
||
| To customize and overwrite default environment configuration values, you can provide a YAML file | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.