Repository navigation
Soma 2.0 is a full redesign of the library around a small set of public verbs (extract, fit, predict, evaluate), the nouns they pass between them (Cohort, sources, Learner, Predictions, Evaluation), and a declarative ExperimentConfig that mirrors that API. Every component kind is now a registry, the benchmark side lives in its own explicitly imported package, and every recorded benchmark row was re-recorded on the 2.0 code. This is a breaking release. The 1.x dataset, training, configuration and import surfaces are removed without aliases, and every feature cache key changes, so existing caches have to be re-extracted.
Breaking changes
- Data layer.
soma.datareplacesDataset,TileDataset, the task manifests,load_manifestandSplits. Samples areSampleRecords (identity and targets, no paths) held in a validatedCohortwith folds and one sampling unit. Features and targets come from typed sources (SetSource,GridSource,TargetSource), and heads read supervision from a bound source instead of opening files. (#583) - Training. The old trainer is replaced by a subclass-first
Learner(MILLearner,DenseLearner) driven by a genericTrainerwith callbacks (Checkpoint,EarlyStopping,History,Progress), plussoma.fit. (#584) - Inference and scoring.
soma.predictandsoma.evaluateare public verbs, withPredictions(parquet, head-declared columns) and a frozenEvaluationbetween them.compareandBaselinesupport side-by-side results. The HTML run report is removed. (#585) - Dense shape. Segmentation and detection are heads on one grid shape:
GridBatch,DenseModel(replacingSegmentationModelandLiveSegmentationModel),DenseLearnerand a live encoder stage. Pixel classifiers are removed. (#589) - Pipeline.
soma.pipelineis now a package built from the public verbs in one canonical fold order, with a single persisted model format (the bundle) and a parity test that guards it. (#596) - Configuration.
soma.ExperimentConfigreplaces the old config. It has seven sections that each hold one public callable's keywords, and every component is a{name, params}leaf. A run resolves the config to asoma.Planbefore reading any data. There is no defaults YAML and no translation layer, so 1.x YAML files do not load. (#608) - Extraction config. Soma no longer mirrors slide2vec and hs2p settings. It holds their
PreprocessingConfig,ExecutionOptionsandDenseOptionsdataclasses as given, next to its ownFeaturesConfig. Every cache key and experiment id changes, so 1.x caches are not reused. (#606) - Feature entry point.
soma.extract(withCohort.derived) is the single way features enter.FeatureExtractor,FeatureExtractionResult,attach_source,Pipeline.dataset/Pipeline.splitsand the whole legacy bridge are removed. (#611) - Package layout. The core moves into
soma.data,soma.extract,soma.models,soma.learn,soma.evaluationandsoma.pipeline. The root namespace only exposes the verbs and nouns. (#612) - Benchmarks. Benchmark code moves into
soma.benchmark, with one subpackage per protocol (eva,hest,ocelot,midog,monkey,croma).import somano longer imports it: importsoma.benchmarkexplicitly.soma.benchmarks,soma.curation,soma.leaderboardandsoma.robustnessare gone. import-linter enforces the boundary. (#613) - ROI sampling default. When no filter is set, annotation ROI sampling no longer drops small annotated regions: hs2p's contour-area filter defaults to
a_t: 0. Before, small regions were dropped from slide-manifest segmentation datasets without a warning. (#607) - Dependencies. Requires
slide2vec[fm]>=7.1.2,hs2p>=6.1.0,torchvision>=0.23andcroma>=1.0.0. Runs started under slide2vec 7.1.0 may refuse to resume with afeaturesdrift unless the config states the same GPU and worker counts. (#606, #619, #627) - Repository content.
scripts/,examples/eva/,examples/ocelot/andexamples/make_beetle_manifest.pyare removed. Usesoma reproducefor the benchmark configs. (#626)
Added
- Registries everywhere. Every component kind (aggregators, augmentations, benchmarks, callbacks, decoders, encoders, heads, learners, optimizers, samplers, schedulers, presets) is a
Registry. Components declare their params at registration, andsoma.components()lists them all. New samplers:uniform,class_conditioned,event_balanced. (#601) - Presets,
soma runandsoma init. Five presets (mil_classification,tile_classification,survival,segmentation,detection) each return a completeExperimentConfig.soma initwrites one to disk andsoma runruns it. (#610, #620) - Getting-started notebook. One executed notebook on a synthetic cohort replaces the six walkthroughs.
soma.testing.synthetic_cohortand a fake encoder let you try the whole flow on CPU, with no weights and no network. (#620) - Live detection augmentation.
SegmentationAugmentnow movesPointstargets together with the pixels, so live detection runs can be augmented. (#627) - Attention-map detection decoder. The
attention_mapdecoder scores the encoder's CLS attention as a detection heatmap without training. It runs as an ordinarysoma run. (#631) soma.predict(..., device=...). Predict takes an explicit device, and a model without parameters now runs on the GPU when one is available. (#633)- MONKEY ranking and gate. MONKEY ranks by the inflammatory-cell FROC (the Track-1 leaderboard metric) and reports the per-class FROCs. It also has a local gate row (virchow2, 0.275). (#595, #630)
Fixed
soma reproduce detection/midoganddetection/monkeynow score their own runs instead of failing withFileNotFoundError. (#629)run_benchmark_specfrees each seed's pipeline before the next seed, so live segmentation seeds no longer pile up GPU memory. (#590)- Same-second runs get separate output directories, and the core names used by the benchmark package are now public. (#619)
Benchmarks and docs
- The HEST, CRoMa, EVA and OCELOT rows were re-recorded on the 2.0 code with slide2vec 7.1.1, and all are in band. The CRoMa reference panel is pinned to croma 1.0.1, which republished DINOv2-B under Meta's evaluation recipe. (#622, #623, #624, #625)
- The benchmark pages (EVA, OCELOT, HEST, CRoMa) are rewritten by hand around data, protocol, results and reproduction. Only the results tables are generated. (#632, #634, #635)
- The reader-path docs are curated for 2.0,
extending.rstis rewritten around the extension points, and a test checks that every Python snippet in the docs compiles and uses only public names. (#621) - The test suite mirrors the package and is limited to the public API. (#614)
- New page on the detection annotation-efficiency protocol and MIDOG curation. The recorded-OCELOT ranking report driver is removed. (#587, #588)