Repository navigation
Conversation
torch.load reads PyTorch's legacy (non-zip) format line by line, but the reader returned by bioimageio.spec's `download` has no `readline`, so `get_model_by_id` failed for models such as emotional-cricket and thoughtful-turtle. Read the weights into a `BytesIO` first.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #645 +/- ##
=======================================
Coverage 89.57% 89.57%
=======================================
Files 74 74
Lines 8605 8606 +1
=======================================
+ Hits 7708 7709 +1
Misses 897 897 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
ModelZoo.get_model_by_id, whichunet_predictionuses to run a BioImage.IO model ID through PanSeg's own UNet, handedtorch.loadthe reader that bioimageio.spec'sdownloadreturns.torch.loadneedsreadlineto read PyTorch's legacy (non-zip) format, and that reader has none, so models saved in that format failed to load, for example emotional-cricket and thoughtful-turtle:This was there before #642: the
download(...source)call in 2.2.0 returned the same reader. I found it while running every PanSeg model on bioimage.io through PanSeg.This PR:
BytesIObeforetorch.load, so both formats loadmock_biio_packagesave its weights in the legacy format, and runstest_get_model_by_id_resolves_bioimageio_idwith both formats; the legacy case fails without the fix