Repository navigation
Counting source tokens in a padded OpenVINO batch before local translation #40274
FenjuFu
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Three station notices went into one translation batch. The shortest source and the longest source occupied the same number of columns. Using that width as a per-notice token count would have deferred all three.
I ran OpenVINO on CPU with OpenVINO Tokenizers and the tokenizer from Spark-X2.6-1.7B. For each row I counted the positions marked by the attention mask and checked the corresponding IDs against an independent, unpadded Transformers call. llama.cpp then translated the accepted notices using Spark-X2.6-1.7B-GGUF, Q4_K_M, on the same CPU.
The source budget was 10 tokens, chosen to put the middle notice exactly on the boundary. All three rows had width 19. Two HTTP requests reached the translation server and both returned 200. The longer notice stayed intact for separate handling. The first translation also caught a separate problem: at a station, 出口 means “exit”; the raw response said “export”. The second preserved the 9:00 departure and supplied “bus”, although the source did not specify the vehicle.
Reproduce the batch
Install the packages in a virtual environment. Start the translation server with the Q4_K_M GGUF file from revision
c4bc25be0e537d55266d90a08bdef931f4cf580aand the following settings:This run used Windows, an Intel Core Ultra 5 125H and llama.cpp build 12336. The three inputs are short test notices. The budget covers source text only. To enforce a model context limit, tokenize the fully formatted conversation and reserve space for generation. I did not benchmark throughput or score translation quality.
All reactions