-
Notifications
You must be signed in to change notification settings - Fork 15
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 ONNX support #129
Added ONNX support #129
Conversation
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.
Thanks @jacobf18 ! That looks good to me.
As you said, we are going to need to add some logic to load the libraries. I'm also +1 to make Qt an optional dependency. Overall, +1 to merge as is and clean-up, add library selection logic, and so on.. in a second PR.
'PyQt5', | ||
'PyQt6', |
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.
Any reason to change this?
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.
If we can make the dependencies optional, then we should nest the import statements for torch and onnx inside the functions that use them.
Perhaps we should add a helper function that does the import and checks that at least one of them is installed?
'torch', | ||
'onnxruntime', |
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.
Is there a way we can make both optional dependencies, since the user only needs to install one?
Yes, we need to add some selection logic and get rid of the import at the top-level. Probably requires also 2 separate files, one for |
Alright. Sounds good to me. LGTM with the exception of CI. Does it just need a restart possibly? Thanks @jacobf18! |
No the ubuntu ones have been broken for a while because of some xvfb stuff, it will be a good occasion to fix them as well.. |
@jacobf18 Do you want to give a shot to a logic to set
A couple of ideas: we should move the network part to a
Or maybe an empty Let me know if you want to give it a shot, else I'll do it in the coming days. Once it's sorted out, we can release a 0.5 version with this addition, and maybe get this correctly packaged on |
Merging and picking this up today with another PR to add the selection of the backend. Let's not stall this :) |
PR Description
Added ONNX support to iclabel. I changed the function
run_iclabel
to include a library parameter. This parameter's default value is set to use PyTorch. I added unit tests to check the network outputs against MATLAB. ONNX is faster to load and more lightweight than PyTorch.The options for the
library
parameter arepytorch
andonnx
so far. It throws aValueError
for any other input.Closes #125.
Merge checklist
Maintainer, please confirm the following before merging: