Skip to content

Commit 3cd740a

Browse files
authored
[Major] major refactoring of collectors (#3233)
1 parent 7e0968a commit 3cd740a

File tree

86 files changed

+13230
-9002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+13230
-9002
lines changed

.github/unittest/linux/scripts/run_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export SDL_VIDEODRIVER=dummy
8888
# legacy from bash scripts: remove?
8989
conda env config vars set \
9090
MAX_IDLE_COUNT=1000 \
91-
MUJOCO_GL=$MUJOCO_GL PYOPENGL_PLATFORM=$MUJOCO_GL DISPLAY=:99 SDL_VIDEODRIVER=dummy LAZY_LEGACY_OP=False RL_LOGGING_LEVEL=DEBUG TOKENIZERS_PARALLELISM=true
91+
MUJOCO_GL=$MUJOCO_GL PYOPENGL_PLATFORM=$MUJOCO_GL DISPLAY=:99 SDL_VIDEODRIVER=dummy LAZY_LEGACY_OP=False RL_LOGGING_LEVEL=INFO TOKENIZERS_PARALLELISM=true
9292

9393
pip3 install pip --upgrade
9494
pip install virtualenv

.github/unittest/linux_sota/scripts/run_all.sh

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ if [ ! -d "${env_dir}" ]; then
5252
fi
5353
conda activate "${env_dir}"
5454

55+
# Verify we have CPython, not PyPy
56+
python_impl=$(python -c "import platform; print(platform.python_implementation())")
57+
if [ "$python_impl" != "CPython" ]; then
58+
echo "ERROR: Expected CPython but got $python_impl"
59+
echo "Python executable: $(which python)"
60+
echo "Python version: $(python --version)"
61+
exit 1
62+
fi
63+
printf "* Verified Python implementation: %s\n" "$python_impl"
64+
5565
# 3. Install mujoco
5666
printf "* Installing mujoco and related\n"
5767
mkdir -p $root_dir/.mujoco
@@ -64,7 +74,10 @@ cd "${root_dir}"
6474

6575
# 4. Install Conda dependencies
6676
printf "* Installing dependencies (except PyTorch)\n"
67-
echo " - python=${PYTHON_VERSION}" >> "${this_dir}/environment.yml"
77+
# Add python version to environment.yml if not already present (idempotent)
78+
if ! grep -q "python=${PYTHON_VERSION}" "${this_dir}/environment.yml"; then
79+
echo " - python=${PYTHON_VERSION}" >> "${this_dir}/environment.yml"
80+
fi
6881
cat "${this_dir}/environment.yml"
6982

7083
export MUJOCO_PY_MUJOCO_PATH=$root_dir/.mujoco/mujoco210
@@ -100,11 +113,27 @@ pip install git+https://github.com/Farama-Foundation/d4rl@master#egg=d4rl
100113

101114
# TODO: move this down -- will break torchrl installation
102115
conda install -y -c conda-forge libstdcxx-ng=12
103-
## find libstdc
104-
STDC_LOC=$(find conda/ -name "libstdc++.so.6" | head -1)
105-
conda env config vars set \
106-
MAX_IDLE_COUNT=1000 \
107-
LD_PRELOAD=${root_dir}/$STDC_LOC TOKENIZERS_PARALLELISM=true
116+
## find libstdc - search in the env's lib directory first, then fall back to conda packages
117+
STDC_LOC=$(find "${env_dir}/lib" -name "libstdc++.so.6" 2>/dev/null | head -1)
118+
if [ -z "$STDC_LOC" ]; then
119+
# Fall back to searching in conda packages for libstdcxx-ng specifically
120+
STDC_LOC=$(find conda/pkgs -path "*libstdcxx*" -name "libstdc++.so.6" 2>/dev/null | head -1)
121+
fi
122+
if [ -z "$STDC_LOC" ]; then
123+
echo "WARNING: Could not find libstdc++.so.6, skipping LD_PRELOAD"
124+
conda env config vars set \
125+
MAX_IDLE_COUNT=1000 \
126+
TOKENIZERS_PARALLELISM=true
127+
else
128+
echo "Found libstdc++ at: $STDC_LOC"
129+
conda env config vars set \
130+
MAX_IDLE_COUNT=1000 \
131+
LD_PRELOAD=${STDC_LOC} TOKENIZERS_PARALLELISM=true
132+
fi
133+
134+
# Reactivate environment to apply the new env vars
135+
conda deactivate
136+
conda activate "${env_dir}"
108137

109138
# compile mujoco-py (bc it's done at runtime for whatever reason someone thought it was a good idea)
110139
python -c """import gym;import d4rl"""

benchmarks/ecosystem/gym_env_throughput.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
)
2828
from torchrl.envs import EnvCreator, GymEnv, ParallelEnv
2929
from torchrl.envs.libs.gym import gym_backend as gym_bc, set_gym_backend
30-
from torchrl.envs.utils import RandomPolicy
30+
from torchrl.modules import RandomPolicy
3131

3232
if __name__ == "__main__":
3333
avail_devices = ("cpu",)

benchmarks/storage/benchmark_sample_latency_over_rpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def __init__(self, capacity: int):
144144
rank = args.rank
145145
storage_type = args.storage
146146

147-
torchrl_logger.info(f"Rank: {rank}; Storage: {storage_type}")
147+
torchrl_logger.debug(f"RANK: {rank}; Storage: {storage_type}")
148148

149149
os.environ["MASTER_ADDR"] = "localhost"
150150
os.environ["MASTER_PORT"] = "29500"

benchmarks/test_collectors_benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from torchrl.data.utils import CloudpickleWrapper
1919
from torchrl.envs import EnvCreator, GymEnv, ParallelEnv, StepCounter, TransformedEnv
2020
from torchrl.envs.libs.dm_control import DMControlEnv
21-
from torchrl.envs.utils import RandomPolicy
21+
from torchrl.modules import RandomPolicy
2222

2323

2424
def single_collector_setup():

0 commit comments

Comments
 (0)