feat(apps): patch size + VRAM plan from config, install requirements by default - #24
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Nonewhen the app declares no plan or the free VRAM isunknown.
install_inferenceis refactored to use it.LocalAppRepository.get_patch_size()— falls back toPredictor.Dataset.Patch.patch_sizeinPrediction.ymlwhenapp.jsonomits it. The prediction config stays the single source of truth, sopatch size need not be duplicated in the manifest.
_install_requirements— now runs on every app resolution (inference / evaluation / uncertainty) andis opted out via
KONFAI_APPS_INSTALL_REQUIREMENTS=0(offline / CI / reproducible environments), replacingthe opt-in
install_requirementsflag. Only missing or version-mismatched packages are installed, so repeatruns 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_planselection +get_patch_sizeconfig fallback).