-
Notifications
You must be signed in to change notification settings - Fork 102
📝 Update 05-patch-prediction notebook for the New API
#977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-define-engines-abc
Are you sure you want to change the base?
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-define-engines-abc #977 +/- ##
==========================================================
- Coverage 95.18% 95.15% -0.03%
==========================================================
Files 77 77
Lines 9689 9699 +10
Branches 1255 1255
==========================================================
+ Hits 9222 9229 +7
- Misses 431 434 +3
Partials 36 36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…es model attributes regardless of DataParallel wrapping
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
05-patch-prediction notebook to Make it Compatible with the New Engines API
05-patch-prediction notebook to Make it Compatible with the New Engines API05-patch-prediction notebook for the New API
| """Return a model attribute, unwrapping DataParallel if required.""" | ||
| try: | ||
| return getattr(self.model, attr_name) | ||
| except AttributeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| except AttributeError: | |
| except AttributeError: # pragma: no cover |
| """ | ||
| for path in files: | ||
| notebook = json.loads(path.read_text()) | ||
| with Path.open(path, encoding="utf-8", errors="ignore") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| with Path.open(path, encoding="utf-8", errors="ignore") as f: | |
| notebook = json.loads(path.read_text()) |
| for path in files: | ||
| notebook = json.loads(path.read_text()) | ||
| with Path.open(path, encoding="utf-8", errors="ignore") as f: | ||
| notebook = json.load(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| notebook = json.load(f) |
|
View / edit / reply to this conversation on ReviewNB shaneahmed commented on 2025-12-19T11:40:55Z zarr_output = zarr.open("path/to/zarr", mode="r")
predictions = {}
for key in zarr_output: predictions[key]=da.from_zarr(zarr_output[key})
_ = predictor.save_predictions(predictions, output_type="annotation_store") |
|
View / edit / reply to this conversation on ReviewNB shaneahmed commented on 2025-12-19T11:40:55Z Line #2. tiatoolbox visualize --slides ./tmp/slides --overlays ./tmp/wsi_predictions_annotationstore/ |
|
View / edit / reply to this conversation on ReviewNB shaneahmed commented on 2025-12-19T11:45:19Z Add class_dict for visualization |
Updates examples/05-patch-prediction.ipynb to match the new PatchPredictor engine, and adds a new “Visualize in TIAViz” section so readers can inspect results directly using TIAViz.
Fixes the EngineABC's model-attribute retrieval bug, so it unwraps DataParallel models when needed (using "_get_model_attr()"); this removes the previous multi-GPU crashes caused by attributes living on the wrapped module.