Skip to content

Commit

Permalink
[Versioning] v0.5 bump (#848)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Jul 3, 2024
1 parent 53cdc61 commit 4838205
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/m1_script.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

export TENSORDICT_BUILD_VERSION=0.4.0
export TENSORDICT_BUILD_VERSION=0.5.0
4 changes: 2 additions & 2 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: |
export PATH="/opt/python/${{ matrix.python_version[1] }}/bin:$PATH"
python3 -mpip install wheel
TENSORDICT_BUILD_VERSION=0.4.0 python3 setup.py bdist_wheel
TENSORDICT_BUILD_VERSION=0.5.0 python3 setup.py bdist_wheel
# NB: wheels have the linux_x86_64 tag so we rename to manylinux1
# find . -name 'dist/*whl' -exec bash -c ' mv $0 ${0/linux/manylinux1}' {} \;
# pytorch/pytorch binaries are also manylinux_2_17 compliant but they
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
shell: bash
run: |
python3 -mpip install wheel setuptools
TENSORDICT_BUILD_VERSION=0.4.0 python3 setup.py bdist_wheel
TENSORDICT_BUILD_VERSION=0.5.0 python3 setup.py bdist_wheel
- name: Upload wheel for the test-wheel job
uses: actions/upload-artifact@v2
with:
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/distributed/dataloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
import torch
import tqdm

from tensordict import MemoryMappedTensor
from tensordict.prototype import tensorclass
from tensordict import MemoryMappedTensor, tensorclass
from torch import multiprocessing as mp, nn
from torch.distributed import rpc
from torch.utils.data import DataLoader
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/tensorclass/test_tensorclass_speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
import torch

from tensordict.prototype import tensorclass
from tensordict import tensorclass


@tensorclass
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/tensorclass/test_torch_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
import torch

from tensordict.prototype import tensorclass
from tensordict import tensorclass


@tensorclass
Expand Down
15 changes: 13 additions & 2 deletions tensordict/_lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
Tuple,
Type,
)
from warnings import warn

import numpy as np

Expand Down Expand Up @@ -1695,8 +1696,18 @@ def _apply_nest(
)
for i, (td, *oth) in enumerate(zip(self.tensordicts, *others))
]
if filter_empty and all(r is None for r in results):
return
if all(r is None for r in results):
if filter_empty is None:
warn(
"Your resulting tensordict has no leaves but you did not specify filter_empty=True. "
"This now returns None (filter_empty=True). "
"To silence this warning, set filter_empty to the desired value in your call to `apply`. "
"This warning will be removed in v0.6.",
category=DeprecationWarning,
)
return
elif filter_empty:
return
if not inplace:
out = type(self)(
*results,
Expand Down
9 changes: 5 additions & 4 deletions tensordict/_td.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,12 +1237,13 @@ def make_result(names=names, batch_size=batch_size):
# After we introduce the new behaviour, we will have to consider what happens
# to empty tensordicts by default: will they disappear or stay?
warn(
"Your resulting tensordict has no leaves but you did not specify filter_empty=False. "
"Currently, this returns an empty tree (filter_empty=True), but from v0.5 it will return "
"a None unless filter_empty=False. "
"To silence this warning, set filter_empty to the desired value in your call to `apply`.",
"Your resulting tensordict has no leaves but you did not specify filter_empty=True. "
"This now returns None (filter_empty=True). "
"To silence this warning, set filter_empty to the desired value in your call to `apply`. "
"This warning will be removed in v0.6.",
category=DeprecationWarning,
)
return
if result is None:
result = make_result()

Expand Down
3 changes: 2 additions & 1 deletion tensordict/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def pad_sequence(
)
if batch_first is not None:
warnings.warn(
"The batch_first argument is deprecated and will be removed in a future release. The output will always be batch_first.",
"The batch_first argument is deprecated and will be removed in v0.6. "
"The output will always be batch_first.",
category=DeprecationWarning,
)

Expand Down
3 changes: 2 additions & 1 deletion tensordict/nn/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,8 @@ def forward(
# special rule for TensorDictModule that states that the second arg is
# likely to be the module params.
warnings.warn(
"tensordict_out will be deprecated soon.",
"tensordict_out will be deprecated in v0.6. "
"Make sure you have removed any such arg by then.",
category=DeprecationWarning,
)
if len(args):
Expand Down
4 changes: 2 additions & 2 deletions tensordict/nn/probabilistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _insert_interaction_mode_deprecation_warning(
) -> Callable[[str, Warning, int], None]:
return warn(
(
f"{prefix}interaction_mode is deprecated for naming clarity. "
f"{prefix}interaction_mode is deprecated for naming clarity and will be removed in v0.6. "
f"Please use {prefix}interaction_type with InteractionType enum instead."
),
DeprecationWarning,
Expand Down Expand Up @@ -413,7 +413,7 @@ def log_prob(self, tensordict):
@property
def SAMPLE_LOG_PROB_KEY(self):
warnings.warn(
"SAMPLE_LOG_PROB_KEY will be deprecated soon."
"SAMPLE_LOG_PROB_KEY will be deprecated in v0.6."
"Use 'obj.log_prob_key' instead",
category=DeprecationWarning,
)
Expand Down
3 changes: 0 additions & 3 deletions tensordict/prototype/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from tensordict.prototype.fx import symbolic_trace
from tensordict.prototype.tensorclass import is_tensorclass, tensorclass

__all__ = [
"is_tensorclass",
"symbolic_trace",
"tensorclass",
]
23 changes: 0 additions & 23 deletions tensordict/prototype/tensorclass.py

This file was deleted.

2 changes: 1 addition & 1 deletion tensordict/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def _get_item(tensor: Tensor, index: IndexType) -> Tensor:
if index.dtype is torch.bool:
warnings.warn(
"Indexing a tensor with a nested list of boolean values is "
"going to be deprecated as this functionality is not supported "
"going to be deprecated in v0.6 as this functionality is not supported "
f"by PyTorch. (follows error: {err})",
category=DeprecationWarning,
)
Expand Down
3 changes: 1 addition & 2 deletions tutorials/sphinx_tuto/tensorclass_fashion.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import torch
import torch.nn as nn

from tensordict import MemoryMappedTensor
from tensordict.prototype import tensorclass
from tensordict import MemoryMappedTensor, tensorclass
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision.transforms import ToTensor
Expand Down
3 changes: 1 addition & 2 deletions tutorials/sphinx_tuto/tensorclass_imagenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
import torch.nn as nn
import tqdm

from tensordict import MemoryMappedTensor
from tensordict.prototype import tensorclass
from tensordict import MemoryMappedTensor, tensorclass
from tensordict.utils import strtobool
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.0
0.5.0

0 comments on commit 4838205

Please sign in to comment.