[PR #2312] [CLOSED] [Engine] keep configured vision resident during calibration #3977

Closed
opened 2026-11-07 15:32:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2312
Author: @Tsury
Created: 10/13/2026
Status: ❌ Closed

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


📝 Commits (1)

  • f07b6d6 fix(calibrate): retain configured vision during tuning

📊 Changes

2 files changed (+125 additions, -16 deletions)

View changed files

📝 tools/calibrate.py (+29 -16)
📝 tools/test_calibrate.py (+96 -0)

📄 Description

Problem and result

With a configured nonelastic vision encoder, calibration starts the engine without that encoder. Automatic expert-cache sizing therefore measures different memory availability from normal serving. Keep the encoder resident before the first engine start and through every calibration restart, then release it and its log on success or failure.

Fixes #2301. This refresh follows the tracker reset instructions in https://github.com/Niko1221/Strata/pull/2312#issuecomment-6272941081 and reuses this PR and branch.

Approach

Use the existing Vision, serving path normalization, and vision_env with one ExitStack for cleanup. Text-only configurations and caller-supplied engine factories keep their existing lifetime behavior. The rebase preserves current main's per-engine environment overrides, progress/cancellation parameters, long-prompt measurement, HIP handling, prompts, sweeps, thresholds, and selection logic.

Validation

Tested revision: a50a46f603aa7e0784ada9e3c4bb691a79228fd2, based on current main 9de04cd44e927a9a3df6bbc0e94fc1be8b844ba4 (Strata 0.2.1 / source engine 0.1.46.3). Environment: Linux x86_64, Python 3.14.4; pure tests with stand-in encoders/engines.

Passed:

  • python3 tools/test_calibrate.py: 36 tests pass. The 30 existing main tests passed before applying the fix. The six retained vision-lifetime cases cover GPU/CPU encoder lifetime across restarts, relative paths and environments, engine/measurement failures, encoder-start failure and log closure, and text/custom-factory behavior.
  • git diff --check HEAD^ HEAD: passes.

Failed:

  • Before the production fix, the retained vision-lifetime regressions produce five failures on current main because the configured encoder is absent. After the fix, all 36 tests pass.
  • A mistakenly requested python3 tools/test_setup_calibrate.py check could not run because that file does not exist. Setup integration cases are part of the passing tools/test_calibrate.py suite.

Not run:

  • No new native GPU allocation, throughput, or model-quality measurement. The historical allocation observations remain in #2301 and are not presented as new current-revision measurements.
  • No CUDA/HIP/SYCL/Metal compilation: this refresh changes Python calibration and its pure tests only; no native build inputs change.

Limits

This refresh covers the maintained nonelastic vision path. The elastic-vision parity case reported in https://github.com/Niko1221/Strata/pull/2312#issuecomment-6184304034 remains outside this refresh and unverified. No elastic scheduling policy, calibration setting, or default is changed. Pure lifetime tests establish control flow and cleanup, not GPU sizing or speed on other platforms.

AI assistance: Codex helped rebase the focused fix, run the checks, and prepare this description.


🔄 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/2312 **Author:** [@Tsury](https://github.com/Tsury) **Created:** 10/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/calibrate-vision-2301` --- ### 📝 Commits (1) - [`f07b6d6`](https://github.com/Niko1221/Strata/commit/f07b6d68a2cfcf0d5c9915a8d6cfd97320a478d0) fix(calibrate): retain configured vision during tuning ### 📊 Changes **2 files changed** (+125 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `tools/calibrate.py` (+29 -16) 📝 `tools/test_calibrate.py` (+96 -0) </details> ### 📄 Description ## Problem and result With a configured nonelastic vision encoder, calibration starts the engine without that encoder. Automatic expert-cache sizing therefore measures different memory availability from normal serving. Keep the encoder resident before the first engine start and through every calibration restart, then release it and its log on success or failure. ## Related discussion Fixes #2301. This refresh follows the tracker reset instructions in https://github.com/Niko1221/Strata/pull/2312#issuecomment-6272941081 and reuses this PR and branch. ## Approach Use the existing `Vision`, serving path normalization, and `vision_env` with one `ExitStack` for cleanup. Text-only configurations and caller-supplied engine factories keep their existing lifetime behavior. The rebase preserves current main's per-engine environment overrides, progress/cancellation parameters, long-prompt measurement, HIP handling, prompts, sweeps, thresholds, and selection logic. ## Validation Tested revision: `a50a46f603aa7e0784ada9e3c4bb691a79228fd2`, based on current main `9de04cd44e927a9a3df6bbc0e94fc1be8b844ba4` (Strata 0.2.1 / source engine 0.1.46.3). Environment: Linux x86_64, Python 3.14.4; pure tests with stand-in encoders/engines. **Passed:** - `python3 tools/test_calibrate.py`: 36 tests pass. The 30 existing main tests passed before applying the fix. The six retained vision-lifetime cases cover GPU/CPU encoder lifetime across restarts, relative paths and environments, engine/measurement failures, encoder-start failure and log closure, and text/custom-factory behavior. - `git diff --check HEAD^ HEAD`: passes. **Failed:** - Before the production fix, the retained vision-lifetime regressions produce five failures on current main because the configured encoder is absent. After the fix, all 36 tests pass. - A mistakenly requested `python3 tools/test_setup_calibrate.py` check could not run because that file does not exist. Setup integration cases are part of the passing `tools/test_calibrate.py` suite. **Not run:** - No new native GPU allocation, throughput, or model-quality measurement. The historical allocation observations remain in #2301 and are not presented as new current-revision measurements. - No CUDA/HIP/SYCL/Metal compilation: this refresh changes Python calibration and its pure tests only; no native build inputs change. ## Limits This refresh covers the maintained nonelastic vision path. The elastic-vision parity case reported in https://github.com/Niko1221/Strata/pull/2312#issuecomment-6184304034 remains outside this refresh and unverified. No elastic scheduling policy, calibration setting, or default is changed. Pure lifetime tests establish control flow and cleanup, not GPU sizing or speed on other platforms. AI assistance: Codex helped rebase the focused fix, run the checks, and prepare this description. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:32:10 +07:00
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#3977
No description provided.