-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Fix model.save()
for model YAMLs
#18212
Conversation
Signed-off-by: Mohammed Yasin <[email protected]>
👋 Hello @Y-T-G, thank you for submitting an
For more guidance, please refer to our Contributing Guide. From your PR diff and description, it looks like you are addressing a checkpoint-saving issue by ensuring This is an automated response, but don’t worry—a member of the Ultralytics team will review your PR and assist you soon. Let us know if you have any questions in the meantime. Thank you for contributing to Ultralytics! 🚀 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #18212 +/- ##
==========================================
- Coverage 78.52% 74.00% -4.53%
==========================================
Files 128 128
Lines 17138 17138
==========================================
- Hits 13458 12683 -775
- Misses 3680 4455 +775
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Mohammed Yasin <[email protected]>
@Y-T-G looks good! perhaps we could directly initialize self.ckpt = self.ckpt or {} |
@Laughing-q Yeah, that sounds better |
@Y-T-G @Laughing-q there's a PEP violation that happens when initializing function arguments to non-immutable types like lists and dicts, but it's really annoying and I think we may want to start ignoring it, as otherwise the official standard is to initialize these to This is why you'll often see arguments initialized to None and then changed later in the code. |
Signed-off-by: Glenn Jocher <[email protected]>
model.save()
error when loading from yamlultralytics 8.3.50
fix model.save()
error when loading from YAML
ultralytics 8.3.50
fix model.save()
error when loading from YAMLultralytics 8.3.50
fix model.save()
for model YAMLs
ultralytics 8.3.50
fix model.save()
for model YAMLsmodel.save()
for model YAMLs
Signed-off-by: Glenn Jocher <[email protected]>
@Y-T-G merged! |
Signed-off-by: Mohammed Yasin <[email protected]> Signed-off-by: Glenn Jocher <[email protected]> Co-authored-by: Glenn Jocher <[email protected]>
Closes #18206
MRE
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Improves model consistency by updating how checkpoint data is managed during training and loading.
📊 Key Changes
self.ckpt
fromNone
to an empty dictionary{}
for better initialization.train
method to save both the model and checkpoint data (self.ckpt
) after loading weights.🎯 Purpose & Impact
ckpt
) alongside the model post-training, providing users with more access to training-related information.This change primarily benefits developers working with checkpoints and custom workflows, while maintaining backward compatibility. 🚀