mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3937] [Engine] Opt-in API image input for DeepSeek-V4.1-Flash-1017 using the native vision engine #1686
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#1686
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?
Originally created by @Tsury on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3937
Area
[Engine]
What do you want to do?
Enable image questions through Strata's existing OpenAI/Anthropic APIs when DeepSeek-V4.1-Flash-1017 is explicitly configured with its matching vision encoder. Keep text-only DeepSeek and the Qwen path unchanged.
Would you want this upstream, and would the scope below fit your plans? I have not started implementation.
What do you do today instead?
Use a supported image-capable model for image requests. The DeepSeek guide says pictures are unavailable through this release's serving path.
Current source and proposed scope
Unconfirmed static analysis, inspected at main
8183c6b67162340c09b67360860177c577a65f2e; this is a feature proposal, not a hardware reproduction or a correctness claim.src/dsv41code already includes the ViT/aligner, image-embedding insertion, image routing/Engram masks, GENI/DSI1 input and image-aware prefix checks.<|deepseek_image|>.Service.preparestill uses Qwen image markers and its embedding-file path.tools/dsv41/vision_pack.pywith the official 1017 encoder shard/config and range-fetched marker rows. Do not substitute a Qwen projector or import another runtime. No new vision kernels or general serving layer are proposed.Related: #3917 and #3927 concern selecting an incompatible Qwen projector during setup. This proposal covers the separate API connection after a matching DeepSeek encoder is prepared.
Proposed validation
Is this focused opt-in adapter port welcome, or is there an existing effort we should coordinate with?
@hap911 commented on GitHub (Oct 27, 2026):
Implemented locally — native vision via the packed tower + a serve-side bridge.
I have a working implementation of this on 0.2.6 / control 0.1.51, running against the real checkpoint (IST-DAS IQ2_XXS pack of DeepSeek-V4.1-Flash-1017) on Windows/CUDA (RTX 3080 Ti + RTX 5090). Sharing the shape and measurements in case it helps the official one.
Approach
Pack: repacked with the official 1017 vision shard using vision_pack.py + pack_gguf --vision, tower verified bit-for-bit against the checkpoint. Pack grew 0.97 GB; the engine's load_vision places the tower on the first GPU before the layer split — no engine change needed.
Serve: new serve/ds4vision.py (~280 lines, derived from the Maya MIT adapter, attribution in the header) + two small marked hunks in server.py (construct for arch deepseek41; ds4 branch in prepare()). It sizes each image the way the tower wants (sides to multiples of 14, span nh*(nw+1)+2 <= 1024 image tokens, LANCZOS downscale above), replicates the fixture template's message walk (tool-result merge, tool_calls-order sort) so pixel payload order always matches the emitted placeholders — count divergence fails loudly — expands each <|deepseek_image|> (129264) placeholder to its full span, and writes the DSI1 file for the unchanged GENI plumbing. Locally the repack IS the opt-in; upstream would want a CLI/setup flag.
Validation (real checkpoint)
PASSED: single image (7.0 s); two images in one message, correct order (8.9 s); follow-up on the same image in 2.3 s (prefix + pixel-hash span cache, no re-encode); second image mid-conversation cross-compared correctly; swapped pixels under identical token ids -> the engine's FNV pixel hash invalidates the cached span; tool-result images in both send orders pair consistently; literal placeholder text renders as text, no corruption; text-only requests unchanged. Decode 28.8–30.0 tok/s with the tower vs 29.9 baseline — no measurable cost.
FAILED: none.
NOT RUN: encoder parity vs the DeepSeek Torch reference (the pack tool verified the tower bit-for-bit against the official checkpoint instead); AMD/Metal backends (CUDA-only box); upstream CLI/setup wiring.
Findings for the official implementation
serve 0.1.51 drops tool_call_id when building tool messages (server.py:5808, frontend.py:651), so the template's tool_calls-order reorder never fires in practice — arrival order rules on both sides today.
First image request after start pays the one-time tower load.
Limit: 1024 image tokens/picture (~1260x1260 px, downscaled above).
Happy to share the patch if useful.
@Niko1221 commented on GitHub (Oct 29, 2026):
Thank you. Done in 0.2.7: DeepSeek-V4.1 reads pictures through the API by default. The engine's own vision tower (319 MiB of graphics memory) loads with the model, and the server decodes each picture, sizes it (both sides a multiple of 42, at most 1024 image tokens) and sends it on.
--vision offturns it off, and a request with a picture then gets a 400 that says so. Details: https://github.com/Niko1221/Strata/blob/main/docs/DEEPSEEK41.mdRelease: https://github.com/Niko1221/Strata/releases/tag/v0.2.7