fix: migrate version.model usage to version.models() for roboflow 1.4.0 - #448
Draft
mkaic wants to merge 1 commit into
Draft
fix: migrate version.model usage to version.models() for roboflow 1.4.0#448mkaic wants to merge 1 commit into
mkaic wants to merge 1 commit into
Conversation
roboflow-python 1.4.0 deprecated the singular version.model attribute (MMPV: a version can now own multiple models) and it can return None for versions whose models were trained through the v2 trainings pipeline. Switch the three unpinned notebooks that used it to version.models(), which lists every trained model for the version, newest first. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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.
Note
Code and PR description are LLM-written. Code has been reviewed and tested in staging by Kai
Why
roboflow-python1.4.0 (the MMPV release — a dataset version can now own multiple trained models) deprecated the singularversion.modelattribute in favor ofversion.models(). Two consequences for this repo:version.modelnow prints aDeprecationWarningto users.version.modelis derived from themodelfield on the project payload's version entry, which is absent for versions whose models were trained through the v2 trainings pipeline. For those versionsversion.modelreturnsNoneeven when trained models exist (verified against staging: 1.3.13 returns a working model object forkaiplace/the-paid-gallery/187, 1.4.0 returnsNone, whileversion.models()correctly lists 5 models). The demo versions these notebooks point at are legacy-trained, so they still work today — but they will break silently (assert model, "Model deployment is still loading") once retrained through the new pipeline, and the pattern already breaks for any user following along with their own v2-trained version.What
Migrates the three unpinned notebooks that used
version.modelto the new canonicalversion.models()API (newest model first;TrainedModelsupports the same.predict()/.predict_video()/.poll_until_video_results()calls):notebooks/train-yolov8-keypoint.ipynbnotebooks/train-yolov8-classification-on-custom-dataset.ipynbnotebooks/roboflow_video_inference_with_custom_annotators.ipynbOutputs of the edited cells were cleared (they showed output from the old API, including the since-fixed
prediction_type: 'ClassificationModel'mislabel on keypoint predictions).Not touched: notebooks pinned to
roboflow==1.1.48/1.1.49(insulated from 1.4.0), andtrain-package-detector-two-labeled-images.ipynb(version.train()still works unchanged).Related
The higher-leverage fix is arguably in
roboflow-pythonitself: the deprecatedversion.modelshim could fall back to the v2 surface when the legacy payload field is missing, which would un-break all existing content (docs, blogs, customer code) rather than just this repo.🤖 Generated with Claude Code