Skip to content

feat(apps): patch size + VRAM plan from config, install requirements by default - #24

Merged
vboussot merged 1 commit into
mainfrom
feat/apps-vram-plan
Jul 5, 2026
Merged

feat(apps): patch size + VRAM plan from config, install requirements by default#24
vboussot merged 1 commit into
mainfrom
feat/apps-vram-plan

Conversation

@vboussot

@vboussot vboussot commented Jul 5, 2026

Copy link
Copy Markdown
Member

Summary

Three related improvements to konfai-apps app resolution, so a UI (SlicerKonfAI / any client) can present
the right patch/VRAM defaults without duplicating them, and so app dependencies install predictably.

Changes

  • AppRepositoryInfo.resolve_vram_plan(available_vram) — returns the exact (patch_size, batch_size)
    the app's VRAM plan would select for the given free VRAM (the largest declared threshold, in GB, that
    fits). This is the same selection inference performs, so a UI can preview/seed the plan that will
    actually run on the current machine. Returns None when the app declares no plan or the free VRAM is
    unknown. install_inference is refactored to use it.
  • LocalAppRepository.get_patch_size() — falls back to Predictor.Dataset.Patch.patch_size in
    Prediction.yml when app.json omits it. The prediction config stays the single source of truth, so
    patch size need not be duplicated in the manifest.
  • _install_requirements — now runs on every app resolution (inference / evaluation / uncertainty) and
    is opted out via KONFAI_APPS_INSTALL_REQUIREMENTS=0 (offline / CI / reproducible environments), replacing
    the opt-in install_requirements flag. Only missing or version-mismatched packages are installed, so repeat
    runs are a no-op; core packages (torch, konfai, …) are never touched. This matches the documented trust
    model — resolving an app pip-installs the extra deps its custom code needs, so only resolve apps you trust.

Test plan

  • konfai-apps/tests/unit/test_app_repository.py — extended and green (resolve_vram_plan selection +
    get_patch_size config fallback).

…ements by default

- AppRepositoryInfo.resolve_vram_plan(available_vram): expose the exact
  (patch_size, batch_size) the app's VRAM plan selects for the free VRAM, so a UI
  can preview/seed the plan that inference will actually use on the machine.
- LocalAppRepository.get_patch_size(): fall back to Predictor.Dataset.Patch.patch_size
  in Prediction.yml when app.json omits it, so patch size is not duplicated in the
  manifest (the prediction config stays the single source of truth).
- _install_requirements: run on every app resolution (inference/eval/uncertainty),
  opt out via KONFAI_APPS_INSTALL_REQUIREMENTS=0, replacing the opt-in
  install_requirements flag. Only missing/mismatched packages are installed.
@vboussot
vboussot merged commit 7895803 into main Jul 5, 2026
29 checks passed
@vboussot
vboussot deleted the feat/apps-vram-plan branch July 5, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant