-
Notifications
You must be signed in to change notification settings - Fork 73
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
[MobileFormer] Converted model outputs values mismatch with original ones. #105
Comments
By the way, these models fails to save as a keras model as well, when I run |
If you want to use MobileFormer's pytorch repo to debug, I have a fork that fixed all the import issues in the office repo. https://github.com/kevinz8866/MobileFormer |
Although experimental, I am adding a validation function to investigate which operations of the model transformation produce errors in the output. I would eventually like to modify the tool itself to automatically check which tensors have large errors. https://github.com/PINTO0309/onnx2tf/releases/tag/1.5.0
|
Added the ability for the tool to automatically identify operations with large model accuracy errors. Kazam_screencast_00100_.mp4 |
It is not possible to save the entire structure of the model to an h5 file, but I have added the ability to extract only the weights and save them to an h5 file. hdf5 format files are output.
|
The final outputs are now nearly identical.
or
A unique feature of TransFormer is that there are several blocks that prevent the tool from converting, as shown in the figure below. Therefore, I checked the structure in Netron and made the same behavioral changes for blocks with the same structure; I copied and pasted most of the JSON. |
Because of the unpredictable transpositions in the tool's automatic transformations, I have implemented a number of enhancements to identify where the errors occur. I believe that MobileFormer other than e9 can be converted with almost the same accuracy by changing the behavior of the tool based on the same criteria. Once I close this issue, if you have successfully converted a model other than e9, I think many researchers and engineers would be pleased if you could pull request a sample JSON file here. |
@kevinz8866 Fixed a fatal bug, allowing converted models to be output to Keras (.h5). However, |
Hi PINTO, Thank you so much all these updates. Sorry I was able to get back to you. I was traveling and a bit busy with the lunar new year. I will try to replicate what you had for me and yes, I will post some json files if I converted more models from onnx to keras. Thank you so much for making this package. I will keep using it and let you know if there is any issue! |
Issue Type
Others
onnx2tf version number
1.4.2
onnx version number
1.12.0
tensorflow version number
2.10.1
Download URL for ONNX
9e: https://drive.google.com/file/d/1vGzO9MZGX-yGz6ATm4yHVJMASZACuy2t/view?usp=share_link
9t: https://drive.google.com/file/d/1Be-a7Pmo6auyAXHChAhC1qtzkbr5EytJ/view?usp=share_link
12e: https://drive.google.com/file/d/1NR-0Fm5q_ludb5MTWgDPzRzqDFKOsCkw/view?usp=share_link
12t: https://drive.google.com/file/d/1ReuXt4gpbq6O7mpUGudaBKjb6wI43ka6/view?usp=share_link
Parameter Replacement JSON
Description
Hi Master PINTO,
Following up on issue #103, the output values of the converted model are different from what is expected. I tried to export the pytorch model in both eval and training and both opset==9 and opset==12. For the models and parameter replacement files, the number stands for opset version, e stands for eval, and t stands for training. This issue happens in all scenarios. Please see this notebook https://drive.google.com/file/d/1mErgTLFiYGTgUnMRDcNp3HkOkSWa96aL/view?usp=share_link to replicate and for issue demonstration.
Also, I see that since you match every onnx operation with a basic tf operation, is there no way to restore those weights as trainable parameters? Thank you so much for keep digging in on this. If you need the original pytorch model or anything else I could assist on, let me know!
The text was updated successfully, but these errors were encountered: