Skip to content

Commit

Permalink
[CI] Fix broken workflows (#2428)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens committed Sep 10, 2024
1 parent 8b1195a commit fb9cc2c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/unittest/linux_libs/scripts_gym/batch_scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
DIR="$(cd "$(dirname "$0")" && pwd)"

set -e
set -v

eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
Expand Down
1 change: 0 additions & 1 deletion .github/unittest/linux_libs/scripts_gym/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dependencies:
- pip:
# Initial version is required to install Atari ROMS in setup_env.sh
- gym[atari]==0.13
- minigrid
- hypothesis
- future
- cloudpickle
Expand Down
3 changes: 2 additions & 1 deletion .github/unittest/linux_libs/scripts_gym/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ unset PYTORCH_VERSION
apt-get update && apt-get install -y git wget gcc g++

set -e
set -v

eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
Expand Down Expand Up @@ -39,7 +40,7 @@ printf "Installing PyTorch with %s\n" "${CU_VERSION}"
if [ "${CU_VERSION:-}" == cpu ] ; then
conda install pytorch==2.0 torchvision==0.15 cpuonly -c pytorch -y
else
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia -y
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 numpy==1.26 numpy-base==1.26 -c pytorch -c nvidia -y
fi

# Solving circular import: https://stackoverflow.com/questions/75501048/how-to-fix-attributeerror-partially-initialized-module-charset-normalizer-has
Expand Down
7 changes: 4 additions & 3 deletions .github/unittest/linux_libs/scripts_habitat/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ pip install pip --upgrade

conda env update --file "${this_dir}/environment.yml" --prune

#conda install habitat-sim withbullet headless -c conda-forge -c aihabitat -y
conda install habitat-sim withbullet headless -c conda-forge -c aihabitat -y
conda run python -m pip install git+https://github.com/facebookresearch/habitat-lab.git@stable#subdirectory=habitat-lab
#conda run python -m pip install git+https://github.com/facebookresearch/habitat-lab.git#subdirectory=habitat-baselines
git clone https://github.com/facebookresearch/habitat-lab.git
cd habitat-lab
pip3 install -e habitat-lab
pip3 install -e habitat-baselines # install habitat_baselines
conda run python -m pip install "gym[atari,accept-rom-license]" pygame
2 changes: 1 addition & 1 deletion .github/unittest/linux_olddeps/scripts_gym_0_13/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ printf "Installing PyTorch with %s\n" "${CU_VERSION}"
if [ "${CU_VERSION:-}" == cpu ] ; then
conda install pytorch==2.0 torchvision==0.15 cpuonly -c pytorch -y
else
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia -y
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 numpy==1.26 numpy-base==1.26 -c pytorch -c nvidia -y
fi

# Solving circular import: https://stackoverflow.com/questions/75501048/how-to-fix-attributeerror-partially-initialized-module-charset-normalizer-has
Expand Down
7 changes: 4 additions & 3 deletions torchrl/collectors/collectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ def __init__(
# Cuda handles sync
if torch.cuda.is_available():
self._sync_storage = torch.cuda.synchronize
elif torch.backends.mps.is_available():
elif torch.backends.mps.is_available() and hasattr(torch, "mps"):
# Will break for older PT versions which don't have torch.mps
self._sync_storage = torch.mps.synchronize
elif self.storing_device.type == "cpu":
self._sync_storage = _do_nothing
Expand All @@ -521,7 +522,7 @@ def __init__(
# Cuda handles sync
if torch.cuda.is_available():
self._sync_env = torch.cuda.synchronize
elif torch.backends.mps.is_available():
elif torch.backends.mps.is_available() and hasattr(torch, "mps"):
self._sync_env = torch.mps.synchronize
elif self.env_device.type == "cpu":
self._sync_env = _do_nothing
Expand All @@ -534,7 +535,7 @@ def __init__(
# Cuda handles sync
if torch.cuda.is_available():
self._sync_policy = torch.cuda.synchronize
elif torch.backends.mps.is_available():
elif torch.backends.mps.is_available() and hasattr(torch, "mps"):
self._sync_policy = torch.mps.synchronize
elif self.policy_device.type == "cpu":
self._sync_policy = _do_nothing
Expand Down

0 comments on commit fb9cc2c

Please sign in to comment.