Skip to content
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

Softmax Detect conversion errors in axis and identify the axis with the smallest possible error and replace it. #152

Merged
merged 4 commits into from
Jan 28, 2023

Conversation

PINTO0309
Copy link
Owner

@PINTO0309 PINTO0309 commented Jan 28, 2023

1. Content and background

  • Softmax
    • Detect conversion errors in axis and identify the axis with the smallest possible error and replace it.
    • Automatic selection of the axis with the smallest error by measuring the error of all axes in the process of model transformation.
    • Because the minimum inference is performed multiple times, the conversion speed of the model including Softmax is slightly slower, instead of no longer incurring an accuracy error.
    • Almost eliminates conversion errors in Softmax operations in Transformer models that contain a large number of Softmax, such as MobileFormer.
    • This implementation can be applied to various OPs that handle axis. For example, ReduceXX, ArgMax.
    • The sample JSON file was modified to reflect this improvement. https://github.com/PINTO0309/onnx2tf/blob/main/json_samples/replace_MobileFormer-e9.json

image

2. Summary of corrections

3. Before/After (If there is an operating log that can be used as a reference)

4. Issue number (only if there is a related issue)

Implementation of strict mode #145
[MobileFormer] Converted model outputs values mismatch with original ones. #105
[MobileFormer]Dimensions must be equal [Add Layer] #103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant