mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4178] [CLOSED] [Engine] read DeepSeek-V4.1 pictures with the model's own vision tower #4932
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4932
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4178
Author: @suifei
Created: 10/26/2026
Status: ❌ Closed
Base:
main← Head:feat/dsv41-engine-vision📝 Commits (1)
f1a8999serve(dsv41): read pictures with the model's own vision tower📊 Changes
4 files changed (+250 additions, -12 deletions)
View changed files
➕
serve/dsv41_vision.py(+152 -0)📝
serve/server.py(+27 -5)➕
serve/test_dsv41_vision.py(+58 -0)📝
setup.py(+13 -7)📄 Description
Problem and result
DeepSeek-V4.1-Flash-1017 is multimodal:
config.jsoncarriesimage_token_id: 129264and avision_config(32-layer ViT, patch 14, merge 3, at most 1024 image tokens), and thedsv41engine already implements that tower (src/dsv41/ds4_vision.cu,--encode-image,--images);tools/dsv41/pack_gguf.py --mmprojpacks it frommmproj-BF16.gguf(projectordeepseek41v).Before: the HTTP server's image path always ran the separate
strata-visionencoder (llama.cpp mtmd + mmproj). That encoder has nodeepseek41vprojector, so the family was markedimages: falseand--visionwas ignored with a warning; animage_urlrequest could not work.After: for
arch: deepseek41the server feeds the pictures to the engine instead. An OpenAIimage_url(or Anthropic image block) is accepted, the picture becomes a run of the model's image token in the prompt, and the engine encodes it with its own tower./healthreports"images": truefor such a pack.Related discussion
none — no issue was opened for this. It is a feature (new capability behind the existing image API), so a maintainer's scope decision is welcome; I am happy to turn it into an issue first if that is preferred.
Approach
The engine's
GENIrequest already names a pictures file, but it is a DSI1 file (magic, count, thenstart i64, width i32, height i32, RGBper picture) that the engine encodes itself - not the embedding rowsstrata-visionwrites for the other families. So:serve/dsv41_vision.py(new) holds the picture side:fit()(both sides on the tower's 42-pixel grid, aspect kept, span insidevision.max_image_tokens),rows()(ceil(h/42) * (ceil(w/42) + 1) + 2, the engine's own count), the prompt marker expansion, the span offsets, the DSI1 writer, anddetect()(readsimage_token_id/vision.*from the pack'sds4.txt).serve/server.py:Service(native_vision=...). Inprepare()the content lists are flattened to text with one marker per picture, the marker becomes a run of the image token before tokenizing, and the request's DSI1 file is passed asGENI's pictures file; thestrata-visionbranch is skipped for this family./health,/metricsand/v1/modelsreport image support from the pack.setup.py: the IST-DAS sets fetch the pinnedmmproj-BF16.ggufinto the shared folder and pass it topack_gguf.py --mmproj; the family is markedvision: true.serve/test_dsv41_vision.py(new): the geometry against the engine's own measurements, marker expansion, span offsets, DSI1 layout.Compatibility: the new path runs only when the config's arch is
deepseek41and the pack carries a vision tower (image_token_idinds4.txt). A pack without one keepsnative_vision = Noneand behaves exactly as before; other families keep thestrata-visionpath untouched. Nostrata-visionprocess is started for this family.Validation
Revision
f1a8999(feat/dsv41-engine-vision, based onmain4b9e05a). Environment: Ubuntu 24.04 container, Python 3.12.3 (the checkout's.venv), 4 x NVIDIA L20 46 GB, driver 595.71, CUDA 13.2.1,strata-dsv41 0.1.51built from this tree (-DSTRATA_ENABLE_CUDA=ON -DSTRATA_BUILD_DSV41=ON -DCMAKE_CUDA_ARCHITECTURES=native), pack: IST-DAS 2.25 bpw (IQ2_XS + Engram, 274 GB) withmmproj-BF16.gguf, 1M context.Passed:
python -m unittest serve.test_dsv41_vision- 6 tests,OK(geometry 420x420->112, 700x700->308, 1008x672->402, 1540x700->648 rows, the values the engine printed; expand/starts/DSI1).python -m unittest serve.test_dsv41- 60 tests,OK (skipped=1), no regression in the family's existing tests.python tools/dsv41/pack_gguf.py --model <IST-DAS folder> --shards <4 IQ2_XS files> --engram ... --engram-meta ... --dspark-gguf ... --dspark-noise-token 128799 --dspark-markov-rank 256 --mmproj mmproj-BF16.gguf --out <pack>printedvision tower from mmproj-BF16.gguf: 32 blocks, image token 129264;strata-dsv41 --pack-info --pack <pack>printeddense ... vision 0.97andfiles: 7, all present and long enough.strata-dsv41 --pack <pack> --encode-image carrots.rgb --size 1008x672 --dump-image out.spanprintedvision: 1008 x 672 pixels -> a span of 402 rows in 97 ms; the dump is 402 x 5120 BF16.serve/server.py --engine strata --config <ist-das config> --port 8080, thenPOST /v1/chat/completionswith adata:image/png;base64,...image_urlpart (the official example photo, 1024x701) and "What vegetable is in this picture? Answer in one word." answered Carrot,usage: prompt_tokens 418 (16 text + 402 image), completion_tokens 3, 1.3 s;GET /healthshowed"images": true,"max_context": 1048576.GET /v1/modelswith the same server:architecture.input_modalities = ["text", "image"].Failed:
none observed.
Not run:
setup.pyinstall for this family (the new download/pack path): it would fetch the 274 GB set again. The pack produced by hand with the exact recipe setup now uses was validated above; the setup change is the same--mmprojargument.Limits
strata-visionwhenever avisionencoder is configured for another family; this change is keyed on the arch and the pack, not on a new config option.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.