Skip to content

Add quantize option to the coreml script #5710

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

Closed
wants to merge 1 commit into from

Conversation

cccclai
Copy link
Contributor

@cccclai cccclai commented Sep 26, 2024

Summary:
Add the quantizer to the export script. The commandline is

python executorch.examples.apple.coreml.scripts.export -m resnet18 --quantize

Differential Revision: D63476611

Copy link

pytorch-bot bot commented Sep 26, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/5710

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 7c5eec5 with merge base 8b5cf96 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 26, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63476611

@cccclai
Copy link
Contributor Author

cccclai commented Sep 26, 2024

@cymbalrush @YifanShenSZ we observed the latency number is quite when loading the quantized model. Can you share some guidance on how to have the optimum latency on the resnet flow here?

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63476611

cccclai added a commit to cccclai/executorch-1 that referenced this pull request Sep 26, 2024
Summary:
Pull Request resolved: pytorch#5710

Add the quantizer to the export script. The commandline is
```
python executorch.examples.apple.coreml.scripts.export -m resnet18 --quantize
```

Differential Revision: D63476611
Summary:
Pull Request resolved: pytorch#5710

Add the quantizer to the export script. The commandline is
```
python executorch.examples.apple.coreml.scripts.export -m resnet18 --quantize
```

Reviewed By: shoumikhin

Differential Revision: D63476611
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63476611

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in fe0e676.

huydhn added a commit that referenced this pull request Oct 4, 2024
buffer = exec_prog.buffer
filename = f"{model_name}_coreml_{compute_unit}.pte"
data_type = "quantize" if quantize else "fp"
filename = f"{model_name}_coreml_{compute_unit}_{data_type}.pte"
Copy link
Contributor

@huydhn huydhn Oct 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line is responsible for the coreml failure in trunk https://hud.pytorch.org/pytorch/executorch/commit/77e7ad10903ed3bcf16e41d04a5e595ecaa1458b. It changes the export model file name from mv3_coreml_all.pte to mv3_coreml_all_fp.pte. The name is used in many different tests https://github.com/search?q=repo%3Apytorch%2Fexecutorch+mv3_coreml_all&type=code.

There might be other test models setup in the same way, not only mv3 .

cc @SS-JIA @cccclai

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to revert the change fixes the failures #5906

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah good finding. Sorry I didn't realize the name was hardcoded. Approve the revert change.

facebook-github-bot pushed a commit that referenced this pull request Oct 7, 2024
Summary:
Debug coreml failure, no need to review

Pull Request resolved: #5906

Reviewed By: cccclai

Differential Revision: D63950443

Pulled By: huydhn

fbshipit-source-id: 5c2c2ad0b140bf9b33d52c9631ff3cc4a576210f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants