Conversation
…ridge
Reorganise builtin models under konfai/models/{python,yaml} and ship a declarative YAML model
catalog resolved via 'classpath: default|<Name>.yml' and packaged in the wheel: UNet, NestedUNet,
ResNet (weight-exact vs the KonfAI classes), SegResNet/VNet/DynUNet/ResNet18/VGG16/PlainConvUNet
(weight-exact vs MONAI/torchvision/nnU-Net, real pretrained weights load through the new
konfai.utils.pretrained execution-order bridge), a parametric PlainConvUNet for any nnU-Net topology,
an SMP encoder-backed wrapper, the MIND descriptor, and the ClipNormalize block. The model-builder
registry grows curated primitives (norms, activations, transformer blocks); the classpath resolver is
re-rooted to konfai.models.python (short form unchanged). Also folds the mixed-accumulation
double-backward fix and the point-of-use SimpleITK guard that touch network.py/blocks.py.
BREAKING CHANGE: fully-qualified references 'konfai.models.<task>.<Module>:<Class>' become
'konfai.models.python.<task>.<Module>:<Class>' (no compatibility alias).
FocalLoss batch>1 broadcast, BEST-checkpoint optimisation direction, OneHot.inverse batched argmax, Literal defaults, SLURM rendezvous host, ConvNeXt LayerScaler, DDP shard tail, load_state_dict shrink, and a --resubmit warning instead of a silently dropped flag. SimpleITK is guarded at point-of-use so the package imports without the itk extra. Comments unified in English and SPDX headers completed (incl. the app CLI wrappers); the Slicer-facing core API surface is locked by contract tests.
A runnable synthetic-data registration example (train/predict/evaluate on the builtin VoxelMorph), and the Segmentation and Synthesis examples now ship their model in both a declarative YAML and an equivalent Python form (verified weight-identical), with READMEs explaining when each form applies.
This was referenced Jul 14, 2026
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.
Reorganises the builtin models and ships a declarative YAML model catalog, so a full architecture can live entirely in configuration and load real pretrained weights — with the framework-level correctness fixes underneath.
What's in it
A declarative YAML model catalog (
konfai/models/yaml/, packaged in the wheel, referenced asclasspath: default|<Name>.yml):UNet/NestedUNet/ResNetSegResNet/VNet/DynUNetResNet18/VGG16PlainConvUNetdynamic_network_architectures(also a parametric Python variant for any topology)ViTAttentionUNet/UNETRPlus an SMP encoder-backed wrapper, the MIND descriptor, and a
ClipNormalizeblock for checkpoint-baked normalization.A pretrained-weight bridge (
konfai.utils.pretrained.transfer_weights_by_execution_order) that loads an external MONAI/torchvision/nnU-Net checkpoint into a weight-exact KonfAI graph by execution-order leaf pairing (no key map), and refuses a non-equivalent pair.Reorganisation: builtin Python models move under
konfai/models/python/<task>/next toyaml/; the classpath resolver is re-rooted so the short form (segmentation.UNet.UNet) is unchanged.Silent-correctness fixes across the core (FocalLoss batch>1, BEST-checkpoint direction, OneHot.inverse batching, Literal defaults, SLURM host, …) and point-of-use guards so the package imports without the
itkextra.Examples: a runnable synthetic-data registration example, and the Segmentation/Synthesis examples now ship their model in both a YAML and an equivalent Python form (verified weight-identical).
Verification
pixi run check(lint + format + core + apps) and the konfai-mcp suite are green; every catalog entry is locked by a build/forward/equivalence test.