Skip to content

Commit

Permalink
Merge branch 'main' of github.com:btx0424/rl into history
Browse files Browse the repository at this point in the history
  • Loading branch information
btx0424 committed Feb 7, 2024
2 parents 7c1e0d3 + eec9f9e commit 02920ed
Show file tree
Hide file tree
Showing 283 changed files with 9,197 additions and 3,167 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/m1_script.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

export BUILD_VERSION=0.3.0
export BUILD_VERSION=0.4.0

${CONDA_RUN} pip install git+https://github.com/pytorch/tensordict.git -U
3 changes: 1 addition & 2 deletions .github/unittest/helpers/coverage_run_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
nevertheless. It writes temporary coverage config files on the fly and
invokes coverage with proper arguments
"""
import logging
import os
import shlex
import subprocess
Expand Down Expand Up @@ -45,7 +44,7 @@ def write_config(config_path: Path, argv: List[str]) -> None:

def main(argv: List[str]) -> int:
if len(argv) < 1:
logging.info(
print( # noqa
"Usage: 'python coverage_run_parallel.py <command> [command arguments]'"
)
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion .github/unittest/linux/scripts/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export DISPLAY=:0
export SDL_VIDEODRIVER=dummy

# legacy from bash scripts: remove?
conda env config vars set MUJOCO_GL=$MUJOCO_GL PYOPENGL_PLATFORM=$MUJOCO_GL DISPLAY=:0 SDL_VIDEODRIVER=dummy
conda env config vars set MUJOCO_GL=$MUJOCO_GL PYOPENGL_PLATFORM=$MUJOCO_GL DISPLAY=:0 SDL_VIDEODRIVER=dummy LAZY_LEGACY_OP=False

pip3 install pip --upgrade
pip install virtualenv
Expand Down
1 change: 1 addition & 0 deletions .github/unittest/linux_distributed/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ lib_dir="${env_dir}/lib"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lib_dir
export MKL_THREADING_LAYER=GNU
export CKPT_BACKEND=torch
export LAZY_LEGACY_OP=False
export BATCHED_PIPE_TIMEOUT=60

python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/smoke_test.py -v --durations 200
Expand Down
1 change: 1 addition & 0 deletions .github/unittest/linux_examples/scripts/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$root_dir/.mujoco/mujoco210/bin
export SDL_VIDEODRIVER=dummy
export MUJOCO_GL=egl
export PYOPENGL_PLATFORM=egl
export LAZY_LEGACY_OP=False

conda env config vars set MUJOCO_PY_MUJOCO_PATH=$root_dir/.mujoco/mujoco210 \
DISPLAY=unix:0.0 \
Expand Down
3 changes: 3 additions & 0 deletions .github/unittest/linux_examples/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ python .github/unittest/helpers/coverage_run_parallel.py examples/decision_trans
optim.updates_per_episode=3 \
optim.warmup_steps=10 \
optim.device=cuda:0 \
env.backend=gymnasium \
logger.backend=
python .github/unittest/helpers/coverage_run_parallel.py examples/iql/iql_offline.py \
optim.gradient_steps=55 \
Expand Down Expand Up @@ -113,6 +114,7 @@ python .github/unittest/helpers/coverage_run_parallel.py examples/dqn/dqn_atari.
buffer.batch_size=10 \
device=cuda:0 \
loss.num_updates=1 \
logger.backend= \
buffer.buffer_size=120
python .github/unittest/helpers/coverage_run_parallel.py examples/cql/discrete_cql_online.py \
collector.total_frames=48 \
Expand Down Expand Up @@ -255,6 +257,7 @@ python .github/unittest/helpers/coverage_run_parallel.py examples/dqn/dqn_atari.
buffer.batch_size=10 \
device=cuda:0 \
loss.num_updates=1 \
logger.backend= \
buffer.buffer_size=120
python .github/unittest/helpers/coverage_run_parallel.py examples/redq/redq.py \
num_workers=2 \
Expand Down
25 changes: 25 additions & 0 deletions .github/unittest/linux_libs/scripts_ataridqn/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
channels:
- pytorch
- defaults
- conda-forge
dependencies:
- pip
- gsutil
- pip:
- hypothesis
- future
- cloudpickle
- pytest
- pytest-cov
- pytest-mock
- pytest-instafail
- pytest-rerunfailures
- pytest-error-for-skips
- expecttest
- pyyaml
- scipy
- hydra-core
- tqdm
- h5py
- datasets
- pillow
51 changes: 51 additions & 0 deletions .github/unittest/linux_libs/scripts_ataridqn/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/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.
apt-get update && apt-get install -y git wget gcc g++
#apt-get update && apt-get install -y git wget freeglut3 freeglut3-dev

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 %s\n" "${CU_VERSION}"
if [ "${CU_VERSION:-}" == cpu ] ; then
# conda install -y pytorch torchvision cpuonly -c pytorch-nightly
# use pip to install pytorch as conda can frequently pick older release
# conda install -y pytorch cpuonly -c pytorch-nightly
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
else
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121
fi

# install tensordict
pip install git+https://github.com/pytorch/tensordict.git

# smoke test
python -c "import functorch;import tensordict"

printf "* Installing torchrl\n"
python setup.py develop

# smoke test
python -c "import torchrl"
6 changes: 6 additions & 0 deletions .github/unittest/linux_libs/scripts_ataridqn/post_process.sh
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
Loading

0 comments on commit 02920ed

Please sign in to comment.