-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
Simplified PyTorch hub custom models #1677
Conversation
Hello, is there a reason why auto shape is not done automatically(inside the functions)? Is there a case where users don’t need auto shape? |
@NanoCode012 that's a good question. The only reason not to use .autoshape() would be if you want to use the model for training (with your own custom training code) rather than for inference. I'd assume very few people are doing this though, as most would probably just use this repository to train and then place the model in their project for inference. The problem is that the autoshape action is not reversible, mostly because it contains a call to .fuse(), so if the model is provided by default with autoshape then it would not be possible to train with it. |
@glenn-jocher , perhaps you can add an argument like autoshape=False or trainable=False and set autoshape to True by default? |
@NanoCode012 actually that's a good idea. Then instead of 99% of the people being confused it will invert and the 1% that want to train will be confused, which should work a lot better for the majority. Ok I'll add a TODO here for that. TODO: think about enabling autoshape by default on all PyTorch Hub model. |
Removing TODO as PR #1692 is now open. |
This PR simplifies the process of loading a custom YOLOv5-based model (of any architecture) in PyTorch Hub. The new syntax is very simple:
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
New support for loading custom YOLOv5 models directly from user-specified paths.
📊 Key Changes
custom()
function tohubconf.py
allowing users to load their own trained YOLOv5 models..pt
file.state_dict
and class names (names
).__main__
block.🎯 Purpose & Impact