Repository navigation
Helpful errors for Ultralytics names, imports and checkpoints - #1032
Merged
Merged
Conversation
from libreyolo import YOLO, Ultralytics weight names, Ultralytics-trained checkpoints, CLI model names and predict options now fail with the LibreYOLO line to type instead. No aliases; Ultralytics checkpoints never reach the autoconverter.
Read only <archive>/data.pkl, capped at 4 MiB, when checking for an Ultralytics checkpoint. Task YAML names (-seg, -pose, -obb, -cls) now suggest an untrained model like detection YAMLs do. The CLI only adds pretrained=False under train; other commands get a full train command.
| f'model = {cls_name}(None, size="{s}"{task_arg}); ' | ||
| # pretrained=False rebuilds the model for scratch training (some | ||
| # families freeze parts of a randomly initialised network otherwise). | ||
| f'model.train(data="your_data.yaml", pretrained=False)', |
There was a problem hiding this comment.
Classification hint suggests unsupported YAML
For classification names such as yolov8m-cls.yaml, the new training step suggests data="your_data.yaml". But LibreMobileNetV4.train() accepts a dataset directory, a known dataset name, or a ZIP URL, not a dataset YAML file. Users who substitute their own YAML file get another error instead of starting training. Use a classification dataset directory in this hint.
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.
Newcomers and coding agents often arrive with Ultralytics habits and hit dead ends with no hint of what to type instead. This turns the most common ones into errors that name the LibreYOLO equivalent.
Changes
from libreyolo import YOLO(alsoRTDETR,NAS,YOLOWorld,YOLOE,SAM) raises anImportErrorthat shows the LibreYOLO import and a one-line example. Plain attribute access still raisesAttributeError, sohasattr()is unchanged.yolov8n.pt,yolo11s-seg.pt, v3u/v5/v8/v9/v10/11/12/26,-seg/-pose/-obb/-cls/-world,yoloe-*,yolo_nas_*, model.yaml, misspellings likeyolov11n) now say it is an Ultralytics name, that LibreYOLO does not load Ultralytics weights, and suggest the closest LibreYOLO model. Every suggested file is checked against the model registry in tests.best.pt) are detected without unpickling and refused with a "train a LibreYOLO model on your data" hint, instead of torch'sweights_only=Falseadvice.predict,train,val,export,quantize,info).predict()optionsproject,name,tracker,persist,save_txt,save_confname the LibreYOLO equivalent.LibreYOLO("yolov8n")no longer suggests a nonexistenthf://weights/yolov8npath.No Ultralytics name becomes an alias, and nothing loads or converts Ultralytics weights.
Tests
tests/unit/test_ultralytics_hints.py(about 60 cases) plus a torch-free import test. Locally withpytest -n 4: new tests,tests/unit/cliand related loading tests pass.Code provenance
Original code written for this PR. No code ported or adapted from other repositories.


Confidence Score: 5/5
The PR appears safe to merge, with a non-blocking correction needed in the classification training hint.Summary
Adds errors that show LibreYOLO alternatives for unsupported Ultralytics imports, model names, checkpoints, and prediction options.
Reviews (3) · Last reviewed commit: "Untrained-model hints train with pretrai..." · Reviewed by Greptile