-
Notifications
You must be signed in to change notification settings - Fork 438
[Feature] Added OpenEnv environments #3470
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
ParamThakkar123
wants to merge
32
commits into
pytorch:main
Choose a base branch
from
ParamThakkar123:add/openenv
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
32 commits
Select commit
Hold shift + click to select a range
1f6f327
Fixed MultiSyncCollector set_seed and split_trajs issue
ParamThakkar123 e2aaf6b
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 40642d5
Revert "Fixed MultiSyncCollector set_seed and split_trajs issue"
ParamThakkar123 efdc89c
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 628f44b
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 a476a77
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 0f565c5
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 7fb086b
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 ff72793
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 69001ed
Added Support for index_select in TensorSpec
ParamThakkar123 4ab13be
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 2e8face
rebase
ParamThakkar123 56e1529
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 ba6a19f
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 8be545b
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 54abe29
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 6b099f5
Add OpenEnv environments
ParamThakkar123 8f41393
Updates
ParamThakkar123 4a9a6e7
Merge branch 'main' of https://github.com/pytorch/rl into add/openenv
ParamThakkar123 9b8b119
Using ChatEnv as base class
ParamThakkar123 f790843
Merge branch 'main' of https://github.com/pytorch/rl into add/openenv
ParamThakkar123 cf6940c
Added History
ParamThakkar123 16ee592
Merge branch 'main' of https://github.com/pytorch/rl into add/openenv
ParamThakkar123 a6c0fda
Fixes
ParamThakkar123 9af50f2
Fixed circular import error
ParamThakkar123 78dd00a
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 4918107
Merge branch 'main' of https://github.com/pytorch/rl into add/openenv
ParamThakkar123 93c67a0
edits
vmoens f3eb268
Merge remote-tracking branch 'origin/main' into add/openenv
vmoens 94fe080
Merge branch 'main' of https://github.com/pytorch/rl
ParamThakkar123 e1212f2
Merge branch 'main' of https://github.com/ParamThakkar123/rl into add…
ParamThakkar123 8902b83
Merge branch 'main' of https://github.com/pytorch/rl into add/openenv
ParamThakkar123 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
21 changes: 21 additions & 0 deletions
21
.github/unittest/linux_libs/scripts_openenv/environment.yml
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,21 @@ | ||
| channels: | ||
| - pytorch | ||
| - defaults | ||
| dependencies: | ||
| - pip | ||
| - pip: | ||
| - hypothesis | ||
| - future | ||
| - cloudpickle | ||
| - pytest | ||
| - pytest-cov | ||
| - pytest-mock | ||
| - pytest-instafail | ||
| - pytest-rerunfailures | ||
| - pytest-error-for-skips | ||
| - expecttest | ||
| - pybind11[global] | ||
| - pyyaml | ||
| - scipy | ||
| - hydra-core | ||
| - openenv-core |
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,60 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| unset PYTORCH_VERSION | ||
| # For unittest, nightly PyTorch is used as the following section, | ||
| # so no need to set PYTORCH_VERSION. | ||
| # In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config. | ||
|
|
||
| set -e | ||
|
|
||
| eval "$(./conda/bin/conda shell.bash hook)" | ||
| conda activate ./env | ||
|
|
||
| if [ "${CU_VERSION:-}" == cpu ] ; then | ||
| version="cpu" | ||
| else | ||
| if [[ ${#CU_VERSION} -eq 4 ]]; then | ||
| CUDA_VERSION="${CU_VERSION:2:1}.${CU_VERSION:3:1}" | ||
| elif [[ ${#CU_VERSION} -eq 5 ]]; then | ||
| CUDA_VERSION="${CU_VERSION:2:2}.${CU_VERSION:4:1}" | ||
| fi | ||
| echo "Using CUDA $CUDA_VERSION as determined by CU_VERSION ($CU_VERSION)" | ||
| version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")" | ||
| fi | ||
|
|
||
| # submodules | ||
| git submodule sync && git submodule update --init --recursive | ||
|
|
||
| printf "Installing PyTorch with cu128" | ||
| if [[ "$TORCH_VERSION" == "nightly" ]]; then | ||
| if [ "${CU_VERSION:-}" == cpu ] ; then | ||
| pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U | ||
| else | ||
| pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu128 -U | ||
| fi | ||
| elif [[ "$TORCH_VERSION" == "stable" ]]; then | ||
| if [ "${CU_VERSION:-}" == cpu ] ; then | ||
| pip3 install torch --index-url https://download.pytorch.org/whl/cpu | ||
| else | ||
| pip3 install torch --index-url https://download.pytorch.org/whl/cu128 | ||
| fi | ||
| else | ||
| printf "Failed to install pytorch" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # install tensordict | ||
| if [[ "$RELEASE" == 0 ]]; then | ||
| pip3 install git+https://github.com/pytorch/tensordict.git | ||
| else | ||
| pip3 install tensordict | ||
| fi | ||
|
|
||
| # smoke test | ||
| python -c "import functorch;import tensordict" | ||
|
|
||
| printf "* Installing torchrl\n" | ||
| python -m pip install -e . --no-build-isolation | ||
|
|
||
| # smoke test | ||
| python -c "import torchrl" |
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,6 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e | ||
|
|
||
| eval "$(./conda/bin/conda shell.bash hook)" | ||
| conda activate ./env |
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,28 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e | ||
|
|
||
| eval "$(./conda/bin/conda shell.bash hook)" | ||
| conda activate ./env | ||
|
|
||
| apt-get update && apt-get install -y git wget cmake | ||
|
|
||
| export PYTORCH_TEST_WITH_SLOW='1' | ||
| export LAZY_LEGACY_OP=False | ||
| python -m torch.utils.collect_env | ||
| # Avoid error: "fatal: unsafe repository" | ||
| git config --global --add safe.directory '*' | ||
|
|
||
| root_dir="$(git rev-parse --show-toplevel)" | ||
| env_dir="${root_dir}/env" | ||
| lib_dir="${env_dir}/lib" | ||
|
|
||
| conda deactivate && conda activate ./env | ||
|
|
||
| # this workflow only tests the libs | ||
| python -c "import openenv" | ||
|
|
||
| python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 200 --capture no -k TestOpenEnv --error-for-skips | ||
|
|
||
| coverage combine -q | ||
| coverage xml -i |
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,69 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # This script is for setting up environment in which unit test is ran. | ||
| # To speed up the CI time, the resulting environment is cached. | ||
| # | ||
| # Do not install PyTorch and torchvision here, otherwise they also get cached. | ||
|
|
||
| set -e | ||
| set -v | ||
|
|
||
| apt-get update && apt-get upgrade -y && apt-get install -y git cmake | ||
| # Avoid error: "fatal: unsafe repository" | ||
| git config --global --add safe.directory '*' | ||
| apt-get install -y wget \ | ||
| gcc \ | ||
| g++ \ | ||
| unzip \ | ||
| curl \ | ||
| patchelf \ | ||
| libosmesa6-dev \ | ||
| libgl1-mesa-glx \ | ||
| libglfw3 \ | ||
| swig3.0 \ | ||
| libglew-dev \ | ||
| libglvnd0 \ | ||
| libgl1 \ | ||
| libglx0 \ | ||
| libegl1 \ | ||
| libgles2 | ||
|
|
||
| # Upgrade specific package | ||
| apt-get upgrade -y libstdc++6 | ||
|
|
||
| this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
| root_dir="$(git rev-parse --show-toplevel)" | ||
| conda_dir="${root_dir}/conda" | ||
| env_dir="${root_dir}/env" | ||
|
|
||
| cd "${root_dir}" | ||
|
|
||
| case "$(uname -s)" in | ||
| Darwin*) os=MacOSX;; | ||
| *) os=Linux | ||
| esac | ||
|
|
||
| # 1. Install conda at ./conda | ||
| if [ ! -d "${conda_dir}" ]; then | ||
| printf "* Installing conda\n" | ||
| wget -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh" | ||
| bash ./miniconda.sh -b -f -p "${conda_dir}" | ||
| fi | ||
| eval "$(${conda_dir}/bin/conda shell.bash hook)" | ||
|
|
||
| # 2. Create test environment at ./env | ||
| printf "python: ${PYTHON_VERSION}\n" | ||
| if [ ! -d "${env_dir}" ]; then | ||
| printf "* Creating a test environment\n" | ||
| conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION" | ||
| fi | ||
| conda activate "${env_dir}" | ||
|
|
||
| # 3. Install Conda dependencies | ||
| printf "* Installing dependencies (except PyTorch)\n" | ||
| echo " - python=${PYTHON_VERSION}" >> "${this_dir}/environment.yml" | ||
| cat "${this_dir}/environment.yml" | ||
|
|
||
| pip install pip --upgrade | ||
|
|
||
| conda env update --file "${this_dir}/environment.yml" --prune |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this reorder?