Skip to content

Commit

Permalink
Merge branch 'main' into update_discrete_sac
Browse files Browse the repository at this point in the history
  • Loading branch information
BY571 committed Jan 4, 2024
2 parents 557a327 + 80c63ad commit bfcf90a
Show file tree
Hide file tree
Showing 56 changed files with 2,126 additions and 320 deletions.
7 changes: 6 additions & 1 deletion .github/unittest/linux_libs/scripts_d4rl/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ lib_dir="${env_dir}/lib"
conda deactivate && conda activate ./env

# this workflow only tests the libs
python -c "import gym, d4rl"
printf "* Smoke test\n"

python -c """import gym
import d4rl
"""

printf "* Tests"
python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 200 --capture no -k TestD4RL --error-for-skips --runslow
coverage combine
coverage xml -i
6 changes: 4 additions & 2 deletions .github/unittest/linux_libs/scripts_d4rl/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ if [ ! -d "${env_dir}" ]; then
fi
conda activate "${env_dir}"

python3 -m pip install pip --upgrade

#pip3 uninstall cython -y
#pip uninstall cython -y
#conda uninstall cython -y
pip3 install "cython<3"
conda install -c anaconda cython="<3.0.0" -y
python3 -m pip install "cython<3" --upgrade
#conda install -c anaconda cython="<3.0.0" -y


# 3. Install mujoco
Expand Down
22 changes: 22 additions & 0 deletions .github/unittest/linux_libs/scripts_vd4rl/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
channels:
- pytorch
- defaults
dependencies:
- pip
- pip:
- hypothesis
- future
- cloudpickle
- pytest
- pytest-cov
- pytest-mock
- pytest-instafail
- pytest-rerunfailures
- pytest-error-for-skips
- expecttest
- pyyaml
- scipy
- hydra-core
- huggingface_hub
- tqdm
- h5py
51 changes: 51 additions & 0 deletions .github/unittest/linux_libs/scripts_vd4rl/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_vd4rl/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 bfcf90a

Please sign in to comment.