-
Notifications
You must be signed in to change notification settings - Fork 446
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
burn-import panic #2023
Comments
We will be happy to accept your contribution. You can launch contributor book to read up more on burn onnx. You should try the main branch. We have over 20 new ops. All contributed recently. |
@doronnac Have you made any progress on this, or at least come up with a temporary fix/workaround? I am also running into this issue. |
@alteredoxide No, unfortunately. Can you share the model you’re having trouble with? |
Please try main branch if you haven't yet. We made many updates since last release |
@doronnac Yeah, I have tried two different models:
I have also tried the quantized versions of both of these, but those result in entirely different errors. |
@antimora I’ve since taken a somewhat different approach, but I’ll try to help @alteredoxide as a learning experience. Obviously your help will be much more effective if you have the time for it. Have a lovely weekend. |
I just noticed that burn via crates is only up to version 0.13.2, but the main branch on github is at 0.14. I just tried building the first model (mxbai) after specifying the repo for both burn and burn-import in order to get the latest version... The result is that I'm no longer getting the index error, but instead I get the following:
So that's cool 😒 Are there any onnx models that you have successfully loaded? If so, which ones? |
@antimora Is there a particular reason for not supporting rank > 1 for the indices in
|
There are a few active PRs trying to fix Gather related issues #2148 and #2149 by @laggui and @hexd0t. I am not sure these will fix you issue, but keep monitoring after the merge. You can share your ONNX file (or link) if sharable for testing/troubleshooting purposes. |
Gather op actually translates to For that, we would need another PR. Quickly reading the op spec, I think it can be implemented by doing |
@antimora @laggui Thanks for the quick replies. After reading the #2148 and #2149, I ended up landing on another related issue: #2115, which is the primary problem that I'm encountering (the scalar error aside, which seems to be solved by #2148). @laggui based on the linked spec, I mostly agree with what you said about concatenating the results of I'll be happy to work on this particular problem if nobody objects. I suppose further discussion should take place in #2115? |
A couple of onnx models have been successfully loaded by users, though I can't recall exactly which. We do have squeezenet on the models repo.
Contributions are more than welcome! 🙏 The linked issue seems to be evolving based on the OP's progress, so I think we can keep the discussion here if needed. |
@antimora @laggui I have been going through the parts of the codebase that pertain to Findings
Changes that I've implemented and tested
You can see the changes I made here |
@alteredoxide as you noted in your first point,
That probably explains the "discrepancies" you observed in the codebase. |
@laggui Thanks, I clearly pulled on the wrong thread, and falsely assumed your previous statement about mapping to I believe I found the correct thread to pull on this time; can you confirm this is the right starting point? |
That's ok 😉 to be fair, it is a bit confusing with the similar (but different) names.
While it is nice for the ndarray implementation, the tensor ops must be consistent across backends for Burn. So the ONNX spec is not what dictates the API functionalities.
Yep! That's where it should be handled, at the codegen level for the gather node 🙂 |
@laggui I have implemented gather at the codegen level, and added a couple test cases... when ensuring that my branch is inline with the latest changes to main, I noticed that there is an onnx test for gather, which pulls from a generated model that fits the previous approach. Doing a little digging, I believe I found where that is generated. Can you please verify this is the file I should modify? Additionally, is there anything you can think of, off the top of your head, that I need to consider/modify? Thanks! Edit: Assuming that is the file I should modify for the existing ONNX test to pass, it seems like I need to address something that I wanted to save until after an initial review of my current code: distributing this kind of "gather" to the different backends and the burn-import ops signatures (e.g. burn-tch/src/ops/base.rs and ops/tensor.rs), which then raises an issue of naming, since all the current |
Yes we generated the onnx file for the tests via this python script. There are also 2 other scripts used to generate different configurations of the gather node, so you can either 1) modify this file to include both the existing operator test and the new gather test for indices rank > 1 or 2) add a new file to generate a separate onnx file for the new test to be included. The current tests are still valid. So if they're not passing something might be wrong in your modifications.
I'm not sure exactly what you mean. Do you mean that you have implemented as a new operator entirely? I guess we will see once the PR is opened 😄 |
@laggui I think I have it all figured out...
See my second bullet point above. I'm going be AFK for the next hour or so, but I'll open a PR once I'm back. |
I don't think this is desired for the public API. Depending on the implementation, it's probably best to just do this in the |
@laggui No worries. I'll remove the public api code and integrate it into the codegen directly before submitting a PR. |
Since the original issue has been resolved, closing this issue in favor of #2192. |
Describe the bug
Hi there, trying to import some ONNX files causes the following panic:
burn-import-0.13.2/src/onnx/from_onnx.rs:363:64:
index out of bounds: the len is 1 but the index is 1
My guess is this has something to do with burn-import being wip.
If that's the case, I'll be happy to give it a go at fixing it, with some tips if possible.
I see this project as very valuable so I'd like to support it.
To Reproduce
Repro
The text was updated successfully, but these errors were encountered: