mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2196] [CLOSED] serve: the image encoder only while there are pictures ("elastic": true in the vision section) #3917
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#3917
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/2196
Author: @i-Vladimir-i
Created: 10/13/2026
Status: ❌ Closed
Base:
main← Head:vision-elastic📝 Commits (2)
f879660serve: the image encoder only while there are pictures ("elastic": true in the vision section)6ef3384serve: the elastic encoder's VRAM figure after the driver's counter caught up📊 Changes
4 files changed (+255 additions, -8 deletions)
View changed files
📝
docs/DETAILS.md(+10 -0)📝
docs/VRAM_ELASTIC.md(+19 -0)📝
serve/server.py(+103 -8)➕
serve/test_vision_elastic.py(+123 -0)📄 Description
serve: the image encoder only while there are pictures (
"elastic": truein the"vision"section, opt-in)A GPU image encoder holds its VRAM (~1.3-1.5 GB here) for as long as the server runs, so the expert cache is smaller
for every request, with or without pictures. With
"vram_elastic": true(#533) the engine can give VRAM back betweenrequests, so the server can lend the encoder its VRAM only while pictures come.
What it changes (
serve/server.py, opt-in; docs indocs/VRAM_ELASTIC.mdand the images part ofdocs/DETAILS.md)"elastic": truein the"vision"section, with the config's"vram_elastic": true: the encoder does not start withthe server or with a load.
"elastic_mib"(default 2048) and"elastic_idle_s"(default 120) set its share and howlong it stays without a picture. Without
"vram_elastic"the server says so and starts the encoder as before.running, the engine's
VRAMfirst keepselastic_mibfree on top of the reserve (the lastPOST /v1/vram, or 0),then the encoder starts. If the cache cannot shrink (the resident low-RAM mode, no
--vram-elastic) the encoderstarts anyway and the log says why.
elastic_idle_swithout a picture and sendsVRAMwiththe reserve again; 0 when none was asked, because
null(the start's reserve) left the cache a segment or more belowthe size it had (measured: 10446 of 10736 slots with
null, 10736 with 0).POST /v1/vramwhile the encoder runs keeps the asked reserve on top of its share; an unload stops it too.Service._vision_down()no longer counts a stopped elastic encoder as down, so a load never starts it.What it leaves alone: everything without the key (the encoder starts as before; the 725 server tests that were
there pass unchanged), the engine, setup, the CPU encoder.
Checked
serve/test_vision_elastic.py(7 tests, fake engine and encoder): the first picture shrinks then starts, later onesreuse it, idle stops and grows back to the full size (and not while a request holds the turn or a picture came
recently), the reserve stacks, an engine that cannot shrink still gets its encoder, an unload lets go, the load never
starts it, the config keys. Four mutations, each caught: no start in the image turn, growing back to the start's
reserve (
null), the load restarting an elastic encoder, the reserve not stacking.a0116b2).RAM, the BF16 encoder at up to 1,024 tokens: the first picture made the cache keep 2 GiB free and the encoder started
in 4.7 s taking 1,339 MiB; a request with one picture took 8.6 s including that start (5.0 s on a later cold start,
the encoder starting in 2.7 s); 2 / 5 / 10 pictures with the encoder running took 3.8 / 5.6 / 9.0 s (~0.45 s to encode
each, the same as the encoder on a second card); after 60 s idle it stopped and the cache grew back to its full
size (21,704 of 21,702 MiB).
Not tested: NVIDIA live (the server path is the same; the engine's
VRAMthere is the existing #533), Windows,several requests with pictures at once with
--parallel(the turn is the same FIFO turn an encode takes today).A note found on the way:
--vram-elasticturns--kv-growoff (the engine says so), so a config with both runs with thewhole K/V in VRAM; on this box that was 9,405 cache slots instead of 10,818. Making the two work together is a separate
change.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.