runpod: a pod can be told to return token ids (v0.3.32)

`return_token_ids` added to the vllm entry of _ENGINE_FORWARDED_FIELDS, so a
rented pod's vLLM backend can be asked for raw vocabulary ids -- without which
the v0.3.31 repair can never fire on a RunPod-served model, which is every OCR
model on the Digesta install.

Inert by default: engine_config_for_pod skips falsey values, so adding the field
cannot change an install that has not set it.

Set on Aruba for `datalab-to/surya-ocr-2` ONLY, through its models.json `vllm`
block rather than globally. The flag changes what the `token` string inside
logprobs looks like and that install also serves qwen38-awq and diogene-alpha on
vLLM pods; nothing in coderai reads that field except the OCR repair, but a
client might, and there is no reason to find out the hard way.
Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PxYHWbCAjjjD7A1rhFKtaW
parent 3353ac28
......@@ -16,7 +16,7 @@
# Canonical product version for CoderAI — single source of truth. Both the API
# metadata and the admin web UI read from here.
__version__ = "0.3.31"
__version__ = "0.3.32"
__tagline__ = "Complete orchestration, distribution and escalation of remotizable advanced inference."
# Configure the CUDA caching allocator BEFORE torch is imported anywhere.
......
......@@ -919,7 +919,12 @@ _ENGINE_FORWARDED_FIELDS = {
"model_id"),
"kt": ("ctx", "extra_args", "extra_env", "model_id"),
"vllm": ("ctx", "gpu_memory_utilization", "tensor_parallel_size", "max_num_seqs",
"dtype", "quantization", "extra_args", "extra_env"),
"dtype", "quantization", "extra_args", "extra_env",
# Only ever forwarded when TRUE: the loop below skips False, so
# adding it here cannot change an install that has not asked for it.
# A pod needs it to recover a byte-level vocabulary's characters from
# the token ids (see VllmConfig.return_token_ids).
"return_token_ids"),
}
#: The config attribute behind each engine name (ktransformers is the odd one).
_ENGINE_CONFIG_ATTR = {"kt": "ktransformers"}
......
......@@ -404,3 +404,19 @@ def test_it_can_be_set_per_model():
changing what every other vLLM model reports."""
from codai.backends.overrides import VLLM_FIELDS
assert "return_token_ids" in VLLM_FIELDS
def test_a_pod_can_be_told_to_return_token_ids():
"""The pod's vLLM backend is configured by what this install forwards, so the
field has to be in the forwarded set or a pod could never ask for ids."""
from codai.api.runpod_worker import _ENGINE_FORWARDED_FIELDS
assert "return_token_ids" in _ENGINE_FORWARDED_FIELDS["vllm"]
def test_forwarding_it_cannot_affect_an_install_that_did_not_ask():
"""engine_config_for_pod skips falsey values, so adding the field to the
forwarded set is inert until someone sets it True."""
import inspect
from codai.api import runpod_worker
src = inspect.getsource(runpod_worker.engine_config_for_pod)
assert "if v in (None, \"\", 0, False):" in src
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment