Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
vmoens committed Sep 13, 2024
2 parents 00b1f8f + 18eb81d commit 8451bd8
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 68 deletions.
8 changes: 4 additions & 4 deletions .github/unittest/linux_examples/scripts/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ git submodule sync && git submodule update --init --recursive
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
if [[ "$TORCH_VERSION" == "nightly" ]]; then
if [ "${CU_VERSION:-}" == cpu ] ; then
pip3 install --pre torch torchvision numpy==1.26.4 numpy-base<2.0 --index-url https://download.pytorch.org/whl/nightly/cpu -U
pip3 install --pre torch torchvision numpy==1.26.4 numpy-base==1.26.4 --index-url https://download.pytorch.org/whl/nightly/cpu -U
else
pip3 install --pre torch torchvision numpy==1.26.4 numpy-base<2.0 --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION
pip3 install --pre torch torchvision numpy==1.26.4 numpy-base==1.26.4 --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION
fi
elif [[ "$TORCH_VERSION" == "stable" ]]; then
if [ "${CU_VERSION:-}" == cpu ] ; then
pip3 install torch torchvision numpy==1.26.4 numpy-base<2.0 --index-url https://download.pytorch.org/whl/cpu
pip3 install torch torchvision numpy==1.26.4 numpy-base==1.26.4 --index-url https://download.pytorch.org/whl/cpu
else
pip3 install torch torchvision numpy==1.26.4 numpy-base<2.0 --index-url https://download.pytorch.org/whl/$CU_VERSION
pip3 install torch torchvision numpy==1.26.4 numpy-base==1.26.4 --index-url https://download.pytorch.org/whl/$CU_VERSION
fi
else
printf "Failed to install pytorch"
Expand Down
8 changes: 4 additions & 4 deletions .github/unittest/linux_libs/scripts_rlhf/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ git submodule sync && git submodule update --init --recursive
printf "Installing PyTorch with cu121"
if [[ "$TORCH_VERSION" == "nightly" ]]; then
if [ "${CU_VERSION:-}" == cpu ] ; then
pip3 install --pre torch numpy==1.26.4 numpy-base<2.0 --index-url https://download.pytorch.org/whl/nightly/cpu -U
pip3 install --pre torch numpy==1.26.4 numpy-base==1.26.4 --index-url https://download.pytorch.org/whl/nightly/cpu -U
else
pip3 install --pre torch numpy==1.26.4 numpy-base<2.0 --index-url https://download.pytorch.org/whl/nightly/cu121 -U
pip3 install --pre torch numpy==1.26.4 numpy-base==1.26.4 --index-url https://download.pytorch.org/whl/nightly/cu121 -U
fi
elif [[ "$TORCH_VERSION" == "stable" ]]; then
if [ "${CU_VERSION:-}" == cpu ] ; then
pip3 install torch numpy==1.26.4 numpy-base<2.0 --index-url https://download.pytorch.org/whl/cpu
pip3 install torch numpy==1.26.4 numpy-base==1.26.4 --index-url https://download.pytorch.org/whl/cpu
else
pip3 install torch numpy==1.26.4 numpy-base<2.0 --index-url https://download.pytorch.org/whl/cu121
pip3 install torch numpy==1.26.4 numpy-base==1.26.4 --index-url https://download.pytorch.org/whl/cu121
fi
else
printf "Failed to install pytorch"
Expand Down
13 changes: 8 additions & 5 deletions torchrl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@

_THREAD_POOL_INIT = torch.get_num_threads()


# monkey-patch dist transforms until https://github.com/pytorch/pytorch/pull/135001/ finds a home
@property
def inv(self):
"""
def _inv(self):
"""Patched version of Transform.inv.
Returns the inverse :class:`Transform` of this transform.
This should satisfy ``t.inv.inv is t``.
"""
inv = None
Expand All @@ -71,11 +74,11 @@ def inv(self):
return inv


torch.distributions.transforms.Transform.inv = inv
torch.distributions.transforms.Transform.inv = _inv


@property
def inv(self):
def _inv(self):
inv = None
if self._inv is not None:
inv = self._inv()
Expand All @@ -91,4 +94,4 @@ def inv(self):
return inv


ComposeTransform.inv = inv
ComposeTransform.inv = _inv
Loading

0 comments on commit 8451bd8

Please sign in to comment.