Skip to content

Feat/trident x hooks - #242

Merged
guillaumejaume merged 4 commits into
mainfrom
feat/trident-x-hooks
Oct 12, 2026
Merged

guillaumejaume merged 4 commits into
mainfrom
feat/trident-x-hooks

Conversation

@guillaumejaume

Copy link
Copy Markdown
Contributor

No description provided.

guillaumejaume and others added 4 commits October 9, 2026 20:16
Small, backward-compatible changes so packages built on TRIDENT can extend
it without copying its source.

- WSI: picklable (`__getstate__` drops the live handle) and `_ensure_open()`
  reopens it on first read in each reader, so a WSI can cross into spawned
  DataLoader workers.
- WSIPatcherDataset: module-level `collate_pil_batch` for PIL batches.
- Model families: `BasePatchEncoder`, `BaseSlideEncoder` and
  `BaseSegmentationModel` (renamed from `SegmentationModel`, alias kept) are
  ABCs with a uniform `.name`, and are exported from their subpackages.
- Processor: scope state task keys per coords config
  (`coords:<dir>`, `patch_features:<enc>:<dir>`, `slide_features:<enc>:<dir>`)
  and record only outputs that were actually written.
- State/Summary: group any scoped `<family>:<scope>` task generically; reset
  a task's stale reason on a new outcome; clear a resolved `last_error`.
- visualize_coords: report the coords' real overlap.
- IO.collect_valid_slides: `max_workers=0` validates paths synchronously.
- TITAN: shim for transformers versions without `all_tied_weights_keys`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fallback built a coords-only patcher and left `coords` / `coords_attrs`
unbound, so extracting features from legacy coords always failed: workers
received coordinates where images were expected, then saving raised
NameError. Read the legacy file once, build an image patcher, and save its
coords and attributes with the features.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found while reviewing this PR against main.

- CZIWSI kept its open-file context (`_ctx`) when pickled, so CZI slides
  still failed in spawned DataLoader workers. Drop it like `img`.
- The spawn fallback did not recognise Python >= 3.10's "cannot pickle"
  wording, so an unpicklable reader crashed when it could have fallen back.
- A job dir started before scoped state keys has both "coords" and
  "coords:<dir>"; the per-slide summary overwrote the old status. Keep it
  under "unscoped".
- Tests: slides pickle and give the same features in spawn workers; CZI
  pickle round-trip; mixed old/new keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@guillaumejaume
guillaumejaume merged commit bdeeb74 into main Oct 12, 2026
3 checks passed
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