Skip to content
2 changes: 1 addition & 1 deletion requirements-npu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ peft>=0.15.2
pyarrow>=15.0.0
pybind11
pylatexenc
tensordict>=0.8.0,<=0.9.1,!=0.9.0
tensordict>=0.8.0,<=0.10.0,!=0.9.0
transformers==4.52.4
ray==2.46.0
wandb
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pybind11
pylatexenc
pre-commit
ray[default]
tensordict>=0.8.0,<=0.9.1,!=0.9.0
tensordict>=0.8.0,<=0.10.0,!=0.9.0
torchdata
transformers
# vllm==0.8.4
Expand Down
2 changes: 1 addition & 1 deletion requirements_sglang.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pyarrow>=19.0.0
pybind11
pylatexenc
ray[default]>=2.10
tensordict>=0.8.0,<=0.9.1,!=0.9.0
tensordict>=0.8.0,<=0.10.0,!=0.9.0
torchdata
torchvision
transformers
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"pylatexenc",
"ray[default]>=2.41.0",
"torchdata",
"tensordict>=0.8.0,<=0.9.1,!=0.9.0",
"tensordict>=0.8.0,<=0.10.0,!=0.9.0",
"transformers",
"wandb",
"packaging>=20.0",
Expand All @@ -49,9 +49,9 @@
GEO_REQUIRES = ["mathruler", "torchvision", "qwen_vl_utils"]
GPU_REQUIRES = ["liger-kernel", "flash-attn"]
MATH_REQUIRES = ["math-verify"] # Add math-verify as an optional dependency
VLLM_REQUIRES = ["tensordict>=0.8.0,<=0.9.1,!=0.9.0", "vllm>=0.7.3,<=0.9.1"]
VLLM_REQUIRES = ["tensordict>=0.8.0,<=0.10.0,!=0.9.0", "vllm>=0.7.3,<=0.9.1"]
SGLANG_REQUIRES = [
"tensordict>=0.8.0,<=0.9.1,!=0.9.0",
"tensordict>=0.8.0,<=0.10.0,!=0.9.0",
"sglang[srt,openai]==0.4.10.post2",
"torch==2.7.1",
]
Expand Down
6 changes: 5 additions & 1 deletion tests/special_sanity/validate_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ def main() -> None:
parser.add_argument(
"--allow-files",
nargs="*",
default=["tests/test_protocol_on_cpu.py", "tests/test_base_config_on_cpu.py"],
default=[
"tests/test_protocol_on_cpu.py",
"tests/test_base_config_on_cpu.py",
"tests/test_protocol_v2_on_cpu.py",
],
help="Extra top-level test folders that are exempt from the rule",
)
args = parser.parse_args()
Expand Down
16 changes: 16 additions & 0 deletions tests/test_protocol_on_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

import numpy as np
import pytest
import tensordict
import torch
from packaging.version import parse as parse_version
from tensordict import TensorDict

from verl import DataProto
Expand Down Expand Up @@ -598,3 +600,17 @@ def test_dataproto_chunk_after_index():
selected = data[torch_int_mask]
assert isinstance(selected.batch.batch_size, torch.Size)
assert all(isinstance(d, int) for d in selected.batch.batch_size)


@pytest.mark.skipif(
parse_version(tensordict.__version__) < parse_version("0.10"), reason="requires at least tensordict 0.10"
)
def test_to_tensordict():
obs = torch.tensor([1, 2, 3, 4, 5, 6])
labels = ["a", "b", "c", "d", "e", "f"]
data = DataProto.from_dict(tensors={"obs": obs}, non_tensors={"labels": labels}, meta_info={"name": "abdce"})
output = data.to_tensordict()

assert torch.all(torch.eq(output["obs"], obs)).item()
assert output["labels"] == labels
assert output["name"] == "abdce"
Loading
Loading