/v1/tokenize returns a flat list when the text array holds a single string
维护者通常 2 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- cpp, json
调研方向
Start with src/tokenize/tokenize_parser.cpp, especially the nesting condition based on outputShape[0] > 1, and compare it with the request parsing sequence in src/llm/servable.cpp. Update or add coverage in tokenize_parser_test.cpp and tokenize_endpoint_test.cpp for a one-element array, then update the tokenize response documentation. Done means every string array returns one token list per input, including a single string, with the endpoint behavior and documented response shape covered.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
The shape of the /v1/tokenize response follows the number of strings in the request instead of the
form of the request. src/tokenize/tokenize_parser.cpp nests the tokens only when the tokenizer
output has more than one row (outputShape[0] > 1), and a one-element array produces one row, the
same as a plain string:
{"text": "hello world"} -> {"tokens":[14990,1879]}
{"text": ["hello world"]} -> {"tokens":[14990,1879]}
{"text": ["hello world", "hi"]} -> {"tokens":[[14990,1879],[6023]]}
A client that sends a list and reads tokens[i] for each input gets a list of token lists for
two or more inputs, but a flat list of integers for exactly one. Batches that happen to contain one
string need special handling on the client.
None of the tests send a one-element array: the list cases in tokenize_parser_test.cpp and
tokenize_endpoint_test.cpp all use two or more strings. The docs show only the single-string
response.
To Reproduce
curl http://localhost:8000/v1/tokenize -H "Content-Type: application/json" \
-d '{"model": "Qwen/Qwen3-8B", "text": ["hello world"]}'
Reproduced with the parser and a real Qwen3 tokenizer, following the same sequence as
src/llm/servable.cpp: parse the request, encode, build the response.
Expected behavior
An array of strings always gives a list of token lists, including an array with one string.
Note that this changes the response for clients that currently send a one-element array and rely on
the flat list.
Logs
None.
Configuration
- OVMS version: main @ eec7daac
- any servable that serves /v1/tokenize (LLM, VLM, embeddings, rerank)
- N/A
- N/A
- N/A
Additional context
I have a patch with tests and docs and will open a PR.
- 主要语言
- C++
- 星标
- 952
- 派生
- 285
- 平均合并
- 3 天 5 小时
- 30 天内合并 PR
- 45
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openvinotoolkit/model_server 的其他 Issue
-
KServe REST parser drops requested outputs except the last可能已有人在做 @YugShah1510 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
openvinotoolkit/model_server#4690 ·
维护者通常 2 天内回复
-
KServe REST rejects INT64 and UINT64 values outside 32-bit range可能已有人在做 @YugShah1510 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 25/100
openvinotoolkit/model_server#4688 ·
维护者通常 2 天内回复
-
Preserve double precision when parsing FP64 REST inputs可能已有人在做 @YugShah1510 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
openvinotoolkit/model_server#4686 ·
维护者通常 2 天内回复
-
Rerank with an empty documents array or object documents fails with an internal tokenizer error可能已有人在做 @Daksha1611 于 4 天前认领。 未关闭
难度 4/5 1-2 天 新手友好度 24/100
openvinotoolkit/model_server#4671 ·
维护者通常 2 天内回复
-
Downloading an image from a URL has no timeout可能已有人在做 @Daksha1611 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
openvinotoolkit/model_server#4669 ·
维护者通常 2 天内回复
查看 openvinotoolkit/model_server 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
telegramdesktop/tdesktop#31505 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
ll-builder shell completions omit existing lockfile commands and --locked可能已有人在做 @project-nju-learner 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 90/100
OpenAtom-Linyaps/linyaps#2291 ·
维护者通常 1 天内回复