/v1/tokenize returns a flat list when the text array holds a single string
I maintainer di solito rispondono entro 2 giorni
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- cpp, json
- Ambito
- backend-api-design, documentation, testing-qa
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C++
- Stelle
- 952
- Fork
- 285
- Merge medio
- 3g 12h
- PR unite (30g)
- 47
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openvinotoolkit/model_server
-
Rerank with an empty documents array or object documents fails with an internal tokenizer errorForse già presa @Daksha1611 l’ha presa 3 giorni fa. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 24/100
openvinotoolkit/model_server#4671 ·
I maintainer di solito rispondono entro 2 giorni
-
Downloading an image from a URL has no timeoutForse già presa @Daksha1611 l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
openvinotoolkit/model_server#4669 ·
I maintainer di solito rispondono entro 2 giorni
-
max_tokens and best_of reject a value equal to their configured limitForse già presa @Daksha1611 l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
openvinotoolkit/model_server#4666 ·
I maintainer di solito rispondono entro 2 giorni
-
/v3/audio/speech ignores response_format and always returns 32-bit float WAVForse già presa @michalkulakowski l’ha presa 23 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
openvinotoolkit/model_server#4613 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
openvinotoolkit/model_server#4609 · 5 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di openvinotoolkit/model_server
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement GUI maintainer-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
aethersdr/AetherSDR#6681 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add string concatenationAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno