-
Notifications
You must be signed in to change notification settings - Fork 517
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
Added Apple CoreML compilation tutorials for any SG model #1007
Conversation
Pre-Reviewed notebook in colab (where I ran all cells): |
Please note that is worked without calling |
Although it might still work without prep_model_for_conversion - we still need to call it, since this is where we fuse the repvgg branches (otherwise we will have decreased performance). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks for the contribution (:
Some notes-
-
We need to call prep_model_for_conversion, otherwise we will not fuse the repvgg branches (especially important for YoloNAS).
-
If we take our pre-trained YoloNAS as an example, its best that the dummy input will be 640X640.
-
I think it wuold be great to add just some text before the code cells, that briefly explain what is being performed. Maybe even some of the text you added to this PR description.
…ub.com:Deci-AI/super-gradients into feature/SG-000_add_coreml_compilation_notebook
|
Great work here! 💪 |
I added the code to super_gradients.models, just like the ONNX. I didn't want to abuse abstractions here, since we don't forecast many export functions as part of SG, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* fix * fix typo * typo
… and use input_size from prep_model_for_conversion_kwargs (#989)
* wip * wip * added functionality to get wandb latest ckpt before launch * renamed param and simplified procedure * added error for wandb * added docs and example * fix tests --------- Co-authored-by: Eugene Khvedchenya <ekhvedchenya@gmail.com> Co-authored-by: Louis-Dupont <35190946+Louis-Dupont@users.noreply.github.com>
* CityscapesConcatDataset * documentation * ddrnet recipe * unit test * docs * add to init
* predict on fused model * working version * fix * update * update * add benchmarl * add reset * torch.from_numpy * fix
* first proposal * improve * minor change * wip
* Add caching of downloaded files
* add nightly build support * add nightly build support sanity * added nightly param to skip md files * add nightly build support sanity * add nightly build support sanity --------- Co-authored-by: ranrubin <ranrubin@gmail.com>
…ub.com:Deci-AI/super-gradients into feature/SG-000_add_coreml_compilation_notebook
Squashed and signed in 62936fc |
CoreML Compilation Support For Any SG Model
I added a notebook for CoreML compilation, since it was requested by many of our users, and because it is a low-hanging fruit.
Convert to CoreML:
It uses torch tracing, which is recommended by apple as the go-to in terms of coreml source.
Note: The netron visualization does not work on colab, it assumes the notebook is running in localhost.
To compile you SD architecture or model to CoreML:
/content/yolo-nas.mlmodel
The names or the inputs will always be input_1, input_2, and so on, to make it easy on researchers.
CoreML classes use keyword arguments for inference, so having the same input names helps a lot while working with different models and trying different things.