Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8660256f0 | ||
|
|
a66f8bed1b | ||
|
|
d1f366b1bc | ||
|
|
eb89285418 | ||
|
|
9e1c011ce1 | ||
|
|
d507aeafc0 | ||
|
|
3dd3b30e75 | ||
|
|
3a5f617969 | ||
|
|
c268702f55 | ||
|
|
62702bafa7 | ||
|
|
35b452b01c | ||
|
|
2e29c66fd7 |
+43
-2
@@ -103,11 +103,35 @@ ARG TARGETARCH
|
||||
COPY scripts/docker-arm64-post-install.sh /app/scripts/docker-arm64-post-install.sh
|
||||
RUN if [ "$TARGETARCH" = "arm64" ]; then /app/scripts/docker-arm64-post-install.sh; fi
|
||||
|
||||
FROM python:3.12-slim
|
||||
# Trim the CUDA toolkit to the nvcc-JIT essentials in a separate stage, so the runtime
|
||||
# COPY ships only the trimmed result (~1.5 GB) instead of the full ~6.6 GB. Drops the math
|
||||
# runtime libs (cublas/cusparse/cufft/cusolver/curand/npp/nvjpeg) and big static .a
|
||||
# archives since nvcc JIT (TileLang/FlashInfer build their own kernels) and torch
|
||||
# (uses pinned nvidia-* wheels) needs them. Keeps nvcc/nvvm/ptxas + headers +
|
||||
# libcudart/libnvrtc/libcudadevrt for JIT compile+link.
|
||||
FROM builder AS cuda-trim
|
||||
RUN find /usr/local/cuda-12.8/targets/*/lib \
|
||||
\( -name 'libcublas*' -o -name 'libcusparse*' -o -name 'libcufft*' \
|
||||
-o -name 'libcusolver*' -o -name 'libcurand*' -o -name 'libnpp*' \
|
||||
-o -name 'libnvjpeg*' -o -name 'libnvblas*' \) -delete \
|
||||
&& find /usr/local/cuda-12.8 -name '*.a' ! -name 'libcudadevrt.a' ! -name 'libcudart_static.a' -delete
|
||||
|
||||
# CUDA 13 runtime libs source
|
||||
FROM nvidia/cuda:13.0.1-runtime-ubuntu24.04 AS cuda13
|
||||
RUN mkdir -p /cu13 && cp -d $(find /usr/local \
|
||||
-name 'libcudart.so.13*' -o -name 'libnvrtc.so.13*' -o -name 'libnvrtc-builtins.so.13*') /cu13/
|
||||
|
||||
# Runtime image
|
||||
FROM nvidia/cuda:12.8.1-base-ubuntu24.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
--no-install-recommends \
|
||||
--force-yes \
|
||||
python3.12 \
|
||||
python3.12-venv \
|
||||
python3.12-dev \
|
||||
build-essential \
|
||||
wget \
|
||||
clang \
|
||||
@@ -128,13 +152,30 @@ RUN apt-get update && apt-get install -y \
|
||||
libibverbs1 \
|
||||
ibverbs-providers \
|
||||
librdmacm1 \
|
||||
&& ln -sf /usr/bin/python3.12 /usr/local/bin/python \
|
||||
&& apt-get clean autoclean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# CUDA 12.8 toolkit (TileLang's runtime nvcc JIT)
|
||||
COPY --from=cuda-trim /usr/local/cuda-12.8 /usr/local/cuda-12.8
|
||||
RUN ln -sfn /usr/local/cuda-12.8 /usr/local/cuda && test -x /usr/local/cuda/bin/nvcc
|
||||
ENV CUDA_HOME=/usr/local/cuda
|
||||
ENV PATH="/usr/local/cuda/bin:${PATH}"
|
||||
|
||||
# CUDA 13 runtime libs for deep-gemm
|
||||
COPY --from=cuda13 /cu13/ /opt/cuda13/lib64/
|
||||
RUN echo /opt/cuda13/lib64 > /etc/ld.so.conf.d/cuda13.conf \
|
||||
&& ldconfig \
|
||||
&& ldconfig -p | grep -q libcudart.so.13 \
|
||||
&& ldconfig -p | grep -q libnvrtc.so.13
|
||||
|
||||
|
||||
ARG USER_ID=1000
|
||||
ARG GROUP_ID=1000
|
||||
RUN groupadd --gid $GROUP_ID appuser && \
|
||||
|
||||
RUN userdel -r ubuntu 2>/dev/null || true; \
|
||||
groupdel ubuntu 2>/dev/null || true; \
|
||||
groupadd --gid $GROUP_ID appuser && \
|
||||
useradd --uid $USER_ID --gid appuser --create-home --shell /bin/bash appuser && \
|
||||
usermod -aG sudo appuser && \
|
||||
echo "appuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||
|
||||
@@ -21,8 +21,9 @@ group_size = 16
|
||||
max_completion_tokens = 64
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "color-codeword"
|
||||
args = { images_per_turn = 1, max_turns = 3, num_examples = 1000, seed = 42 }
|
||||
name = "color-codeword"
|
||||
taskset = { id = "color-codeword-v1", images_per_turn = 1, num_examples = 1000 }
|
||||
harness = { id = "default", runtime = { type = "subprocess" } }
|
||||
|
||||
[trainer]
|
||||
|
||||
|
||||
@@ -40,8 +40,9 @@ enforce = false
|
||||
max_completion_tokens = 64
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "color-codeword"
|
||||
args = { images_per_turn = 1, max_turns = 3, num_examples = 1000, seed = 42 }
|
||||
name = "color-codeword"
|
||||
taskset = { id = "color-codeword-v1", images_per_turn = 1, num_examples = 1000 }
|
||||
harness = { id = "default", runtime = { type = "subprocess" } }
|
||||
|
||||
# Default renderer (AutoRendererConfig) resolves Qwen3-VL-4B-Instruct from
|
||||
# MODEL_RENDERER_MAP to Qwen3VLRenderer at runtime; no explicit name needed.
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# math-python
|
||||
|
||||
## Setup
|
||||
|
||||
Install the environment as local packages
|
||||
|
||||
```bash
|
||||
uv pip install -e ~/research-environments/environments/math_env
|
||||
uv pip install -e ~/research-environments/environments/code_env
|
||||
uv pip install -e ~/research-environments/environments/science_env
|
||||
uv pip install -e ~/research-environments/environments/logic_env
|
||||
```
|
||||
|
||||
## RL
|
||||
|
||||
```bash
|
||||
uv run --no-sync rl @ configs/env_mix/env_mix.toml --log.level debug
|
||||
```
|
||||
@@ -1,52 +0,0 @@
|
||||
max_steps = 300
|
||||
seq_len = 8192
|
||||
|
||||
[deployment]
|
||||
num_train_gpus = 4
|
||||
num_infer_gpus = 4
|
||||
|
||||
[wandb]
|
||||
project = "env-mix-debug"
|
||||
name = "env-mix"
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 512
|
||||
group_size = 16
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "math-env"
|
||||
name = "math"
|
||||
args = { min_avg_reward = 0.1, rubric_max_workers = 128 }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "code-env"
|
||||
name = "code"
|
||||
args = { min_avg_reward = 0.1 }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "science-env"
|
||||
name = "science"
|
||||
args = { min_avg_reward = 0.1, pool_size = 128, rubric_max_workers = 128 }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "logic-env"
|
||||
name = "logic"
|
||||
args = { min_avg_reward = 0.1 }
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "math-env"
|
||||
name = "math-python"
|
||||
args = { min_avg_reward = 0.1, sandbox_client_max_workers = 128, sandbox_timeout_minutes = 10, sandbox_memory_gb = 1, sandbox_disk_size_gb = 1, pip_install_packages = "numpy sympy", python_tool = true, rubric_max_workers = 128 }
|
||||
|
||||
[trainer]
|
||||
|
||||
[inference]
|
||||
api_server_count = 8
|
||||
gpu_memory_utilization = 0.8
|
||||
|
||||
[inference.model]
|
||||
tool_call_parser = "hermes"
|
||||
max_model_len = 8192
|
||||
@@ -27,7 +27,8 @@ interval = 10
|
||||
max_completion_tokens = 2048
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "math500"
|
||||
name = "math500"
|
||||
taskset = { id = "math500-v1" }
|
||||
num_examples = 30
|
||||
group_size = 4
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
max_steps = 500
|
||||
|
||||
[wandb]
|
||||
project = "math-group-debug"
|
||||
name = "math-group"
|
||||
|
||||
[model]
|
||||
name = "Qwen/Qwen3-4B-Instruct-2507"
|
||||
|
||||
[orchestrator]
|
||||
batch_size = 256
|
||||
group_size = 8
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "math-env"
|
||||
name = "hendrycks-math"
|
||||
args = { dataset_name = "PrimeIntellect/Hendrycks-Math", dataset_subset = "default" }
|
||||
ratio = 0.5
|
||||
|
||||
[[orchestrator.train.env]]
|
||||
id = "math-env"
|
||||
name = "acereason-math"
|
||||
args = { dataset_name = "nvidia/AceReason-Math", dataset_subset = "default", question_key = "problem" }
|
||||
ratio = 0.5
|
||||
|
||||
[orchestrator.eval]
|
||||
interval = 50
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
name = "aime2024"
|
||||
taskset = { id = "aime24-v1" }
|
||||
num_examples = 30
|
||||
group_size = 4
|
||||
|
||||
[trainer.model]
|
||||
seq_len = 4096
|
||||
|
||||
[inference.model]
|
||||
max_model_len = 2048
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ interval = 10
|
||||
max_completion_tokens = 2048
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "math500"
|
||||
name = "math500"
|
||||
taskset = { id = "math500-v1" }
|
||||
num_examples = 30
|
||||
group_size = 4
|
||||
|
||||
|
||||
@@ -61,7 +61,8 @@ interval = 10
|
||||
max_completion_tokens = 4096
|
||||
|
||||
[[orchestrator.eval.env]]
|
||||
id = "math500"
|
||||
name = "math500"
|
||||
taskset = { id = "math500-v1" }
|
||||
num_examples = 30
|
||||
group_size = 4
|
||||
|
||||
|
||||
Vendored
+1
-1
Submodule deps/research-environments updated: dbc58e141e...99ebd2e133
Vendored
+1
-1
Submodule deps/verifiers updated: b055799fc6...aa95826d4e
@@ -83,10 +83,6 @@ class BaseModelConfig(BaseConfig):
|
||||
vlm: "VLMConfig | None" = None
|
||||
"""VLM configuration. Setting this enables vision-language model support."""
|
||||
|
||||
@property
|
||||
def is_vlm(self) -> bool:
|
||||
return self.vlm is not None
|
||||
|
||||
|
||||
class ElasticConfig(BaseConfig):
|
||||
hostname: str
|
||||
|
||||
+20
-38
@@ -33,7 +33,7 @@ dependencies = [
|
||||
"setproctitle>=1.3.0",
|
||||
"uvloop>=0.21.0",
|
||||
"torchtitan",
|
||||
"verifiers>=0.1.15.dev388",
|
||||
"verifiers>=0.1.15.dev400",
|
||||
"renderers",
|
||||
"dion",
|
||||
"tilelang>=0.1.8",
|
||||
@@ -67,32 +67,14 @@ flash-attn-cute = [
|
||||
]
|
||||
envs = [
|
||||
"alphabet-sort",
|
||||
"code-env",
|
||||
"color-codeword",
|
||||
"deepdive",
|
||||
"general-agent",
|
||||
"gpqa",
|
||||
"hle",
|
||||
"ifeval",
|
||||
"livecodebench",
|
||||
"logic-env",
|
||||
"math-env",
|
||||
"math-python",
|
||||
"math500",
|
||||
"mini-swe-agent-plus",
|
||||
"mmlu-pro",
|
||||
"opencode-cp",
|
||||
"opencode-deepdive",
|
||||
"opencode-math",
|
||||
"opencode-science",
|
||||
"opencode-swe",
|
||||
"reverse-text",
|
||||
"rlm-swe",
|
||||
"rlm-search",
|
||||
"uuid-ctf-v1",
|
||||
"science-env",
|
||||
"simpleqa-verified",
|
||||
"tau2-bench",
|
||||
"wiki-search",
|
||||
"wordle",
|
||||
"reverse-text-v1",
|
||||
@@ -104,6 +86,9 @@ envs = [
|
||||
"alphabet-sort-v1",
|
||||
"scaleswe-v1",
|
||||
"color-codeword-v1",
|
||||
"deepdive-v1",
|
||||
"gpqa-v1",
|
||||
"livecodebench-v1",
|
||||
"r2e-gym-v1",
|
||||
"terminal-bench-2-v1",
|
||||
"code-golf-v1",
|
||||
@@ -116,6 +101,12 @@ envs = [
|
||||
"general-agent-v1",
|
||||
"swebench-verified-v1",
|
||||
"tau2-bench-v1",
|
||||
"math500-v1",
|
||||
"mmlu-pro-v1",
|
||||
"ifeval-v1",
|
||||
"simpleqa-verified-v1",
|
||||
"i3-code-v1",
|
||||
"i3-science-v1",
|
||||
]
|
||||
disagg = [
|
||||
"deep-ep ; platform_machine == 'x86_64'",
|
||||
@@ -175,7 +166,7 @@ override-dependencies = [
|
||||
"transformers==5.6.2",
|
||||
"torch>=2.9.0",
|
||||
"openenv-core",
|
||||
"verifiers>=0.1.15.dev388",
|
||||
"verifiers>=0.1.15.dev400",
|
||||
]
|
||||
|
||||
# ModelExpress 0.3.0 publishes protobuf<6 metadata, but its generated proto is
|
||||
@@ -228,32 +219,14 @@ verifiers = { path = "deps/verifiers", editable = true }
|
||||
renderers = { path = "deps/renderers", editable = true }
|
||||
prime-pydantic-config = { path = "deps/pydantic-config", editable = true }
|
||||
alphabet-sort = { path = "deps/verifiers/environments/alphabet_sort", editable = true }
|
||||
code-env = { path = "deps/research-environments/environments/code_env", editable = true }
|
||||
color-codeword = { path = "deps/research-environments/environments/color_codeword", editable = true }
|
||||
deepdive = { path = "deps/research-environments/environments/deepdive", editable = true }
|
||||
general-agent = { path = "deps/research-environments/environments/general_agent", editable = true }
|
||||
gpqa = { path = "deps/research-environments/environments/gpqa", editable = true }
|
||||
hle = { path = "deps/research-environments/environments/hle", editable = true }
|
||||
ifeval = { path = "deps/research-environments/environments/ifeval", editable = true }
|
||||
livecodebench = { path = "deps/research-environments/environments/livecodebench", editable = true }
|
||||
logic-env = { path = "deps/research-environments/environments/logic_env", editable = true }
|
||||
math-env = { path = "deps/research-environments/environments/math_env", editable = true }
|
||||
math-python = { path = "deps/verifiers/environments/math_python", editable = true }
|
||||
math500 = { path = "deps/research-environments/environments/math500", editable = true }
|
||||
mini-swe-agent-plus = { path = "deps/research-environments/environments/mini_swe_agent_plus", editable = true }
|
||||
mmlu-pro = { path = "deps/research-environments/environments/mmlu_pro", editable = true }
|
||||
opencode-cp = { path = "deps/research-environments/environments/opencode_cp", editable = true }
|
||||
opencode-deepdive = { path = "deps/research-environments/environments/opencode_deepdive", editable = true }
|
||||
opencode-math = { path = "deps/research-environments/environments/opencode_math", editable = true }
|
||||
opencode-science = { path = "deps/research-environments/environments/opencode_science", editable = true }
|
||||
opencode-swe = { path = "deps/research-environments/environments/opencode_swe", editable = true }
|
||||
reverse-text = { path = "deps/verifiers/environments/reverse_text", editable = true }
|
||||
rlm-swe = { path = "deps/research-environments/environments/rlm_swe", editable = true }
|
||||
rlm-search = { path = "deps/research-environments/environments/rlm_search", editable = true }
|
||||
uuid-ctf-v1 = { path = "deps/research-environments/environments/uuid_ctf_v1", editable = true }
|
||||
science-env = { path = "deps/research-environments/environments/science_env", editable = true }
|
||||
simpleqa-verified = { path = "deps/research-environments/environments/simpleqa_verified", editable = true }
|
||||
tau2-bench = { path = "deps/research-environments/environments/tau2_bench", editable = true }
|
||||
wiki-search = { path = "deps/verifiers/environments/wiki_search", editable = true }
|
||||
wordle = { path = "deps/verifiers/environments/wordle", editable = true }
|
||||
reverse-text-v1 = { path = "deps/verifiers/environments/reverse_text_v1", editable = true }
|
||||
@@ -265,6 +238,9 @@ aime26-v1 = { path = "deps/research-environments/environments/aime26_v1", editab
|
||||
alphabet-sort-v1 = { path = "deps/verifiers/environments/alphabet_sort_v1", editable = true }
|
||||
scaleswe-v1 = { path = "deps/research-environments/environments/scaleswe_v1", editable = true }
|
||||
color-codeword-v1 = { path = "deps/verifiers/environments/color_codeword_v1", editable = true }
|
||||
deepdive-v1 = { path = "deps/research-environments/environments/deepdive_v1", editable = true }
|
||||
gpqa-v1 = { path = "deps/research-environments/environments/gpqa_v1", editable = true }
|
||||
livecodebench-v1 = { path = "deps/research-environments/environments/livecodebench_v1", editable = true }
|
||||
r2e-gym-v1 = { path = "deps/research-environments/environments/r2e_gym_v1", editable = true }
|
||||
terminal-bench-2-v1 = { path = "deps/research-environments/environments/terminal_bench_2_v1", editable = true }
|
||||
code-golf-v1 = { path = "deps/verifiers/environments/code_golf_v1", editable = true }
|
||||
@@ -277,6 +253,12 @@ wordle-v1 = { path = "deps/verifiers/environments/wordle_v1", editable = true }
|
||||
general-agent-v1 = { path = "deps/research-environments/environments/general_agent_v1", editable = true }
|
||||
swebench-verified-v1 = { path = "deps/research-environments/environments/swebench_verified_v1", editable = true }
|
||||
tau2-bench-v1 = { path = "deps/research-environments/environments/tau2_bench_v1", editable = true }
|
||||
math500-v1 = { path = "deps/research-environments/environments/math500_v1", editable = true }
|
||||
mmlu-pro-v1 = { path = "deps/research-environments/environments/mmlu_pro_v1", editable = true }
|
||||
ifeval-v1 = { path = "deps/research-environments/environments/ifeval_v1", editable = true }
|
||||
simpleqa-verified-v1 = { path = "deps/research-environments/environments/simpleqa_verified_v1", editable = true }
|
||||
i3-code-v1 = { path = "deps/research-environments/environments/i3_code_v1", editable = true }
|
||||
i3-science-v1 = { path = "deps/research-environments/environments/i3_science_v1", editable = true }
|
||||
torch = { index = "pytorch-cu128" }
|
||||
torchvision = { index = "pytorch-cu128" }
|
||||
torchaudio = { index = "pytorch-cu128" }
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
"""Prime-RL extensions to vLLM's `/inference/v1/generate` handler.
|
||||
|
||||
vLLM 0.20 ships a generic tokens-in / tokens-out handler at
|
||||
vLLM 0.22 ships a generic tokens-in / tokens-out handler at
|
||||
``vllm.entrypoints.serve.disagg.serving.ServingTokens`` that already covers
|
||||
prefix-cache salting, lora dispatch, multimodal features, prompt logprobs and
|
||||
priority. Three prime-RL features are not in the upstream protocol though, so
|
||||
we subclass it to add them back:
|
||||
prefix-cache salting, lora dispatch, multimodal features, prompt logprobs,
|
||||
priority, ``data_parallel_rank`` header routing and server-side ``max_tokens``
|
||||
defaulting. We subclass it for the bits still missing from the upstream handler:
|
||||
|
||||
1. ``data_parallel_rank`` routing — read from the ``X-data-parallel-rank``
|
||||
header and forwarded to ``engine_client.generate``. The DP-replicated
|
||||
inference servers prime-RL runs need this to target a specific replica.
|
||||
header and forwarded to ``engine_client.generate``. Upstream ``ServingTokens``
|
||||
now does this too; we keep the equivalent path for the DP-replicated
|
||||
inference servers prime-RL runs.
|
||||
|
||||
2. Compact ``routed_experts`` export — when the engine emits routing
|
||||
decisions, surface them as base64 raw-byte payloads without requiring a vLLM
|
||||
source fork.
|
||||
|
||||
3. Server-side ``max_tokens`` defaulting — ``ServingTokens`` hands the
|
||||
client-supplied ``SamplingParams`` to the engine verbatim, and
|
||||
``SamplingParams.max_tokens`` defaults to ``16`` (a dataclass-level
|
||||
default that predates the OpenAI-compat layer). Every other vLLM
|
||||
endpoint masks this server-side via
|
||||
``vllm.entrypoints.utils.get_max_tokens`` (see e.g.
|
||||
``OpenAIServingChat`` at ``serving.py:284``); the disagg endpoint
|
||||
skips that path. Mirror it here so callers that omit ``max_tokens``
|
||||
don't silently truncate at 16. Drop once vLLM patches upstream.
|
||||
3. Server-side ``max_tokens`` defaulting — upstream ``ServingTokens`` now applies
|
||||
this itself (via ``GenerateRequest.is_sampling_param_provided`` +
|
||||
``get_max_tokens``); we keep an equivalent guard so callers that omit
|
||||
``max_tokens`` don't truncate at vLLM's 16-token ``SamplingParams`` default.
|
||||
|
||||
Everything else (request/response schema, sampling params, error handling)
|
||||
delegates to upstream so we track future vLLM changes for free.
|
||||
@@ -156,7 +152,7 @@ class PrimeRlServingTokens(ServingTokens):
|
||||
|
||||
@cached_property
|
||||
def _max_tokens_defaults(self) -> tuple[dict, int | None]:
|
||||
"""Server-side ``max_tokens`` defaulting inputs, mirroring ``OpenAIServingChat``.
|
||||
"""Server-side ``max_tokens`` defaulting inputs, mirroring upstream ``ServingTokens``.
|
||||
|
||||
Computed lazily because ``custom_init_app_state`` swaps in this
|
||||
subclass via ``object.__new__`` + ``__dict__.update`` (so our
|
||||
@@ -180,7 +176,7 @@ class PrimeRlServingTokens(ServingTokens):
|
||||
request: GenerateRequest,
|
||||
raw_request: Request | None = None,
|
||||
) -> PrimeRlGenerateResponse | ErrorResponse | AsyncGenerator[str, None]:
|
||||
# Mirrors upstream ``ServingTokens.serve_tokens`` (vllm 0.20). Diffs:
|
||||
# Mirrors upstream ``ServingTokens.serve_tokens`` (vllm 0.22). Diffs:
|
||||
# (a) inject ``data_parallel_rank`` from the inbound header into
|
||||
# ``engine_client.generate``; (b) default ``sampling_params.max_tokens``
|
||||
# to ``max_model_len - prompt_len`` when the caller didn't set it; and
|
||||
@@ -253,10 +249,10 @@ class PrimeRlServingTokens(ServingTokens):
|
||||
extra["kv_transfer_params"] = request.kv_transfer_params
|
||||
sampling_params.extra_args = extra
|
||||
|
||||
# Server-side ``max_tokens`` defaulting — see module docstring.
|
||||
# Mirrors ``OpenAIServingChat`` (vllm/entrypoints/openai/chat_completion/
|
||||
# serving.py:284) so callers that omit ``max_tokens`` don't get capped
|
||||
# at vLLM's 16-token ``SamplingParams`` default.
|
||||
# Server-side ``max_tokens`` defaulting — see module docstring. Upstream
|
||||
# ``ServingTokens`` now does this too; kept here so callers that omit
|
||||
# ``max_tokens`` don't get capped at vLLM's 16-token ``SamplingParams``
|
||||
# default.
|
||||
if not await _client_set_max_tokens(raw_request):
|
||||
diff_sp, override = self._max_tokens_defaults
|
||||
sampling_params.max_tokens = get_max_tokens(
|
||||
|
||||
@@ -131,7 +131,7 @@ class EvalSink:
|
||||
|
||||
if valid:
|
||||
rewards = [r.reward for r in valid]
|
||||
lens = [r.completion_len for r in valid]
|
||||
lens = [sum(b.output_len for b in r.branches) for r in valid]
|
||||
metrics.group_size = self.group_size_for(env_name)
|
||||
metrics.reward_mean = float(sum(rewards) / len(rewards))
|
||||
metrics.completion_len_mean = float(sum(lens) / len(lens))
|
||||
|
||||
@@ -22,7 +22,6 @@ if TYPE_CHECKING:
|
||||
@dataclass
|
||||
class FilterResult:
|
||||
detected: bool
|
||||
detection_index: int | None = None
|
||||
|
||||
|
||||
class RolloutFilter(Protocol):
|
||||
@@ -50,16 +49,15 @@ class GibberishFilter:
|
||||
enforce: bool = False
|
||||
|
||||
def check(self, rollout: Rollout) -> FilterResult:
|
||||
global_idx = 0
|
||||
for node in rollout.nodes:
|
||||
# token_ids / logprobs / mask are per-token aligned; check only the
|
||||
# sampled completion tokens, pairing each with its own logprob.
|
||||
for token_id, logprob, sampled in zip(node.token_ids, node.logprobs, node.mask):
|
||||
for branch in rollout.branches:
|
||||
# branch.{token_ids,logprobs,sampled_mask} are flat and mutually aligned; the raw
|
||||
# node arrays are not (node.logprobs covers only the sampled suffix, not the
|
||||
# generation-prompt scaffold that token_ids/mask also span).
|
||||
for token_id, logprob, sampled in zip(branch.token_ids, branch.logprobs, branch.sampled_mask):
|
||||
if not sampled:
|
||||
continue
|
||||
if token_id > self.token_id_threshold and logprob < self.logprob_threshold:
|
||||
return FilterResult(detected=True, detection_index=global_idx)
|
||||
global_idx += 1
|
||||
return FilterResult(detected=True)
|
||||
return FilterResult(detected=False)
|
||||
|
||||
|
||||
@@ -81,12 +79,12 @@ class RepetitionFilter:
|
||||
enforce: bool = False
|
||||
|
||||
def check(self, rollout: Rollout) -> FilterResult:
|
||||
consecutive = 0
|
||||
global_idx = 0
|
||||
for node in rollout.nodes:
|
||||
# Streak only over sampled completion tokens — context/prompt tokens
|
||||
# (mask=False) are not model-generated and must not feed the loop count.
|
||||
for logprob, sampled in zip(node.logprobs, node.mask):
|
||||
for branch in rollout.branches:
|
||||
# Aligned branch streams (see GibberishFilter), and reset the streak per branch:
|
||||
# flat rollout.nodes interleaves distinct root->leaf paths (compaction/subagents),
|
||||
# so a per-node walk would run a streak across a branch boundary.
|
||||
consecutive = 0
|
||||
for logprob, sampled in zip(branch.logprobs, branch.sampled_mask):
|
||||
if not sampled:
|
||||
continue
|
||||
if logprob > self.logprob_threshold:
|
||||
@@ -94,8 +92,7 @@ class RepetitionFilter:
|
||||
else:
|
||||
consecutive = 0
|
||||
if consecutive >= self.window:
|
||||
return FilterResult(detected=True, detection_index=global_idx)
|
||||
global_idx += 1
|
||||
return FilterResult(detected=True)
|
||||
return FilterResult(detected=False)
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ from transformers.configuration_utils import PretrainedConfig
|
||||
from transformers.generation import GenerationMixin
|
||||
from transformers.modeling_layers import GradientCheckpointingLayer
|
||||
from transformers.modeling_outputs import MoeModelOutputWithPast
|
||||
from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
|
||||
from transformers.models.qwen3_5_moe.modeling_qwen3_5_moe import Qwen3_5MoeVisionModel
|
||||
from transformers.processing_utils import Unpack
|
||||
from transformers.utils import TransformersKwargs, logging
|
||||
@@ -17,8 +18,8 @@ from transformers.utils import TransformersKwargs, logging
|
||||
from prime_rl.trainer.models.base import PreTrainedModelPrimeRL
|
||||
from prime_rl.trainer.models.layers.lm_head import PrimeLmOutput
|
||||
from prime_rl.trainer.models.layers.moe import FeedForward, MoE, MoEArgs
|
||||
from prime_rl.trainer.models.layers.rotary_emb import RotaryEmbedding, RotaryEmbeddingConfig, apply_rotary_pos_emb
|
||||
from prime_rl.utils.sequence import get_cu_seqlens_from_position_ids
|
||||
from prime_rl.trainer.models.layers.rotary_emb import apply_rotary_pos_emb
|
||||
from prime_rl.utils.sequence import get_cu_seqlens_from_position_ids, get_cu_seqlens_from_seq_lens
|
||||
|
||||
from .configuration_qwen3_5_moe import Qwen3_5MoeConfig
|
||||
from .converting_qwen3_5_moe import (
|
||||
@@ -27,6 +28,7 @@ from .converting_qwen3_5_moe import (
|
||||
convert_tt_layer_to_hf,
|
||||
convert_tt_to_hf_moe,
|
||||
)
|
||||
from .mrope import build_qwen3_5_mrope_position_ids
|
||||
|
||||
# Flash attention imports
|
||||
try:
|
||||
@@ -668,22 +670,113 @@ class Qwen3_5MoeDecoderLayer(GradientCheckpointingLayer):
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Model classes
|
||||
# Rotary embedding
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def _create_rotary_emb(config: Qwen3_5MoeConfig) -> RotaryEmbedding:
|
||||
if hasattr(config, "rope_scaling") and isinstance(config.rope_scaling, dict):
|
||||
rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type", "default"))
|
||||
else:
|
||||
rope_type = "default"
|
||||
class Qwen3_5MoeRotaryEmbedding(nn.Module):
|
||||
inv_freq: torch.Tensor
|
||||
|
||||
rotary_config = RotaryEmbeddingConfig(
|
||||
max_position_embeddings=config.max_position_embeddings,
|
||||
rope_type=rope_type,
|
||||
model_config=config,
|
||||
)
|
||||
return RotaryEmbedding(rotary_config)
|
||||
def __init__(self, config: Qwen3_5MoeConfig, device=None):
|
||||
super().__init__()
|
||||
self.config = config
|
||||
self.max_seq_len_cached = config.max_position_embeddings
|
||||
self.original_max_seq_len = config.max_position_embeddings
|
||||
|
||||
rope_parameters = getattr(config, "rope_parameters", None)
|
||||
if rope_parameters is None:
|
||||
config.standardize_rope_params()
|
||||
rope_parameters = config.rope_parameters
|
||||
|
||||
self.rope_type = rope_parameters.get("rope_type", rope_parameters.get("type", "default"))
|
||||
self.rope_init_fn = self.compute_default_rope_parameters
|
||||
if self.rope_type != "default":
|
||||
self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
|
||||
|
||||
inv_freq, self.attention_scaling = self.rope_init_fn(config, device)
|
||||
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
||||
self.original_inv_freq = self.inv_freq.clone()
|
||||
|
||||
self.mrope_section = rope_parameters.get("mrope_section")
|
||||
if self.mrope_section is None:
|
||||
self.mrope_section = self._scaled_default_mrope_section(self.inv_freq.numel())
|
||||
if not rope_parameters.get("mrope_interleaved", True):
|
||||
raise ValueError("Qwen3.5 MoE custom model expects interleaved MRoPE")
|
||||
if sum(self.mrope_section) != self.inv_freq.numel():
|
||||
raise ValueError(
|
||||
"Qwen3.5 mrope_section must sum to rotary_dim // 2: "
|
||||
f"mrope_section={self.mrope_section}, rotary_dim={self.inv_freq.numel() * 2}"
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _scaled_default_mrope_section(num_rotary_pairs: int) -> list[int]:
|
||||
default_section = [11, 11, 10]
|
||||
default_total = sum(default_section)
|
||||
scaled_section = [num_rotary_pairs * section // default_total for section in default_section]
|
||||
remainder = num_rotary_pairs - sum(scaled_section)
|
||||
remainder_order = sorted(
|
||||
range(len(default_section)),
|
||||
key=lambda idx: num_rotary_pairs * default_section[idx] % default_total,
|
||||
reverse=True,
|
||||
)
|
||||
for idx in remainder_order[:remainder]:
|
||||
scaled_section[idx] += 1
|
||||
return scaled_section
|
||||
|
||||
@staticmethod
|
||||
def compute_default_rope_parameters(
|
||||
config: Qwen3_5MoeConfig | None = None,
|
||||
device: Optional[torch.device] = None,
|
||||
seq_len: int | None = None,
|
||||
) -> tuple[torch.Tensor, float]:
|
||||
rope_parameters = config.rope_parameters
|
||||
base = rope_parameters["rope_theta"]
|
||||
partial_rotary_factor = rope_parameters.get("partial_rotary_factor", 1.0)
|
||||
head_dim = getattr(config, "head_dim", None) or config.hidden_size // config.num_attention_heads
|
||||
dim = int(head_dim * partial_rotary_factor)
|
||||
inv_freq = 1.0 / (
|
||||
base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)
|
||||
)
|
||||
return inv_freq, 1.0
|
||||
|
||||
@torch.no_grad()
|
||||
@dynamic_rope_update
|
||||
def forward(self, x: torch.Tensor, position_ids: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
if position_ids.ndim == 2:
|
||||
position_ids = position_ids[None, ...].expand(3, position_ids.shape[0], -1)
|
||||
elif position_ids.ndim != 3:
|
||||
raise ValueError(f"Qwen3.5 position_ids must be 2D or 3D, got shape={tuple(position_ids.shape)}")
|
||||
|
||||
position_ids = position_ids.to(device=x.device)
|
||||
inv_freq_expanded = self.inv_freq[None, None, :, None].float().expand(3, position_ids.shape[1], -1, 1)
|
||||
position_ids_expanded = position_ids[:, :, None, :].float()
|
||||
|
||||
device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
|
||||
with torch.autocast(device_type=device_type, enabled=False):
|
||||
freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(2, 3)
|
||||
freqs = self._apply_interleaved_mrope(freqs)
|
||||
emb = torch.cat((freqs, freqs), dim=-1)
|
||||
cos = emb.cos() * self.attention_scaling
|
||||
sin = emb.sin() * self.attention_scaling
|
||||
|
||||
return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
|
||||
|
||||
def _apply_interleaved_mrope(self, freqs: torch.Tensor) -> torch.Tensor:
|
||||
freqs_t = freqs[0].clone()
|
||||
for dim, offset in enumerate((1, 2), start=1):
|
||||
length = self.mrope_section[dim] * 3
|
||||
idx = slice(offset, length, 3)
|
||||
freqs_t[..., idx] = freqs[dim, ..., idx]
|
||||
return freqs_t
|
||||
|
||||
|
||||
def _create_rotary_emb(config: Qwen3_5MoeConfig) -> Qwen3_5MoeRotaryEmbedding:
|
||||
return Qwen3_5MoeRotaryEmbedding(config)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Model classes
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class Qwen3_5MoePreTrainedModel(PreTrainedModelPrimeRL):
|
||||
@@ -757,6 +850,7 @@ class Qwen3_5MoeModel(Qwen3_5MoePreTrainedModel):
|
||||
position_ids: Optional[torch.LongTensor] = None,
|
||||
inputs_embeds: Optional[torch.FloatTensor] = None,
|
||||
routed_experts: Optional[torch.LongTensor] = None,
|
||||
seq_lens: Optional[torch.LongTensor] = None,
|
||||
) -> MoeModelOutputWithPast:
|
||||
if (input_ids is None) ^ (inputs_embeds is not None):
|
||||
raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
|
||||
@@ -764,9 +858,31 @@ class Qwen3_5MoeModel(Qwen3_5MoePreTrainedModel):
|
||||
if inputs_embeds is None:
|
||||
inputs_embeds = self.embed_tokens(input_ids)
|
||||
|
||||
if self.config._attn_implementation in ("flash_attention_2", "flash_attention_3", "fa4"):
|
||||
cu_seqlens, max_seqlen = get_cu_seqlens_from_position_ids(position_ids)
|
||||
if position_ids is None:
|
||||
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device).unsqueeze(0)
|
||||
|
||||
flash_attn_enabled = self.config._attn_implementation in ("flash_attention_2", "flash_attention_3", "fa4")
|
||||
if flash_attn_enabled:
|
||||
if position_ids.ndim == 3:
|
||||
if inputs_embeds.shape[0] != 1:
|
||||
raise ValueError("3D Qwen3.5 MRoPE positions require batch size 1 for varlen attention")
|
||||
seq_len = inputs_embeds.shape[1]
|
||||
if seq_lens is None:
|
||||
cu_seqlens = torch.tensor([0, seq_len], dtype=torch.int32, device=inputs_embeds.device)
|
||||
max_seqlen = seq_len
|
||||
else:
|
||||
cu_seqlens, max_seqlen = get_cu_seqlens_from_seq_lens(
|
||||
seq_lens.to(device=inputs_embeds.device),
|
||||
total_tokens=seq_len,
|
||||
)
|
||||
else:
|
||||
cu_seqlens, max_seqlen = get_cu_seqlens_from_position_ids(position_ids)
|
||||
torch._dynamo.mark_dynamic(cu_seqlens, 0)
|
||||
elif position_ids.ndim == 3 and seq_lens is not None:
|
||||
seq_lens = seq_lens.to(device=inputs_embeds.device)
|
||||
if seq_lens.numel() > 1 and "full_attention" in self.config.layer_types:
|
||||
raise ValueError("Packed Qwen3.5 MRoPE batches with full_attention layers require flash attention")
|
||||
cu_seqlens, max_seqlen = get_cu_seqlens_from_seq_lens(seq_lens, total_tokens=inputs_embeds.shape[1])
|
||||
else:
|
||||
max_seqlen = None
|
||||
cu_seqlens = None
|
||||
@@ -822,6 +938,16 @@ class Qwen3_5MoeVLMModel(nn.Module):
|
||||
def set_input_embeddings(self, value):
|
||||
self.language_model.embed_tokens = value
|
||||
|
||||
def _dummy_vision_inputs(self, device: torch.device) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
"""Smallest valid vision input: a single merged token (grid [1, m, m])."""
|
||||
vcfg = self.config.vision_config
|
||||
m = vcfg.spatial_merge_size
|
||||
num_patches = m * m
|
||||
patch_dim = vcfg.in_channels * vcfg.temporal_patch_size * vcfg.patch_size * vcfg.patch_size
|
||||
pixel_values = torch.zeros(num_patches, patch_dim, device=device, dtype=self.visual.dtype)
|
||||
grid_thw = torch.tensor([[1, m, m]], dtype=torch.long, device=device)
|
||||
return pixel_values, grid_thw
|
||||
|
||||
def forward(
|
||||
self,
|
||||
input_ids: torch.LongTensor | None = None,
|
||||
@@ -829,28 +955,74 @@ class Qwen3_5MoeVLMModel(nn.Module):
|
||||
inputs_embeds: torch.FloatTensor | None = None,
|
||||
pixel_values: torch.Tensor | None = None,
|
||||
image_grid_thw: torch.LongTensor | None = None,
|
||||
mm_token_type_ids: torch.LongTensor | None = None,
|
||||
routed_experts: torch.LongTensor | None = None,
|
||||
seq_lens: torch.LongTensor | None = None,
|
||||
**kwargs,
|
||||
) -> MoeModelOutputWithPast:
|
||||
if inputs_embeds is None:
|
||||
inputs_embeds = self.language_model.embed_tokens(input_ids)
|
||||
|
||||
if pixel_values is not None:
|
||||
pixel_values = pixel_values.type(self.visual.dtype)
|
||||
vision_output = self.visual(pixel_values, grid_thw=image_grid_thw, return_dict=True)
|
||||
image_embeds = vision_output.pooler_output.to(inputs_embeds.device, inputs_embeds.dtype)
|
||||
if image_grid_thw is not None and input_ids is None:
|
||||
raise ValueError("input_ids are required to compute Qwen3.5 multimodal MRoPE positions")
|
||||
if image_grid_thw is not None and mm_token_type_ids is None:
|
||||
raise ValueError(
|
||||
"Qwen3.5 multimodal forward requires mm_token_type_ids to compute MRoPE positions correctly"
|
||||
)
|
||||
if image_grid_thw is not None and position_ids is not None and position_ids.ndim != 3:
|
||||
raise ValueError(
|
||||
f"Qwen3.5 multimodal forward requires 3D MRoPE position_ids; got shape={tuple(position_ids.shape)}"
|
||||
)
|
||||
|
||||
# Keep distributed collectives in the same order when a batch mixes text-only
|
||||
# and image samples across ranks. The frozen dummy pass is discarded below.
|
||||
has_images = pixel_values is not None
|
||||
vision_grid_thw = image_grid_thw
|
||||
if has_images:
|
||||
if input_ids is None:
|
||||
raise ValueError("input_ids are required when scattering Qwen3.5 image features")
|
||||
if image_grid_thw is None:
|
||||
raise ValueError("image_grid_thw is required when pixel_values are provided")
|
||||
pixel_values = pixel_values.type(self.visual.dtype)
|
||||
else:
|
||||
pixel_values, vision_grid_thw = self._dummy_vision_inputs(inputs_embeds.device)
|
||||
|
||||
vision_output = self.visual(pixel_values, grid_thw=vision_grid_thw, return_dict=True)
|
||||
image_embeds = vision_output.pooler_output.to(inputs_embeds.device, inputs_embeds.dtype)
|
||||
|
||||
if has_images:
|
||||
image_mask = input_ids == self.config.image_token_id
|
||||
image_token_count = int(image_mask.sum().item())
|
||||
image_feature_count = int(image_embeds.shape[0])
|
||||
if image_token_count != image_feature_count:
|
||||
raise ValueError(
|
||||
"Qwen VLM image token/feature mismatch before scatter: "
|
||||
f"image_token_id={self.config.image_token_id}, "
|
||||
f"image_tokens={image_token_count}, image_features={image_feature_count}, "
|
||||
f"input_ids_shape={tuple(input_ids.shape)}, "
|
||||
f"pixel_values_shape={tuple(pixel_values.shape)}, "
|
||||
f"image_grid_thw_shape={tuple(image_grid_thw.shape) if image_grid_thw is not None else None}"
|
||||
)
|
||||
image_mask = image_mask.unsqueeze(-1).expand_as(inputs_embeds).to(inputs_embeds.device)
|
||||
inputs_embeds = inputs_embeds.masked_scatter(image_mask, image_embeds)
|
||||
|
||||
if position_ids is None:
|
||||
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device).unsqueeze(0)
|
||||
if image_grid_thw is not None:
|
||||
position_ids = build_qwen3_5_mrope_position_ids(
|
||||
input_ids=input_ids,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
image_grid_thw=image_grid_thw,
|
||||
spatial_merge_size=self.config.vision_config.spatial_merge_size,
|
||||
seq_lens=seq_lens,
|
||||
)
|
||||
else:
|
||||
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device).unsqueeze(0)
|
||||
|
||||
return self.language_model(
|
||||
inputs_embeds=inputs_embeds,
|
||||
position_ids=position_ids,
|
||||
routed_experts=routed_experts,
|
||||
seq_lens=seq_lens,
|
||||
)
|
||||
|
||||
|
||||
@@ -997,12 +1169,15 @@ class Qwen3_5MoeForCausalLM(Qwen3_5MoePreTrainedModel, GenerationMixin):
|
||||
routed_experts: Optional[torch.LongTensor] = None,
|
||||
pixel_values: Optional[torch.Tensor] = None,
|
||||
image_grid_thw: Optional[torch.LongTensor] = None,
|
||||
mm_token_type_ids: Optional[torch.LongTensor] = None,
|
||||
seq_lens: Optional[torch.LongTensor] = None,
|
||||
**kwargs: Unpack[TransformersKwargs],
|
||||
) -> PrimeLmOutput:
|
||||
assert use_cache is None, "use_cache is not supported for custom qwen3_5_moe for now"
|
||||
assert past_key_values is None, "past_key_values is not supported for custom qwen3_5_moe for now"
|
||||
|
||||
if position_ids is None:
|
||||
has_vlm_image_inputs = self._is_vlm and image_grid_thw is not None
|
||||
if position_ids is None and not has_vlm_image_inputs:
|
||||
if inputs_embeds is not None:
|
||||
position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device).unsqueeze(0)
|
||||
elif input_ids is not None:
|
||||
@@ -1015,7 +1190,9 @@ class Qwen3_5MoeForCausalLM(Qwen3_5MoePreTrainedModel, GenerationMixin):
|
||||
inputs_embeds=inputs_embeds,
|
||||
pixel_values=pixel_values,
|
||||
image_grid_thw=image_grid_thw,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
routed_experts=routed_experts,
|
||||
seq_lens=seq_lens,
|
||||
)
|
||||
else:
|
||||
outputs = self.model(
|
||||
@@ -1023,6 +1200,7 @@ class Qwen3_5MoeForCausalLM(Qwen3_5MoePreTrainedModel, GenerationMixin):
|
||||
position_ids=position_ids,
|
||||
inputs_embeds=inputs_embeds,
|
||||
routed_experts=routed_experts,
|
||||
seq_lens=seq_lens,
|
||||
)
|
||||
|
||||
hidden_states = outputs.last_hidden_state
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import itertools
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
def get_qwen3_5_vision_position_ids(
|
||||
*,
|
||||
start_position: int,
|
||||
grid_thw: torch.Tensor,
|
||||
spatial_merge_size: int,
|
||||
temp_merge_size: int = 1,
|
||||
time_interval: int = 1,
|
||||
device: torch.device | None = None,
|
||||
) -> torch.LongTensor:
|
||||
llm_grid_t = int(grid_thw[0].item()) // temp_merge_size
|
||||
llm_grid_h = int(grid_thw[1].item()) // spatial_merge_size
|
||||
llm_grid_w = int(grid_thw[2].item()) // spatial_merge_size
|
||||
|
||||
position_temporal = torch.arange(llm_grid_t, device=device) * time_interval
|
||||
position_height = torch.arange(llm_grid_h, device=device) + start_position
|
||||
position_width = torch.arange(llm_grid_w, device=device) + start_position
|
||||
|
||||
position_width = position_width.repeat(llm_grid_h * llm_grid_t)
|
||||
position_height = position_height.repeat_interleave(llm_grid_w).repeat(llm_grid_t)
|
||||
position_temporal = position_temporal.repeat_interleave(llm_grid_h * llm_grid_w) + start_position
|
||||
return torch.stack([position_temporal, position_height, position_width], dim=0)
|
||||
|
||||
|
||||
def build_qwen3_5_mrope_position_ids(
|
||||
*,
|
||||
input_ids: torch.LongTensor,
|
||||
mm_token_type_ids: torch.LongTensor,
|
||||
image_grid_thw: torch.LongTensor | None,
|
||||
spatial_merge_size: int,
|
||||
seq_lens: torch.Tensor | None = None,
|
||||
) -> torch.LongTensor:
|
||||
if input_ids.ndim != 2:
|
||||
raise ValueError(f"input_ids must be 2D, got shape={tuple(input_ids.shape)}")
|
||||
if mm_token_type_ids.shape != input_ids.shape:
|
||||
raise ValueError(
|
||||
"mm_token_type_ids must match input_ids shape: "
|
||||
f"mm_token_type_ids={tuple(mm_token_type_ids.shape)}, input_ids={tuple(input_ids.shape)}"
|
||||
)
|
||||
if input_ids.shape[0] != 1:
|
||||
raise ValueError("Packed Qwen3.5 MRoPE builder currently supports batch size 1")
|
||||
|
||||
total_seq_len = input_ids.shape[1]
|
||||
if seq_lens is None:
|
||||
seq_lens = torch.tensor([total_seq_len], dtype=torch.long, device=input_ids.device)
|
||||
else:
|
||||
seq_lens = seq_lens.to(device=input_ids.device, dtype=torch.long)
|
||||
|
||||
if seq_lens.ndim != 1:
|
||||
raise ValueError(f"seq_lens must be 1D, got shape={tuple(seq_lens.shape)}")
|
||||
if bool((seq_lens <= 0).any().item()):
|
||||
raise ValueError(f"seq_lens must be positive, got {seq_lens.tolist()}")
|
||||
if int(seq_lens.sum().item()) != total_seq_len:
|
||||
raise ValueError(f"seq_lens sum must equal sequence length: {seq_lens.tolist()} vs {total_seq_len}")
|
||||
|
||||
image_grids = iter(image_grid_thw) if image_grid_thw is not None else None
|
||||
all_positions = torch.empty(3, 1, total_seq_len, dtype=input_ids.dtype, device=input_ids.device)
|
||||
|
||||
offset = 0
|
||||
for seq_len_tensor in seq_lens:
|
||||
seq_len = int(seq_len_tensor.item())
|
||||
token_types = mm_token_type_ids[0, offset : offset + seq_len]
|
||||
current_pos = 0
|
||||
segment_positions = []
|
||||
|
||||
for modality_type, group in itertools.groupby(enumerate(token_types.tolist()), lambda item: item[1]):
|
||||
group = list(group)
|
||||
group_len = group[-1][0] - group[0][0] + 1
|
||||
|
||||
if modality_type == 0:
|
||||
segment_positions.append(
|
||||
torch.arange(group_len, device=input_ids.device).view(1, -1).expand(3, -1) + current_pos
|
||||
)
|
||||
current_pos += group_len
|
||||
continue
|
||||
|
||||
if modality_type == 2:
|
||||
raise ValueError("Qwen3.5 video MRoPE is not supported by the custom trainer path yet")
|
||||
if modality_type != 1:
|
||||
raise ValueError(f"Unsupported Qwen3.5 multimodal token type: {modality_type}")
|
||||
if image_grids is None:
|
||||
raise ValueError("image_grid_thw is required when mm_token_type_ids contains image tokens")
|
||||
|
||||
remaining = group_len
|
||||
while remaining > 0:
|
||||
try:
|
||||
grid_thw = next(image_grids)
|
||||
except StopIteration as exc:
|
||||
raise ValueError("Not enough image_grid_thw rows for image token groups") from exc
|
||||
|
||||
vision_positions = get_qwen3_5_vision_position_ids(
|
||||
start_position=current_pos,
|
||||
grid_thw=grid_thw,
|
||||
spatial_merge_size=spatial_merge_size,
|
||||
device=input_ids.device,
|
||||
)
|
||||
image_len = vision_positions.shape[1]
|
||||
if image_len > remaining:
|
||||
raise ValueError(
|
||||
"Image token group length does not match image_grid_thw-derived token count: "
|
||||
f"group_len={group_len}, grid_thw={grid_thw.tolist()}, "
|
||||
f"derived={image_len}, spatial_merge_size={spatial_merge_size}"
|
||||
)
|
||||
segment_positions.append(vision_positions)
|
||||
current_pos += max(int(grid_thw[1].item()), int(grid_thw[2].item())) // spatial_merge_size
|
||||
remaining -= image_len
|
||||
|
||||
if not segment_positions:
|
||||
raise ValueError("Cannot build MRoPE positions for an empty sequence segment")
|
||||
|
||||
segment_position_ids = torch.cat(segment_positions, dim=1)
|
||||
if segment_position_ids.shape[1] != seq_len:
|
||||
raise ValueError(
|
||||
f"Built MRoPE length does not match segment length: {segment_position_ids.shape[1]} vs {seq_len}"
|
||||
)
|
||||
all_positions[:, 0, offset : offset + seq_len] = segment_position_ids
|
||||
offset += seq_len
|
||||
|
||||
if image_grids is not None:
|
||||
try:
|
||||
extra_grid = next(image_grids)
|
||||
except StopIteration:
|
||||
pass
|
||||
else:
|
||||
raise ValueError(f"Unused image_grid_thw row while building MRoPE positions: {extra_grid.tolist()}")
|
||||
|
||||
return all_positions
|
||||
@@ -92,17 +92,11 @@ def render_messages(
|
||||
tools: list[dict[str, Any]] | None = None,
|
||||
chat_template_kwargs: dict[str, Any] | None = None,
|
||||
add_generation_prompt: bool = False,
|
||||
processor=None,
|
||||
) -> list[int]:
|
||||
kwargs = dict(chat_template_kwargs or {})
|
||||
kwargs["add_generation_prompt"] = add_generation_prompt
|
||||
if tools is not None:
|
||||
kwargs["tools"] = tools
|
||||
if processor is not None:
|
||||
kwargs["tokenize"] = True
|
||||
kwargs["return_dict"] = True
|
||||
result = processor.apply_chat_template(messages, **kwargs)
|
||||
return list(result["input_ids"][0])
|
||||
kwargs["return_dict"] = False
|
||||
return list(tokenizer.apply_chat_template(messages, **kwargs))
|
||||
|
||||
@@ -115,7 +109,6 @@ def build_incremental_token_mask(
|
||||
tools: list[dict[str, Any]] | None = None,
|
||||
chat_template_kwargs: dict[str, Any] | None = None,
|
||||
collapse_consecutive_tool_messages: bool = False,
|
||||
processor=None,
|
||||
) -> tuple[list[int], list[bool]]:
|
||||
token_mask: list[bool] = []
|
||||
prev_ids: list[int] = []
|
||||
@@ -133,7 +126,6 @@ def build_incremental_token_mask(
|
||||
tools=tools,
|
||||
chat_template_kwargs=chat_template_kwargs,
|
||||
add_generation_prompt=should_add_generation_prompt(messages, idx),
|
||||
processor=processor,
|
||||
)
|
||||
|
||||
if prev_ids != cur_ids[:prev_len]:
|
||||
|
||||
@@ -73,10 +73,6 @@ class InferencePool(Protocol):
|
||||
"""Update weights on all inference servers."""
|
||||
...
|
||||
|
||||
def get_metrics(self) -> dict[str, float]:
|
||||
"""Get pool metrics."""
|
||||
...
|
||||
|
||||
async def stop(self) -> None:
|
||||
"""Stop the inference pool."""
|
||||
...
|
||||
@@ -141,9 +137,6 @@ class StaticInferencePool:
|
||||
async def update_weights(self, weight_dir: Path | None, lora_name: str | None = None, step: int = 0) -> None:
|
||||
await update_weights(self._admin_clients, weight_dir, lora_name=lora_name, step=step)
|
||||
|
||||
def get_metrics(self) -> dict[str, float]:
|
||||
return {}
|
||||
|
||||
async def stop(self) -> None:
|
||||
pass
|
||||
|
||||
|
||||
@@ -499,10 +499,3 @@ class ElasticInferencePool:
|
||||
if lora_name is None:
|
||||
raise ValueError("Elastic inference pool requires LoRA training (lora_name must be set)")
|
||||
await self.sync_weights(weight_dir, lora_name, step)
|
||||
|
||||
def get_metrics(self) -> dict[str, float]:
|
||||
return {
|
||||
"elastic/num_servers": self.num_servers,
|
||||
"elastic/num_ready_servers": self.num_ready_servers,
|
||||
"elastic/desired_step": self._desired.step,
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
"""Message utilities — normalize, deserialize tool calls, strip content."""
|
||||
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
|
||||
def normalize_messages(messages: Any, default_role: str) -> list[dict[str, Any]]:
|
||||
if messages is None:
|
||||
return []
|
||||
if isinstance(messages, str):
|
||||
return [{"role": default_role, "content": messages}]
|
||||
if isinstance(messages, dict):
|
||||
return [dict(messages)]
|
||||
if isinstance(messages, list):
|
||||
normalized: list[dict[str, Any]] = []
|
||||
for message in messages:
|
||||
if isinstance(message, str):
|
||||
normalized.append({"role": default_role, "content": message})
|
||||
elif isinstance(message, dict):
|
||||
normalized.append(dict(message))
|
||||
else:
|
||||
raise TypeError(f"Unsupported message type: {type(message)}")
|
||||
return normalized
|
||||
raise TypeError(f"Unsupported messages container type: {type(messages)}")
|
||||
|
||||
|
||||
def deserialize_tool_calls(messages: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
def _deserialize_tool_call(tool_call: dict[str, Any]) -> dict[str, Any]:
|
||||
function = tool_call.get("function", {})
|
||||
arguments = function.get("arguments")
|
||||
if isinstance(arguments, str):
|
||||
arguments = json.loads(arguments)
|
||||
return {
|
||||
**tool_call,
|
||||
"function": {**function, "arguments": arguments},
|
||||
}
|
||||
|
||||
deserialized_messages: list[dict[str, Any]] = []
|
||||
for message in messages:
|
||||
if "tool_calls" not in message:
|
||||
deserialized_messages.append(dict(message))
|
||||
continue
|
||||
|
||||
tool_calls = message.get("tool_calls") or []
|
||||
deserialized_messages.append(
|
||||
{
|
||||
**message,
|
||||
"tool_calls": [_deserialize_tool_call(tc) for tc in tool_calls],
|
||||
}
|
||||
)
|
||||
|
||||
return deserialized_messages
|
||||
|
||||
|
||||
def strip_message_content(messages: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
def _strip(message: dict[str, Any]) -> dict[str, Any]:
|
||||
content = message.get("content")
|
||||
if isinstance(content, str):
|
||||
return {**message, "content": content.strip()}
|
||||
return message
|
||||
|
||||
return [_strip(message) for message in messages]
|
||||
@@ -33,3 +33,20 @@ def get_cu_seqlens_from_position_ids(position_ids: torch.Tensor) -> tuple[torch.
|
||||
cu_seqlens[1:] = seqlens.cumsum(dim=0, dtype=torch.int32)
|
||||
|
||||
return cu_seqlens, seqlens.max().item()
|
||||
|
||||
|
||||
def get_cu_seqlens_from_seq_lens(seq_lens: torch.Tensor, total_tokens: int | None = None) -> tuple[torch.Tensor, int]:
|
||||
if seq_lens.ndim != 1:
|
||||
raise ValueError(f"seq_lens must be 1D, got shape={tuple(seq_lens.shape)}")
|
||||
if seq_lens.numel() == 0:
|
||||
raise ValueError("seq_lens must not be empty")
|
||||
if bool((seq_lens <= 0).any().item()):
|
||||
raise ValueError(f"seq_lens must be positive, got {seq_lens.tolist()}")
|
||||
if total_tokens is not None and int(seq_lens.sum().item()) != total_tokens:
|
||||
raise ValueError(f"seq_lens sum must equal sequence length: {seq_lens.tolist()} vs {total_tokens}")
|
||||
|
||||
seq_lens = seq_lens.to(dtype=torch.int32)
|
||||
cu_seqlens = torch.empty(seq_lens.numel() + 1, dtype=torch.int32, device=seq_lens.device)
|
||||
cu_seqlens[0] = 0
|
||||
cu_seqlens[1:] = seq_lens.cumsum(dim=0, dtype=torch.int32)
|
||||
return cu_seqlens, int(seq_lens.max().item())
|
||||
|
||||
@@ -25,6 +25,21 @@ def _assistant_node(token_ids: list[int], logprobs: list[float]) -> vf.MessageNo
|
||||
)
|
||||
|
||||
|
||||
def _scaffold_assistant_node(
|
||||
completion_ids: list[int], completion_logprobs: list[float], *, scaffold: int = 2
|
||||
) -> vf.MessageNode:
|
||||
"""A realistic v1 assistant node: a leading generation-prompt scaffold (mask=False, not
|
||||
model-sampled) then the sampled completion. ``logprobs`` cover only the completion suffix
|
||||
(vLLM returns logprobs for generated tokens only) — the exact layout where per-node
|
||||
``zip(token_ids, logprobs, mask)`` mispairs and the branch streams normalize."""
|
||||
return vf.MessageNode(
|
||||
message=vf.AssistantMessage(content="x"),
|
||||
token_ids=[1] * scaffold + completion_ids,
|
||||
mask=[False] * scaffold + [True] * len(completion_ids),
|
||||
logprobs=completion_logprobs,
|
||||
)
|
||||
|
||||
|
||||
def _make_rollout(
|
||||
completion_ids: list[int],
|
||||
completion_logprobs: list[float],
|
||||
@@ -74,7 +89,6 @@ def test_gibberish_detects_rare_low_prob_token():
|
||||
)
|
||||
)
|
||||
assert result.detected is True
|
||||
assert result.detection_index == 1
|
||||
|
||||
|
||||
def test_gibberish_ignores_normal_tokens():
|
||||
@@ -87,7 +101,6 @@ def test_gibberish_ignores_normal_tokens():
|
||||
)
|
||||
)
|
||||
assert result.detected is False
|
||||
assert result.detection_index is None
|
||||
|
||||
|
||||
def test_gibberish_ignores_high_prob_rare_token():
|
||||
@@ -113,7 +126,23 @@ def test_gibberish_works_across_trajectory_steps():
|
||||
)
|
||||
)
|
||||
assert result.detected is True
|
||||
assert result.detection_index == 2
|
||||
|
||||
|
||||
def test_gibberish_aligns_logprobs_under_generation_prompt_scaffold():
|
||||
"""Regression: the assistant node carries a generation-prompt scaffold (mask=False) and
|
||||
suffix-only logprobs, and the gibberish token is the LAST completion token. The old
|
||||
per-node ``zip(token_ids, logprobs, mask)`` truncated at len(logprobs) and never examined
|
||||
it; reading the aligned branch streams detects it."""
|
||||
gibberish_filter = _make_gibberish_filter()
|
||||
|
||||
rollout = Rollout[vf.Task](
|
||||
task=vf.Task(idx=0, prompt=""),
|
||||
nodes=[_scaffold_assistant_node([50, 80, 120_000], [-1.0, -0.5, gibberish_filter.logprob_threshold - 1.0])],
|
||||
rewards={"reward": 1.0},
|
||||
)
|
||||
|
||||
result = gibberish_filter.check(rollout)
|
||||
assert result.detected is True
|
||||
|
||||
|
||||
# --- RepetitionFilter tests ---
|
||||
@@ -129,7 +158,6 @@ def test_repetition_triggers_after_window():
|
||||
)
|
||||
)
|
||||
assert result.detected is True
|
||||
assert result.detection_index == 4
|
||||
|
||||
|
||||
def test_repetition_no_trigger_below_window():
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
import pytest
|
||||
import torch
|
||||
from transformers.models.qwen3_5_moe.modeling_qwen3_5_moe import (
|
||||
Qwen3_5MoeTextRotaryEmbedding as HFQwen3_5MoeRotaryEmbedding,
|
||||
)
|
||||
|
||||
from prime_rl.trainer.models.qwen3_5_moe import Qwen3_5MoeConfig
|
||||
from prime_rl.trainer.models.qwen3_5_moe.modeling_qwen3_5_moe import Qwen3_5MoeRotaryEmbedding
|
||||
from prime_rl.trainer.models.qwen3_5_moe.mrope import build_qwen3_5_mrope_position_ids
|
||||
|
||||
|
||||
def _tiny_config() -> Qwen3_5MoeConfig:
|
||||
return Qwen3_5MoeConfig(
|
||||
vocab_size=128,
|
||||
hidden_size=128,
|
||||
num_attention_heads=2,
|
||||
num_key_value_heads=1,
|
||||
head_dim=64,
|
||||
num_hidden_layers=1,
|
||||
rope_parameters={
|
||||
"rope_type": "default",
|
||||
"rope_theta": 10000000,
|
||||
"partial_rotary_factor": 0.25,
|
||||
"mrope_section": [3, 3, 2],
|
||||
"mrope_interleaved": True,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def test_qwen35_mrope_text_only_positions():
|
||||
input_ids = torch.tensor([[10, 11, 12, 13]])
|
||||
mm_token_type_ids = torch.zeros_like(input_ids)
|
||||
|
||||
position_ids = build_qwen3_5_mrope_position_ids(
|
||||
input_ids=input_ids,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
image_grid_thw=None,
|
||||
spatial_merge_size=2,
|
||||
)
|
||||
|
||||
expected = torch.arange(4).view(1, 1, -1).expand(3, 1, -1)
|
||||
torch.testing.assert_close(position_ids, expected)
|
||||
|
||||
|
||||
def test_qwen35_mrope_single_image_with_surrounding_text():
|
||||
input_ids = torch.tensor([[10, 11, 99, 99, 99, 99, 12]])
|
||||
mm_token_type_ids = torch.tensor([[0, 0, 1, 1, 1, 1, 0]])
|
||||
image_grid_thw = torch.tensor([[1, 4, 4]])
|
||||
|
||||
position_ids = build_qwen3_5_mrope_position_ids(
|
||||
input_ids=input_ids,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
image_grid_thw=image_grid_thw,
|
||||
spatial_merge_size=2,
|
||||
)
|
||||
|
||||
expected = torch.tensor(
|
||||
[
|
||||
[[0, 1, 2, 2, 2, 2, 4]],
|
||||
[[0, 1, 2, 2, 3, 3, 4]],
|
||||
[[0, 1, 2, 3, 2, 3, 4]],
|
||||
]
|
||||
)
|
||||
torch.testing.assert_close(position_ids, expected)
|
||||
|
||||
|
||||
def test_qwen35_mrope_adjacent_images_consume_multiple_grids():
|
||||
input_ids = torch.tensor([[10, 99, 99, 99, 99, 99, 99, 99, 99, 11]])
|
||||
mm_token_type_ids = torch.tensor([[0, 1, 1, 1, 1, 1, 1, 1, 1, 0]])
|
||||
image_grid_thw = torch.tensor([[1, 4, 4], [1, 4, 4]])
|
||||
|
||||
position_ids = build_qwen3_5_mrope_position_ids(
|
||||
input_ids=input_ids,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
image_grid_thw=image_grid_thw,
|
||||
spatial_merge_size=2,
|
||||
)
|
||||
|
||||
expected = torch.tensor(
|
||||
[
|
||||
[[0, 1, 1, 1, 1, 3, 3, 3, 3, 5]],
|
||||
[[0, 1, 1, 2, 2, 3, 3, 4, 4, 5]],
|
||||
[[0, 1, 2, 1, 2, 3, 4, 3, 4, 5]],
|
||||
]
|
||||
)
|
||||
torch.testing.assert_close(position_ids, expected)
|
||||
|
||||
|
||||
def test_qwen35_mrope_packed_segments_reset_independently():
|
||||
input_ids = torch.tensor([[10, 99, 99, 99, 99, 11, 99, 99, 99, 99]])
|
||||
mm_token_type_ids = torch.tensor([[0, 1, 1, 1, 1, 0, 1, 1, 1, 1]])
|
||||
image_grid_thw = torch.tensor([[1, 4, 4], [1, 4, 4]])
|
||||
seq_lens = torch.tensor([5, 5])
|
||||
|
||||
position_ids = build_qwen3_5_mrope_position_ids(
|
||||
input_ids=input_ids,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
image_grid_thw=image_grid_thw,
|
||||
spatial_merge_size=2,
|
||||
seq_lens=seq_lens,
|
||||
)
|
||||
|
||||
expected_segment = torch.tensor(
|
||||
[
|
||||
[0, 1, 1, 1, 1],
|
||||
[0, 1, 1, 2, 2],
|
||||
[0, 1, 2, 1, 2],
|
||||
]
|
||||
)
|
||||
torch.testing.assert_close(position_ids[:, 0, :5], expected_segment)
|
||||
torch.testing.assert_close(position_ids[:, 0, 5:], expected_segment)
|
||||
|
||||
|
||||
def test_qwen35_mrope_packed_matches_standalone_segments():
|
||||
segment_input_ids = torch.tensor([[10, 99, 99, 99, 99, 11]])
|
||||
segment_token_types = torch.tensor([[0, 1, 1, 1, 1, 0]])
|
||||
image_grid_thw = torch.tensor([[1, 4, 4]])
|
||||
|
||||
standalone = build_qwen3_5_mrope_position_ids(
|
||||
input_ids=segment_input_ids,
|
||||
mm_token_type_ids=segment_token_types,
|
||||
image_grid_thw=image_grid_thw,
|
||||
spatial_merge_size=2,
|
||||
)
|
||||
packed = build_qwen3_5_mrope_position_ids(
|
||||
input_ids=torch.cat([segment_input_ids, segment_input_ids], dim=1),
|
||||
mm_token_type_ids=torch.cat([segment_token_types, segment_token_types], dim=1),
|
||||
image_grid_thw=torch.cat([image_grid_thw, image_grid_thw], dim=0),
|
||||
spatial_merge_size=2,
|
||||
seq_lens=torch.tensor([segment_input_ids.shape[1], segment_input_ids.shape[1]]),
|
||||
)
|
||||
|
||||
torch.testing.assert_close(packed[:, :, : segment_input_ids.shape[1]], standalone)
|
||||
torch.testing.assert_close(packed[:, :, segment_input_ids.shape[1] :], standalone)
|
||||
|
||||
|
||||
def test_qwen35_mrope_rejects_image_length_grid_mismatch():
|
||||
input_ids = torch.tensor([[10, 99, 99]])
|
||||
mm_token_type_ids = torch.tensor([[0, 1, 1]])
|
||||
image_grid_thw = torch.tensor([[1, 4, 4]])
|
||||
|
||||
with pytest.raises(ValueError, match="Image token group length"):
|
||||
build_qwen3_5_mrope_position_ids(
|
||||
input_ids=input_ids,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
image_grid_thw=image_grid_thw,
|
||||
spatial_merge_size=2,
|
||||
)
|
||||
|
||||
|
||||
def test_qwen35_mrope_rejects_video_tokens():
|
||||
input_ids = torch.tensor([[10, 99]])
|
||||
mm_token_type_ids = torch.tensor([[0, 2]])
|
||||
|
||||
with pytest.raises(ValueError, match="video MRoPE"):
|
||||
build_qwen3_5_mrope_position_ids(
|
||||
input_ids=input_ids,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
image_grid_thw=None,
|
||||
spatial_merge_size=2,
|
||||
)
|
||||
|
||||
|
||||
def test_qwen35_rotary_matches_hf_for_2d_and_3d_positions():
|
||||
config = _tiny_config()
|
||||
prime_rotary = Qwen3_5MoeRotaryEmbedding(config)
|
||||
hf_rotary = HFQwen3_5MoeRotaryEmbedding(config)
|
||||
hidden_states = torch.randn(1, 6, config.hidden_size)
|
||||
|
||||
text_positions = torch.arange(6).unsqueeze(0)
|
||||
prime_cos, prime_sin = prime_rotary(hidden_states, text_positions)
|
||||
hf_cos, hf_sin = hf_rotary(hidden_states, text_positions)
|
||||
torch.testing.assert_close(prime_cos, hf_cos)
|
||||
torch.testing.assert_close(prime_sin, hf_sin)
|
||||
|
||||
mrope_positions = torch.stack(
|
||||
[
|
||||
torch.tensor([[0, 1, 2, 2, 2, 4]]),
|
||||
torch.tensor([[0, 1, 2, 2, 3, 4]]),
|
||||
torch.tensor([[0, 1, 2, 3, 2, 4]]),
|
||||
]
|
||||
)
|
||||
prime_cos, prime_sin = prime_rotary(hidden_states, mrope_positions)
|
||||
hf_cos, hf_sin = hf_rotary(hidden_states, mrope_positions)
|
||||
torch.testing.assert_close(prime_cos, hf_cos)
|
||||
torch.testing.assert_close(prime_sin, hf_sin)
|
||||
@@ -35,6 +35,7 @@ def _tiny_vlm_config():
|
||||
tc.linear_num_key_heads = 4
|
||||
tc.linear_num_value_heads = 8
|
||||
tc.use_cache = False
|
||||
tc.rope_parameters["mrope_section"] = [3, 3, 2]
|
||||
|
||||
vc = config.vision_config
|
||||
vc.depth = 2
|
||||
@@ -62,6 +63,12 @@ def _make_image_inputs(config, device="cuda", dtype=torch.float32):
|
||||
return pixel_values, image_grid_thw, num_image_tokens
|
||||
|
||||
|
||||
def _make_mm_token_type_ids(input_ids, image_token_id):
|
||||
mm_token_type_ids = torch.zeros_like(input_ids)
|
||||
mm_token_type_ids[input_ids == image_token_id] = 1
|
||||
return mm_token_type_ids
|
||||
|
||||
|
||||
def test_vlm_forward():
|
||||
"""Custom VLM produces logits for both text-only and multimodal inputs."""
|
||||
config = _tiny_vlm_config()
|
||||
@@ -82,8 +89,14 @@ def test_vlm_forward():
|
||||
text_part = torch.randint(0, 200, (1, 10), device="cuda")
|
||||
img_part = torch.full((1, n_img_tokens), config.image_token_id, device="cuda")
|
||||
input_ids_mm = torch.cat([text_part[:, :5], img_part, text_part[:, 5:]], dim=1)
|
||||
mm_token_type_ids = _make_mm_token_type_ids(input_ids_mm, config.image_token_id)
|
||||
|
||||
out_mm = model(input_ids=input_ids_mm, pixel_values=pixel_values, image_grid_thw=image_grid_thw)
|
||||
out_mm = model(
|
||||
input_ids=input_ids_mm,
|
||||
pixel_values=pixel_values,
|
||||
image_grid_thw=image_grid_thw,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
)
|
||||
assert out_mm["logits"].shape == (1, input_ids_mm.shape[1], vocab)
|
||||
|
||||
|
||||
@@ -98,8 +111,14 @@ def test_vlm_backward():
|
||||
text_part = torch.randint(0, 200, (1, 10), device="cuda")
|
||||
img_part = torch.full((1, n_img_tokens), config.image_token_id, device="cuda")
|
||||
input_ids = torch.cat([text_part[:, :5], img_part, text_part[:, 5:]], dim=1)
|
||||
mm_token_type_ids = _make_mm_token_type_ids(input_ids, config.image_token_id)
|
||||
|
||||
out = model(input_ids=input_ids, pixel_values=pixel_values, image_grid_thw=image_grid_thw)
|
||||
out = model(
|
||||
input_ids=input_ids,
|
||||
pixel_values=pixel_values,
|
||||
image_grid_thw=image_grid_thw,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
)
|
||||
out["logits"].sum().backward()
|
||||
|
||||
assert model.model.language_model.embed_tokens.weight.grad is not None
|
||||
@@ -170,6 +189,42 @@ def test_vlm_weight_roundtrip():
|
||||
assert torch.equal(roundtripped[original_vision_key], original_vision_weight)
|
||||
|
||||
|
||||
def test_vlm_forward_requires_mm_token_type_ids():
|
||||
"""Image MRoPE needs renderer-supplied modality token types."""
|
||||
config = _tiny_vlm_config()
|
||||
with torch.device("cuda"), default_dtype(torch.float32):
|
||||
model = Qwen3_5MoeForCausalLM(config)
|
||||
inject_prime_lm_head(model)
|
||||
|
||||
pixel_values, image_grid_thw, n_img_tokens = _make_image_inputs(config)
|
||||
input_ids = torch.full((1, n_img_tokens), config.image_token_id, device="cuda")
|
||||
|
||||
with pytest.raises(ValueError, match="mm_token_type_ids"):
|
||||
model(input_ids=input_ids, pixel_values=pixel_values, image_grid_thw=image_grid_thw)
|
||||
|
||||
|
||||
def test_vlm_forward_rejects_2d_positions_with_images():
|
||||
"""Trainer 1D/2D packed positions are not valid image MRoPE coordinates."""
|
||||
config = _tiny_vlm_config()
|
||||
with torch.device("cuda"), default_dtype(torch.float32):
|
||||
model = Qwen3_5MoeForCausalLM(config)
|
||||
inject_prime_lm_head(model)
|
||||
|
||||
pixel_values, image_grid_thw, n_img_tokens = _make_image_inputs(config)
|
||||
input_ids = torch.full((1, n_img_tokens), config.image_token_id, device="cuda")
|
||||
mm_token_type_ids = _make_mm_token_type_ids(input_ids, config.image_token_id)
|
||||
position_ids = torch.arange(n_img_tokens, device="cuda").unsqueeze(0)
|
||||
|
||||
with pytest.raises(ValueError, match="3D MRoPE position_ids"):
|
||||
model(
|
||||
input_ids=input_ids,
|
||||
position_ids=position_ids,
|
||||
pixel_values=pixel_values,
|
||||
image_grid_thw=image_grid_thw,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
)
|
||||
|
||||
|
||||
def test_vlm_router_replay():
|
||||
"""routed_experts bypasses router computation in VLM multimodal forward."""
|
||||
config = _tiny_vlm_config()
|
||||
@@ -182,6 +237,7 @@ def test_vlm_router_replay():
|
||||
text_part = torch.randint(0, 200, (1, 10), device="cuda")
|
||||
img_part = torch.full((1, n_img_tokens), config.image_token_id, device="cuda")
|
||||
input_ids = torch.cat([text_part[:, :5], img_part, text_part[:, 5:]], dim=1)
|
||||
mm_token_type_ids = _make_mm_token_type_ids(input_ids, config.image_token_id)
|
||||
seq_len = input_ids.shape[1]
|
||||
|
||||
num_layers = config.text_config.num_hidden_layers
|
||||
@@ -189,7 +245,11 @@ def test_vlm_router_replay():
|
||||
routed_experts = torch.randint(0, config.text_config.num_experts, (1, seq_len, num_layers, topk), device="cuda")
|
||||
|
||||
out = model(
|
||||
input_ids=input_ids, pixel_values=pixel_values, image_grid_thw=image_grid_thw, routed_experts=routed_experts
|
||||
input_ids=input_ids,
|
||||
pixel_values=pixel_values,
|
||||
image_grid_thw=image_grid_thw,
|
||||
mm_token_type_ids=mm_token_type_ids,
|
||||
routed_experts=routed_experts,
|
||||
)
|
||||
assert out["logits"].shape == (1, seq_len, vocab)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from prime_rl.utils.sequence import get_cu_seqlens_from_position_ids
|
||||
from prime_rl.utils.sequence import get_cu_seqlens_from_position_ids, get_cu_seqlens_from_seq_lens
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -23,3 +23,16 @@ def test_get_cu_seqlens_from_position_ids_is_local_relative(
|
||||
assert cu_seqlens.dtype == torch.int32
|
||||
assert cu_seqlens.tolist() == expected_cu_seqlens
|
||||
assert max_seqlen == expected_max_seqlen
|
||||
|
||||
|
||||
def test_get_cu_seqlens_from_seq_lens():
|
||||
cu_seqlens, max_seqlen = get_cu_seqlens_from_seq_lens(torch.tensor([4, 3, 2]), total_tokens=9)
|
||||
|
||||
assert cu_seqlens.dtype == torch.int32
|
||||
assert cu_seqlens.tolist() == [0, 4, 7, 9]
|
||||
assert max_seqlen == 4
|
||||
|
||||
|
||||
def test_get_cu_seqlens_from_seq_lens_rejects_wrong_total():
|
||||
with pytest.raises(ValueError, match="sum must equal"):
|
||||
get_cu_seqlens_from_seq_lens(torch.tensor([4, 3]), total_tokens=9)
|
||||
|
||||
@@ -364,15 +364,15 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "beautifulsoup4"
|
||||
version = "4.14.3"
|
||||
version = "4.15.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "soupsieve", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "typing-extensions", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c3/b0/1c6a16426d389813b48d95e26898aff79abbde42ad353958ad95cc8c9b21/beautifulsoup4-4.14.3.tar.gz", hash = "sha256:6292b1c5186d356bba669ef9f7f051757099565ad9ada5dd630bd9de5fa7fb86", size = 627737, upload-time = "2025-11-30T15:08:26.084Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/43/65/318323f98dbee45d42dff61d8f047181bc6f2268a9068cfad035a46be5af/beautifulsoup4-4.15.0.tar.gz", hash = "sha256:288e3ca7d54b06f2ac191970bc275c1939cb46d450b255bf6718b04aa37ab4f7", size = 632571, upload-time = "2026-06-07T16:44:20.453Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1a/39/47f9197bdd44df24d67ac8893641e16f386c984a0619ef2ee4c51fbbc019/beautifulsoup4-4.14.3-py3-none-any.whl", hash = "sha256:0918bfe44902e6ad8d57732ba310582e98da931428d231a5ecb9e7c703a735bb", size = 107721, upload-time = "2025-11-30T15:08:24.087Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/88/c6/92fcd42f1ba33e1184263f25bfabf3d27c383410470f169e4b8163bf9c17/beautifulsoup4-4.15.0-py3-none-any.whl", hash = "sha256:d6f88de62e1d4e38ecb1077eb9724cd0eff29d2a08ca16a401e9b9e93f117cf9", size = 109924, upload-time = "2026-06-07T16:44:21.566Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -553,24 +553,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/88/39/799be3f2f0f38cc727ee3b4f1445fe6d5e4133064ec2e4115069418a5bb6/cloudpickle-3.1.2-py3-none-any.whl", hash = "sha256:9acb47f6afd73f60dc1df93bb801b472f05ff42fa6c84167d25cb206be1fbf4a", size = 22228, upload-time = "2025-11-03T09:25:25.534Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "code-env"
|
||||
version = "0.3.2"
|
||||
source = { editable = "deps/research-environments/environments/code_env" }
|
||||
dependencies = [
|
||||
{ name = "prime-sandboxes", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "prime-sandboxes", specifier = ">=0.2.19" },
|
||||
{ name = "pytest", marker = "extra == 'dev'" },
|
||||
{ name = "pytest-asyncio", marker = "extra == 'dev'" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
]
|
||||
provides-extras = ["dev"]
|
||||
|
||||
[[package]]
|
||||
name = "code-golf-v1"
|
||||
version = "0.1.0"
|
||||
@@ -582,21 +564,6 @@ dependencies = [
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers" }]
|
||||
|
||||
[[package]]
|
||||
name = "color-codeword"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/color_codeword" }
|
||||
dependencies = [
|
||||
{ name = "pillow", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "pillow", specifier = ">=10.0.0" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "color-codeword-v1"
|
||||
version = "0.1.0"
|
||||
@@ -873,24 +840,20 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deepdive"
|
||||
version = "0.2.9"
|
||||
source = { editable = "deps/research-environments/environments/deepdive" }
|
||||
name = "deepdive-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/deepdive_v1" }
|
||||
dependencies = [
|
||||
{ name = "aiohttp", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "diskcache", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "pdfminer-six", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "openai", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "aiohttp", specifier = ">=3.10.0" },
|
||||
{ name = "datasets", specifier = ">=4.0.0" },
|
||||
{ name = "diskcache", specifier = ">=5.6.0" },
|
||||
{ name = "pdfminer-six", specifier = ">=20251107" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
{ name = "datasets" },
|
||||
{ name = "openai" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1135,11 +1098,11 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "fastcore"
|
||||
version = "1.13.2"
|
||||
version = "1.13.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/70/65/99f599a285033febf95f9c608d91d629ac5d9995f57e5b3ac3397097f440/fastcore-1.13.2.tar.gz", hash = "sha256:f660b3448de48ba31973b2866c994ea3cd5e0a654847f57d6911a1a4bffda777", size = 100337, upload-time = "2026-05-17T06:02:24.383Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/1d/80/8547a93161e6e1d868e1c6d0e6bd9b472486cdfaf8209727a42884b53a7d/fastcore-1.13.6.tar.gz", hash = "sha256:702fe22ff191c005e6909891125e5f7dbdd31bb8f444574e082030a31b960ead", size = 100742, upload-time = "2026-06-18T06:49:07.971Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c7/41/2c368f804bb9bd918da3b61324207fc4b410d0f32352c372c0680fc1f670/fastcore-1.13.2-py3-none-any.whl", hash = "sha256:2103c9e9e613311c0b36eab17299a221e778fd214ec526e8df1d32908928277c", size = 105060, upload-time = "2026-05-17T06:02:22.28Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/29/11/867a59ae2d233ce81da373513cabaca2abf03f0180b28e85cf3ae2d5f7f6/fastcore-1.13.6-py3-none-any.whl", hash = "sha256:59264df5bf003fcf44602b7418c6178b37d3c31ae87d8ac106139f716e73711f", size = 105794, upload-time = "2026-06-18T06:49:06.499Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1468,18 +1431,20 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpqa"
|
||||
version = "0.1.5"
|
||||
source = { editable = "deps/research-environments/environments/gpqa" }
|
||||
name = "gpqa-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/gpqa_v1" }
|
||||
dependencies = [
|
||||
{ name = "math-verify", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "openai", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "math-verify", specifier = ">=0.8.0" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
{ name = "datasets" },
|
||||
{ name = "openai" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1579,21 +1544,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/aa/b2/703569fc881f3284487e68cda7b42179978480da3c438042a6bbbb4a671c/hf_xet-1.5.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:4b35549ce62601b84da4ff9b24d970032ace3d4430f52d91bcbb26c901d6c690", size = 4672414, upload-time = "2026-05-06T06:18:09.864Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hle"
|
||||
version = "0.2.1"
|
||||
source = { editable = "deps/research-environments/environments/hle" }
|
||||
dependencies = [
|
||||
{ name = "pillow", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "pillow", specifier = ">=12.0.0" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hpack"
|
||||
version = "4.1.0"
|
||||
@@ -1710,6 +1660,38 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/48/30/47d0bf6072f7252e6521f3447ccfa40b421b6824517f82854703d0f5a98b/hyperframe-6.1.0-py3-none-any.whl", hash = "sha256:b03380493a519fce58ea5af42e4a42317bf9bd425596f7a0835ffce80f1a42e5", size = 13007, upload-time = "2025-01-22T21:41:47.295Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "i3-code-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/i3_code_v1" }
|
||||
dependencies = [
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "orjson", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "orjson" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev389" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "i3-science-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/i3_science_v1" }
|
||||
dependencies = [
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "identify"
|
||||
version = "2.6.19"
|
||||
@@ -1729,10 +1711,11 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ifeval"
|
||||
version = "0.1.1.1"
|
||||
source = { editable = "deps/research-environments/environments/ifeval" }
|
||||
name = "ifeval-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/ifeval_v1" }
|
||||
dependencies = [
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "immutabledict", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "langdetect", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "nltk", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
@@ -1741,10 +1724,11 @@ dependencies = [
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "immutabledict" },
|
||||
{ name = "langdetect" },
|
||||
{ name = "nltk" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev389" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2173,18 +2157,20 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "livecodebench"
|
||||
version = "0.2.7"
|
||||
source = { editable = "deps/research-environments/environments/livecodebench" }
|
||||
name = "livecodebench-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/livecodebench_v1" }
|
||||
dependencies = [
|
||||
{ name = "prime-sandboxes", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "huggingface-hub", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "prime-sandboxes", specifier = ">=0.2.19" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
{ name = "datasets" },
|
||||
{ name = "huggingface-hub" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev382" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2377,18 +2363,18 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "math500"
|
||||
version = "0.1.17"
|
||||
source = { editable = "deps/research-environments/environments/math500" }
|
||||
name = "math500-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/math500_v1" }
|
||||
dependencies = [
|
||||
{ name = "math-verify", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "math-verify", specifier = ">=0.8.0" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
{ name = "datasets" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2470,25 +2456,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mini-swe-agent-plus"
|
||||
version = "0.2.25"
|
||||
source = { editable = "deps/research-environments/environments/mini_swe_agent_plus" }
|
||||
dependencies = [
|
||||
{ name = "prime-sandboxes", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "swebench", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "tenacity", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "prime-sandboxes", specifier = ">=0.2.19" },
|
||||
{ name = "swebench", specifier = "==4.1.0" },
|
||||
{ name = "tenacity" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mistral-common"
|
||||
version = "1.11.2"
|
||||
@@ -2539,23 +2506,23 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mmlu-pro"
|
||||
version = "0.1.3"
|
||||
source = { editable = "deps/research-environments/environments/mmlu_pro" }
|
||||
name = "mmlu-pro-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/mmlu_pro_v1" }
|
||||
dependencies = [
|
||||
{ name = "math-verify", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "math-verify", specifier = ">=0.8.0" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
{ name = "datasets" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "modal"
|
||||
version = "1.4.3"
|
||||
version = "1.5.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "aiohttp", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
@@ -2572,9 +2539,9 @@ dependencies = [
|
||||
{ name = "typing-extensions", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "watchfiles", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c6/7d/4126d0fe879ef3e86002ca821a34cb68a2588ea2e8ccb2bfe421d0f42ffe/modal-1.4.3.tar.gz", hash = "sha256:35b2fc840f759b512e12527afb538e1ea4cc232b84cfbfcef3f5d96d5a66abaa", size = 720488, upload-time = "2026-05-18T22:34:45.842Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/59/f9/87425e60db2a8597b248417772b409c49ca3a05ff6b1282a21cd7d856f09/modal-1.5.0.tar.gz", hash = "sha256:15033cf84f5f4f9f8a3dcf47a768cfcca36d1ad38ab7b3459fd3cbc29aa84a77", size = 771722, upload-time = "2026-06-09T22:37:27.5Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/56/54/400262056c144ceee5edab40efa2541ae8928ae5f244fd9025f3ad26c909/modal-1.4.3-py3-none-any.whl", hash = "sha256:802917181f576458a0cb833322157dab09c4f367326426c5a732661a0c519577", size = 826232, upload-time = "2026-05-18T22:34:43.335Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5c/71/85e476e7d32c0a648d5aa97c4335ac02357d059c2bb734cf175b08446597/modal-1.5.0-py3-none-any.whl", hash = "sha256:9c5687eff775d1372bd70b87e43499e40777a1de160f23786c00807bf342fcb6", size = 882122, upload-time = "2026-06-09T22:37:24.608Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3146,85 +3113,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/60/c3/3d1e01e2dba517a91760e4a03e4f20ffc75039a6fe584d0e6f9b5c78fd15/openai_harmony-0.0.8-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:007b0476a1f331f8130783f901f1da6f5a7057af1a4891f1b6a31dec364189b5", size = 3205080, upload-time = "2025-11-05T19:07:05.078Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opencode-cp"
|
||||
version = "0.3.12"
|
||||
source = { editable = "deps/research-environments/environments/opencode_cp" }
|
||||
dependencies = [
|
||||
{ name = "prime-sandboxes", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "prime-sandboxes", specifier = ">=0.2.19" },
|
||||
{ name = "verifiers", extras = ["packages"], specifier = ">=0.1.15.dev17,<0.1.15.dev150" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opencode-deepdive"
|
||||
version = "0.1.17"
|
||||
source = { editable = "deps/research-environments/environments/opencode_deepdive" }
|
||||
dependencies = [
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "prime-sandboxes", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "datasets", specifier = ">=4.0.0" },
|
||||
{ name = "prime-sandboxes", specifier = ">=0.2.25" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17,<0.1.15.dev150" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opencode-math"
|
||||
version = "0.4.13"
|
||||
source = { editable = "deps/research-environments/environments/opencode_math" }
|
||||
dependencies = [
|
||||
{ name = "math-verify", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "math-verify", specifier = ">=0.8.0" },
|
||||
{ name = "verifiers", extras = ["packages"], specifier = ">=0.1.15.dev17,<0.1.15.dev150" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opencode-science"
|
||||
version = "0.3.13"
|
||||
source = { editable = "deps/research-environments/environments/opencode_science" }
|
||||
dependencies = [
|
||||
{ name = "math-verify", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "math-verify", specifier = ">=0.8.0" },
|
||||
{ name = "verifiers", extras = ["packages"], specifier = ">=0.1.15.dev17,<0.1.15.dev150" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opencode-swe"
|
||||
version = "0.4.9"
|
||||
source = { editable = "deps/research-environments/environments/opencode_swe" }
|
||||
dependencies = [
|
||||
{ name = "prime-sandboxes", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "swebench", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "prime-sandboxes", specifier = ">=0.2.23" },
|
||||
{ name = "swebench", specifier = "==4.1.0" },
|
||||
{ name = "verifiers", extras = ["packages"], specifier = ">=0.1.15.dev17,<0.1.15.dev150" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opencv-python-headless"
|
||||
version = "4.13.0.92"
|
||||
@@ -3447,19 +3335,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/42/32/658973117bf0fd82a24abbfb94fe73a5e86216e49342985e10acce54775a/partial_json_parser-0.2.1.1.post7-py3-none-any.whl", hash = "sha256:145119e5eabcf80cbb13844a6b50a85c68bf99d376f8ed771e2a3c3b03e653ae", size = 10877, upload-time = "2025-11-17T07:27:40.457Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pdfminer-six"
|
||||
version = "20260107"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "charset-normalizer", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "cryptography", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/34/a4/5cec1112009f0439a5ca6afa8ace321f0ab2f48da3255b7a1c8953014670/pdfminer_six-20260107.tar.gz", hash = "sha256:96bfd431e3577a55a0efd25676968ca4ce8fd5b53f14565f85716ff363889602", size = 8512094, upload-time = "2026-01-07T13:29:12.937Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/20/8b/28c4eaec9d6b036a52cb44720408f26b1a143ca9bce76cc19e8f5de00ab4/pdfminer_six-20260107-py3-none-any.whl", hash = "sha256:366585ba97e80dffa8f00cebe303d2f381884d8637af4ce422f1df3ef38111a9", size = 6592252, upload-time = "2026-01-07T13:29:10.742Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pexpect"
|
||||
version = "4.9.0"
|
||||
@@ -3675,43 +3550,34 @@ envs = [
|
||||
{ name = "aime26-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "alphabet-sort", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "alphabet-sort-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "code-env", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "code-golf-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "color-codeword", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "color-codeword-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "deepdive", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "deepdive-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "deepwiki-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "general-agent", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "general-agent-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "glossary-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "gpqa", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "gpqa-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "gsm8k-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "hle", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "ifeval", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "livecodebench", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "i3-code-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "i3-science-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "ifeval-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "livecodebench-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "logic-env", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "math-env", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "math-env-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "math-python", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "math500", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "mini-swe-agent-plus", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "mmlu-pro", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opencode-cp", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opencode-deepdive", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opencode-math", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opencode-science", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "opencode-swe", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "math500-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "mmlu-pro-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "r2e-gym-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "reverse-text", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "reverse-text-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "rlm-search", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "rlm-swe", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "scaleswe-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "science-env", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "simpleqa-verified", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "simpleqa-verified-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "swebench-verified-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "swelego-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "tau2-bench", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "tau2-bench-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "terminal-bench-2-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "uuid-ctf-v1", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
@@ -3762,14 +3628,12 @@ requires-dist = [
|
||||
{ name = "alphabet-sort", marker = "extra == 'envs'", editable = "deps/verifiers/environments/alphabet_sort" },
|
||||
{ name = "alphabet-sort-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/alphabet_sort_v1" },
|
||||
{ name = "beartype", specifier = ">=0.21.0" },
|
||||
{ name = "code-env", marker = "extra == 'envs'", editable = "deps/research-environments/environments/code_env" },
|
||||
{ name = "code-golf-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/code_golf_v1" },
|
||||
{ name = "color-codeword", marker = "extra == 'envs'", editable = "deps/research-environments/environments/color_codeword" },
|
||||
{ name = "color-codeword-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/color_codeword_v1" },
|
||||
{ name = "datasets", specifier = ">=4.0.0" },
|
||||
{ name = "deep-ep", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_ep-1.2.1+29d31c0-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "deep-gemm", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/PrimeIntellect-ai/prime-rl/releases/download/v0.5.0/deep_gemm-2.5.0+891d57b-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "deepdive", marker = "extra == 'envs'", editable = "deps/research-environments/environments/deepdive" },
|
||||
{ name = "deepdive-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/deepdive_v1" },
|
||||
{ name = "deepwiki-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/deepwiki_v1" },
|
||||
{ name = "dion", git = "https://github.com/samsja/dion.git?rev=d891eeb" },
|
||||
{ name = "flash-attn", marker = "platform_machine == 'x86_64' and extra == 'flash-attn'", url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.9.4/flash_attn-2.8.3+cu128torch2.11-cp312-cp312-linux_x86_64.whl" },
|
||||
@@ -3779,22 +3643,22 @@ requires-dist = [
|
||||
{ name = "general-agent", marker = "extra == 'envs'", editable = "deps/research-environments/environments/general_agent" },
|
||||
{ name = "general-agent-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/general_agent_v1" },
|
||||
{ name = "glossary-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/glossary_v1" },
|
||||
{ name = "gpqa", marker = "extra == 'envs'", editable = "deps/research-environments/environments/gpqa" },
|
||||
{ name = "gpqa-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/gpqa_v1" },
|
||||
{ name = "gsm8k-v1", marker = "extra == 'envs'", editable = "deps/verifiers/environments/gsm8k_v1" },
|
||||
{ name = "hle", marker = "extra == 'envs'", editable = "deps/research-environments/environments/hle" },
|
||||
{ name = "ifeval", marker = "extra == 'envs'", editable = "deps/research-environments/environments/ifeval" },
|
||||
{ name = "i3-code-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/i3_code_v1" },
|
||||
{ name = "i3-science-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/i3_science_v1" },
|
||||
{ name = "ifeval-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/ifeval_v1" },
|
||||
{ name = "jaxtyping", specifier = ">=0.3.2" },
|
||||
{ name = "kernels", marker = "extra == 'gpt-oss'" },
|
||||
{ name = "liger-kernel", specifier = ">=0.5.10" },
|
||||
{ name = "livecodebench", marker = "extra == 'envs'", editable = "deps/research-environments/environments/livecodebench" },
|
||||
{ name = "livecodebench-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/livecodebench_v1" },
|
||||
{ name = "logic-env", marker = "extra == 'envs'", editable = "deps/research-environments/environments/logic_env" },
|
||||
{ name = "loguru", specifier = ">=0.7.3" },
|
||||
{ name = "math-env", marker = "extra == 'envs'", editable = "deps/research-environments/environments/math_env" },
|
||||
{ name = "math-env-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/math_env_v1" },
|
||||
{ name = "math-python", marker = "extra == 'envs'", editable = "deps/verifiers/environments/math_python" },
|
||||
{ name = "math500", marker = "extra == 'envs'", editable = "deps/research-environments/environments/math500" },
|
||||
{ name = "mini-swe-agent-plus", marker = "extra == 'envs'", editable = "deps/research-environments/environments/mini_swe_agent_plus" },
|
||||
{ name = "mmlu-pro", marker = "extra == 'envs'", editable = "deps/research-environments/environments/mmlu_pro" },
|
||||
{ name = "math500-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/math500_v1" },
|
||||
{ name = "mmlu-pro-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/mmlu_pro_v1" },
|
||||
{ name = "modelexpress", marker = "extra == 'modelexpress'", specifier = "==0.3.0" },
|
||||
{ name = "mooncake-transfer-engine", specifier = ">=0.3.10.post2" },
|
||||
{ name = "msgspec", specifier = ">=0.18" },
|
||||
@@ -3803,11 +3667,6 @@ requires-dist = [
|
||||
{ name = "numpy", specifier = ">=2.2.6" },
|
||||
{ name = "nvidia-ml-py", specifier = ">=12.575.51" },
|
||||
{ name = "openai", specifier = ">=1.106.1" },
|
||||
{ name = "opencode-cp", marker = "extra == 'envs'", editable = "deps/research-environments/environments/opencode_cp" },
|
||||
{ name = "opencode-deepdive", marker = "extra == 'envs'", editable = "deps/research-environments/environments/opencode_deepdive" },
|
||||
{ name = "opencode-math", marker = "extra == 'envs'", editable = "deps/research-environments/environments/opencode_math" },
|
||||
{ name = "opencode-science", marker = "extra == 'envs'", editable = "deps/research-environments/environments/opencode_science" },
|
||||
{ name = "opencode-swe", marker = "extra == 'envs'", editable = "deps/research-environments/environments/opencode_swe" },
|
||||
{ name = "orjson", specifier = ">=3.10" },
|
||||
{ name = "orjson", specifier = ">=3.11.0" },
|
||||
{ name = "pandas", specifier = ">=2.0" },
|
||||
@@ -3832,12 +3691,10 @@ requires-dist = [
|
||||
{ name = "rlm-search", marker = "extra == 'envs'", editable = "deps/research-environments/environments/rlm_search" },
|
||||
{ name = "rlm-swe", marker = "extra == 'envs'", editable = "deps/research-environments/environments/rlm_swe" },
|
||||
{ name = "scaleswe-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/scaleswe_v1" },
|
||||
{ name = "science-env", marker = "extra == 'envs'", editable = "deps/research-environments/environments/science_env" },
|
||||
{ name = "setproctitle", specifier = ">=1.3.0" },
|
||||
{ name = "simpleqa-verified", marker = "extra == 'envs'", editable = "deps/research-environments/environments/simpleqa_verified" },
|
||||
{ name = "simpleqa-verified-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/simpleqa_verified_v1" },
|
||||
{ name = "swebench-verified-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swebench_verified_v1" },
|
||||
{ name = "swelego-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/swelego_v1" },
|
||||
{ name = "tau2-bench", marker = "extra == 'envs'", editable = "deps/research-environments/environments/tau2_bench" },
|
||||
{ name = "tau2-bench-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/tau2_bench_v1" },
|
||||
{ name = "tenacity", specifier = ">=8.2.0" },
|
||||
{ name = "terminal-bench-2-v1", marker = "extra == 'envs'", editable = "deps/research-environments/environments/terminal_bench_2_v1" },
|
||||
@@ -4668,21 +4525,6 @@ requires-dist = [
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev381" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "science-env"
|
||||
version = "0.1.4"
|
||||
source = { editable = "deps/research-environments/environments/science_env" }
|
||||
dependencies = [
|
||||
{ name = "math-verify", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "math-verify", specifier = ">=0.8.0" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scikit-learn"
|
||||
version = "1.9.0"
|
||||
@@ -4783,15 +4625,21 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simpleqa-verified"
|
||||
version = "0.1.2"
|
||||
source = { editable = "deps/research-environments/environments/simpleqa_verified" }
|
||||
name = "simpleqa-verified-v1"
|
||||
version = "0.1.0"
|
||||
source = { editable = "deps/research-environments/environments/simpleqa_verified_v1" }
|
||||
dependencies = [
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "openai", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev17" }]
|
||||
requires-dist = [
|
||||
{ name = "datasets" },
|
||||
{ name = "openai" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev397" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "six"
|
||||
@@ -4931,7 +4779,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev388" }]
|
||||
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev389" }]
|
||||
|
||||
[[package]]
|
||||
name = "swelego-v1"
|
||||
@@ -4962,14 +4810,14 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "synchronicity"
|
||||
version = "0.12.3"
|
||||
version = "0.12.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ec/d5/e96e6082790c92480380f28aa53e111844cdac7b0f75846f4772cb535a43/synchronicity-0.12.3.tar.gz", hash = "sha256:0d4228b85eaf2805f23b4615b2039a9d24ea811646e2d9f8d0c033094eb85841", size = 60261, upload-time = "2026-05-28T12:33:50.206Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/5d/1c/f51dc54bbd302991026a53f9790735540e0e9e1184e9d5939f02446aa5bc/synchronicity-0.12.5.tar.gz", hash = "sha256:94d96b1d85698e3056b96a793b8c0949af6584e4a7d877fabdeb5385efe230aa", size = 60745, upload-time = "2026-06-18T21:06:23.545Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/57/ea/531a6ea751cbd989da386144810b1b8f529b0aae8c1a9beda8b40966c9c2/synchronicity-0.12.3-py3-none-any.whl", hash = "sha256:e476818cd14102136f41622c619de548f0000c024485fc18521c8fe908ea7574", size = 40982, upload-time = "2026-05-28T12:33:49.125Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/06/74/ad9b99520f70c0bc3318e582e359d360cfc0f7afd7bf368a7f24013cece7/synchronicity-0.12.5-py3-none-any.whl", hash = "sha256:fdbbb10d437bc08a6b0f814fc66fddd1b58ffed314533d42f1ab555801e781af", size = 41107, upload-time = "2026-06-18T21:06:22.505Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5014,21 +4862,6 @@ dependencies = [
|
||||
{ name = "watchdog", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tau2-bench"
|
||||
version = "0.2.3"
|
||||
source = { editable = "deps/research-environments/environments/tau2_bench" }
|
||||
dependencies = [
|
||||
{ name = "tau2", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "verifiers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "tau2", git = "https://github.com/sierra-research/tau2-bench.git?rev=337326e" },
|
||||
{ name = "verifiers", specifier = ">=0.1.15.dev17" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tau2-bench-v1"
|
||||
version = "0.2.0"
|
||||
@@ -5092,7 +4925,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev388" }]
|
||||
requires-dist = [{ name = "verifiers", specifier = ">=0.1.15.dev389" }]
|
||||
|
||||
[[package]]
|
||||
name = "textarena"
|
||||
@@ -5650,6 +5483,7 @@ requires-dist = [
|
||||
{ name = "deepspeed", marker = "extra == 'rl'", specifier = ">=0.17.6" },
|
||||
{ name = "flash-attn", marker = "extra == 'rl'", specifier = ">=2.8.3" },
|
||||
{ name = "gepa" },
|
||||
{ name = "harbor", marker = "python_full_version >= '3.12' and extra == 'harbor'", specifier = "==0.14.0" },
|
||||
{ name = "httpx", specifier = ">=0.27.0" },
|
||||
{ name = "liger-kernel", marker = "extra == 'rl'", specifier = ">=0.5.10" },
|
||||
{ name = "loguru", specifier = ">=0.7.0" },
|
||||
@@ -5688,7 +5522,7 @@ requires-dist = [
|
||||
{ name = "vllm", marker = "extra == 'rl'", specifier = ">=0.10.0,<0.11.0" },
|
||||
{ name = "wandb", marker = "extra == 'rl'" },
|
||||
]
|
||||
provides-extras = ["browser", "modal", "notebook", "quest", "rg", "rl", "ta"]
|
||||
provides-extras = ["browser", "harbor", "modal", "notebook", "quest", "rg", "rl", "ta"]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
|
||||
Reference in New Issue
Block a user