Skip to content

Conversation

@gozdeg
Copy link
Collaborator

@gozdeg gozdeg commented Dec 15, 2025

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.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.15%. Comparing base (39ae9cb) to head (c960baf).

Files with missing lines Patch % Lines
tiatoolbox/models/engine/engine_abc.py 70.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shaneahmed shaneahmed changed the title 📝 Make changes to 05-patch-prediction notebook 📝 Update 05-patch-prediction notebook to Make it Compatible with the New Engines API Dec 17, 2025
@shaneahmed shaneahmed changed the title 📝 Update 05-patch-prediction notebook to Make it Compatible with the New Engines API 📝 Update 05-patch-prediction notebook for the New API Dec 17, 2025
@gozdeg gozdeg marked this pull request as ready for review December 18, 2025 17:59
@shaneahmed shaneahmed added this to the Release v2.0.0 milestone Dec 19, 2025
@shaneahmed shaneahmed added the documentation Improvements or additions to documentation label Dec 19, 2025
"""Return a model attribute, unwrapping DataParallel if required."""
try:
return getattr(self.model, attr_name)
except AttributeError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
notebook = json.load(f)

@review-notebook-app
Copy link

review-notebook-app bot commented Dec 19, 2025

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")


@review-notebook-app
Copy link

review-notebook-app bot commented Dec 19, 2025

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/

@review-notebook-app
Copy link

review-notebook-app bot commented Dec 19, 2025

View / edit / reply to this conversation on ReviewNB

shaneahmed commented on 2025-12-19T11:45:19Z
----------------------------------------------------------------

Add class_dict for visualization


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants