[PR #4149] [Engine] keep configured vision resident during calibration #4922

Open
opened 2026-11-07 16:31:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4149
Author: @Tsury
Created: 10/25/2026
Status: 🔄 Open

Base: main ← Head: fix/calibrate-vision-2301-r2


📝 Commits (2)

  • a68573a [Engine] keep configured vision resident during calibration
  • c397f5b [Engine] apply serving's vram_elastic rule to the calibration encoder

📊 Changes

2 files changed (+138 additions, -21 deletions)

View changed files

📝 tools/calibrate.py (+35 -21)
📝 tools/test_calibrate.py (+103 -0)

📄 Description

Problem and result

With a configured vision encoder, calibration starts the engine without that encoder. Automatic expert-cache sizing therefore measures different free VRAM from normal serving. The #2301 measurement showed 8343 slots / 16202 MiB in calibration versus 7615 slots / 14786 MiB in image-enabled serving on the same configuration.

After this change, calibration starts the configured encoder before the first engine start, keeps it through every tuner restart, then releases it and its log on success or failure. It also applies serving's rule that "elastic": true needs "vram_elastic": true; otherwise the encoder starts with the model, in calibration as in serving.

Fixes #2301. Replaces #2312: its /reopen check passed, but GitHub refused to reopen it (https://github.com/Niko1221/Strata/pull/2312#issuecomment-6310187409), so this is the linked new PR the bot suggested.

The elastic case from review (https://github.com/Niko1221/Strata/pull/2312#issuecomment-6184304034) is now covered: the second commit copies serve/server.py's vram_elastic check before constructing Vision.

Approach

Use the existing Vision, serving's relative-path handling and vision_env, with one ExitStack for cleanup. Text-only configurations and caller-supplied engine factories keep their current lifetime. No calibration setting, sweep, threshold or default changes.

Validation

Revision c397f5b9, rebased onto main 4b9e05a2 (v0.2.6). Linux x86_64, Python 3.14; pure tests with stand-in encoders and engines.

Passed:

  • python -m unittest tools.test_calibrate: 37 tests pass (30 existing, 7 vision-lifetime cases).
  • The new test_elastic_follows_the_servers_vram_elastic_rule fails without the second commit (True is not False) and passes with it.
  • git diff --check origin/main HEAD: clean.

Failed:

None observed.

Not run:

  • No new GPU allocation, throughput or quality measurement on this revision. The allocation table in #2301 is from 0.1.43.1 and is not presented as a current measurement.
  • No CUDA/HIP/SYCL/Metal build: only Python calibration and its tests change.

Limits

Pure tests establish control flow and cleanup, not GPU sizing on other platforms. CPU vision, other GPUs and multi-GPU configurations were not measured.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4149 **Author:** [@Tsury](https://github.com/Tsury) **Created:** 10/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/calibrate-vision-2301-r2` --- ### 📝 Commits (2) - [`a68573a`](https://github.com/Niko1221/Strata/commit/a68573aca5c17ccc72bebeb0ee612a9e922401f0) [Engine] keep configured vision resident during calibration - [`c397f5b`](https://github.com/Niko1221/Strata/commit/c397f5b9fa1721ba19230ac5d50b8ca846584fb1) [Engine] apply serving's vram_elastic rule to the calibration encoder ### 📊 Changes **2 files changed** (+138 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `tools/calibrate.py` (+35 -21) 📝 `tools/test_calibrate.py` (+103 -0) </details> ### 📄 Description ## Problem and result With a configured vision encoder, calibration starts the engine without that encoder. Automatic expert-cache sizing therefore measures different free VRAM from normal serving. The #2301 measurement showed 8343 slots / 16202 MiB in calibration versus 7615 slots / 14786 MiB in image-enabled serving on the same configuration. After this change, calibration starts the configured encoder before the first engine start, keeps it through every tuner restart, then releases it and its log on success or failure. It also applies serving's rule that `"elastic": true` needs `"vram_elastic": true`; otherwise the encoder starts with the model, in calibration as in serving. ## Related discussion Fixes #2301. Replaces #2312: its `/reopen` check passed, but GitHub refused to reopen it (https://github.com/Niko1221/Strata/pull/2312#issuecomment-6310187409), so this is the linked new PR the bot suggested. The elastic case from review (https://github.com/Niko1221/Strata/pull/2312#issuecomment-6184304034) is now covered: the second commit copies `serve/server.py`'s `vram_elastic` check before constructing `Vision`. ## Approach Use the existing `Vision`, serving's relative-path handling and `vision_env`, with one `ExitStack` for cleanup. Text-only configurations and caller-supplied engine factories keep their current lifetime. No calibration setting, sweep, threshold or default changes. ## Validation Revision `c397f5b9`, rebased onto main `4b9e05a2` (v0.2.6). Linux x86_64, Python 3.14; pure tests with stand-in encoders and engines. **Passed:** - `python -m unittest tools.test_calibrate`: 37 tests pass (30 existing, 7 vision-lifetime cases). - The new `test_elastic_follows_the_servers_vram_elastic_rule` fails without the second commit (`True is not False`) and passes with it. - `git diff --check origin/main HEAD`: clean. **Failed:** None observed. **Not run:** - No new GPU allocation, throughput or quality measurement on this revision. The allocation table in #2301 is from 0.1.43.1 and is not presented as a current measurement. - No CUDA/HIP/SYCL/Metal build: only Python calibration and its tests change. ## Limits Pure tests establish control flow and cleanup, not GPU sizing on other platforms. CPU vision, other GPUs and multi-GPU configurations were not measured. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4922
No description provided.