Skip to content

Commit dc0f446

Browse files
committed
[CI] Fix libs
ghstack-source-id: 3e9f8f9 Pull-Request: #3203
1 parent a5d3789 commit dc0f446

File tree

5 files changed

+42
-17
lines changed

5 files changed

+42
-17
lines changed

.github/unittest/linux_libs/scripts_isaaclab/isaac.sh

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,36 +46,45 @@ eval "$(${conda_dir}/bin/conda shell.bash hook)"
4646
conda create --prefix ${env_dir} python=3.10 -y
4747
conda activate ${env_dir}
4848

49+
# Set LD_LIBRARY_PATH to prioritize conda environment libraries early
50+
export LD_LIBRARY_PATH=${lib_dir}:${LD_LIBRARY_PATH:-}
51+
52+
# Ensure libexpat is at the correct version BEFORE installing other packages
53+
conda install -c conda-forge expat -y
54+
55+
# Reinstall Python to ensure it links against the correct expat
56+
conda install --force-reinstall python=3.10 -y
57+
4958
# Pin pytorch to 2.5.1 for IsaacLab
5059
conda install pytorch==2.5.1 torchvision==0.20.1 pytorch-cuda=12.4 -c pytorch -c nvidia -y
5160

52-
conda run -p ${env_dir} pip install --upgrade pip
53-
conda run -p ${env_dir} pip install 'isaacsim[all,extscache]==4.5.0' --extra-index-url https://pypi.nvidia.com
61+
python -m pip install --upgrade pip
62+
python -m pip install 'isaacsim[all,extscache]==4.5.0' --extra-index-url https://pypi.nvidia.com
5463
conda install conda-forge::"cmake>3.22" -y
5564

5665
git clone https://github.com/isaac-sim/IsaacLab.git
5766
cd IsaacLab
58-
conda run -p ${env_dir} ./isaaclab.sh --install sb3
67+
./isaaclab.sh --install sb3
5968
cd ../
6069

6170
# install tensordict
6271
if [[ "$RELEASE" == 0 ]]; then
6372
conda install "anaconda::cmake>=3.22" -y
64-
conda run -p ${env_dir} python -m pip install "pybind11[global]"
65-
conda run -p ${env_dir} python -m pip install git+https://github.com/pytorch/tensordict.git
73+
python -m pip install "pybind11[global]"
74+
python -m pip install git+https://github.com/pytorch/tensordict.git
6675
else
67-
conda run -p ${env_dir} python -m pip install tensordict
76+
python -m pip install tensordict
6877
fi
6978

7079
# smoke test
71-
conda run -p ${env_dir} python -c "import tensordict"
80+
python -c "import tensordict"
7281

7382
printf "* Installing torchrl\n"
74-
conda run -p ${env_dir} python -m pip install -e . --no-build-isolation
75-
conda run -p ${env_dir} python -c "import torchrl"
83+
python -m pip install -e . --no-build-isolation
84+
python -c "import torchrl"
7685

7786
# Install pytest
78-
conda run -p ${env_dir} python -m pip install pytest pytest-cov pytest-mock pytest-instafail pytest-rerunfailures pytest-error-for-skips pytest-asyncio
87+
python -m pip install pytest pytest-cov pytest-mock pytest-instafail pytest-rerunfailures pytest-error-for-skips pytest-asyncio
7988

8089
# Run tests
81-
conda run -p ${env_dir} python -m pytest test/test_libs.py -k isaac -s
90+
python -m pytest test/test_libs.py -k isaac -s

.github/unittest/linux_libs/scripts_minari/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ dependencies:
2525
- gymnasium-robotics
2626
- minari[create]
2727
- jax>=0.7.0
28-
- mujoco<3.3.6
28+
- mujoco>=2.3.0,<3.0.0
2929
- mujoco-py<2.2,>=2.1
3030
- minigrid

.github/workflows/test-linux-libs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ jobs:
156156
export BATCHED_PIPE_TIMEOUT=60
157157
export TD_GET_DEFAULTS_TO_NONE=1
158158
159-
bash .github/unittest/linux_libs/scripts_d4rl/setup_env.sh
160-
bash .github/unittest/linux_libs/scripts_d4rl/install.sh
161-
bash .github/unittest/linux_libs/scripts_d4rl/run_test.sh
162-
bash .github/unittest/linux_libs/scripts_d4rl/post_process.sh
159+
bash .github/unittest/linux_libs/scripts_envpool/setup_env.sh
160+
bash .github/unittest/linux_libs/scripts_envpool/install.sh
161+
bash .github/unittest/linux_libs/scripts_envpool/run_test.sh
162+
bash .github/unittest/linux_libs/scripts_envpool/post_process.sh
163163
164164
unittests-gendgrl:
165165
strategy:

test/test_libs.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
from torchrl.data.datasets.roboset import RobosetExperienceReplay
7474
from torchrl.data.datasets.vd4rl import VD4RLExperienceReplay
7575
from torchrl.data.replay_buffers import SamplerWithoutReplacement
76+
from torchrl.data.replay_buffers.samplers import SliceSampler
77+
from torchrl.data.replay_buffers.storages import LazyTensorStorage
7678
from torchrl.data.utils import CloudpickleWrapper
7779
from torchrl.envs import (
7880
CatTensors,
@@ -82,6 +84,7 @@
8284
EnvCreator,
8385
RemoveEmptySpecs,
8486
RenameTransform,
87+
StepCounter,
8588
)
8689
from torchrl.envs.batched_envs import SerialEnv
8790
from torchrl.envs.libs.brax import _has_brax, BraxEnv, BraxWrapper
@@ -2790,7 +2793,6 @@ class TestVmas:
27902793
@pytest.mark.parametrize("scenario_name", VmasWrapper.available_envs)
27912794
@pytest.mark.parametrize("continuous_actions", [True, False])
27922795
def test_all_vmas_scenarios(self, scenario_name, continuous_actions):
2793-
27942796
env = VmasEnv(
27952797
scenario=scenario_name,
27962798
continuous_actions=continuous_actions,
@@ -3455,6 +3457,8 @@ def test_d4rl_dummy(self, task):
34553457
@pytest.mark.parametrize("split_trajs", [True, False])
34563458
@pytest.mark.parametrize("from_env", [True, False])
34573459
def test_dataset_build(self, task, split_trajs, from_env):
3460+
import d4rl # noqa: F401
3461+
34583462
t0 = time.time()
34593463
data = D4RLExperienceReplay(
34603464
task, split_trajs=split_trajs, from_env=from_env, batch_size=2
@@ -5144,6 +5148,17 @@ def test_isaaclab(self, env):
51445148
env.check_env_specs(break_when_any_done="both")
51455149
torchrl_logger.info("Check succeeded!")
51465150

5151+
def test_isaaclab_rb(self, env):
5152+
env = env.append_transform(StepCounter())
5153+
rb = ReplayBuffer(
5154+
storage=LazyTensorStorage(50, ndim=2), sampler=SliceSampler(num_slices=5)
5155+
)
5156+
rb.extend(env.rollout(20))
5157+
# check that rb["step_count"].flatten() is made of sequences of 4 consecutive numbers
5158+
flat_ranges = rb["step_count"].flatten() % 4
5159+
arange = torch.arange(flat_ranges.numel(), device=flat_ranges.device) % 4
5160+
assert (flat_ranges == arange).all()
5161+
51475162
def test_isaac_collector(self, env):
51485163
col = SyncDataCollector(
51495164
env, env.rand_action, frames_per_batch=1000, total_frames=100_000_000

torchrl/data/datasets/d4rl.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ def _get_dataset_from_env(self, name, env_kwargs):
346346
"""
347347
if env_kwargs:
348348
raise RuntimeError("env_kwargs cannot be passed with using from_env=True")
349+
import d4rl # noqa: F401
349350
import gym
350351

351352
# we do a local import to avoid circular import issues

0 commit comments

Comments
 (0)