Skip to content

Add more models as part of GA models #12340

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mergennachin
Copy link
Contributor

@mergennachin mergennachin commented Jul 10, 2025

Summary

Added 8 new representative models to ExecutorTorch examples:

  • EfficientNet-B4: Image classification with CNN architecture
  • DETR-ResNet50: Object detection using transformer decoder
  • SegFormer-ADE: Semantic segmentation transformer
  • Swin2SR: Super-resolution with Swin transformer
  • ALBERT: Lightweight BERT for NLP tasks
  • TrOCR: Optical character recognition transformer
  • Wav2Vec2: Cross-lingual speech representation learning

All models include XNNPACK backend support with appropriate quantization configurations and full CI integration.

Test plan:

  • Validate model export and execution with portable backend
  • Test XNNPACK delegation and quantization (with appropriate exclusions)
  • Integrate into CI workflows for automated testing
  • Verify all models perform their intended tasks accurately

Copy link

pytorch-bot bot commented Jul 10, 2025

🔗 Helpful Links

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

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

❌ 4 New Failures, 1 Cancelled Job, 7 Unrelated Failures

As of commit 05a4134 with merge base f82c2f0 (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 Jul 10, 2025
@mergennachin mergennachin added the release notes: examples Changes to any of our example LLMs integrations, such as Llama3 and Llava label Jul 10, 2025
@mergennachin mergennachin force-pushed the add_new_models branch 4 times, most recently from ea28cc8 to 9eccb4d Compare July 10, 2025 17:30
@mergennachin mergennachin marked this pull request as draft July 10, 2025 18:36
@mergennachin mergennachin force-pushed the add_new_models branch 7 times, most recently from 8265cc3 to 362b08b Compare July 10, 2025 21:08
@mergennachin mergennachin marked this pull request as ready for review July 10, 2025 21:08
@mergennachin
Copy link
Contributor Author

Tests failures don't look related

swin2sr_2x and trocr_handwritten are not exporting yet. Disabled for now. #12365

Need to export with strict=False so that these models are exportable.

However, when enabling strict=False by default, #12368, there are a few failures, namely ic3,ic4 and llama. #12370

@kimishpatel
Copy link
Contributor

how were these specific models were selected?

from ..model_base import EagerModelBase


class BidirectionalLSTM(nn.Module):
Copy link
Contributor

Choose a reason for hiding this comment

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

this just seems like a sample model to contain lstm? Should we instead include something else? @jackzhxng was looking into kokoro that also has lstm. although export is a problem there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I will delete this one. This one's not really useful

@kimishpatel
Copy link
Contributor

The other question I would have is, what would be the goal of adding more models? Do we just want to claim enablement or at the least provide good perf via xnnpack lowering? Because this might end up expanding the work that needs to happen, not 100% sure, but just calling it out.

Do agree on covering more vision/object detection

@mergennachin
Copy link
Contributor Author

Thanks @kimishpatel

how were these specific models were selected?

So, i followed this process. I looked at https://ai-benchmark.com/ranking.html and https://mlcommons.org/benchmarks/inference-mobile/ models, and see if we can enable any delta that we didn't have. However, it was difficult to find the "official" pytorch and/or huggingface implementation. Most of them are TFLite or ONNX implementations. For some, we were able to find pytorch, like EfficientNet-B4, Albert

So, I swapped with similar models that already has:

Object detection: I swapped Yolov4, SSD-MobileNetV2 with DETR-ResNet50
Semantic Segmentation: I swapped DeepLabV3+ with SegFormer-ADE (even though we already have deeplabv3)
Image super resolution: Swapped ESRGAN with Swin2SR
OCR: Picked TrOCR

The other question I would have is, what would be the goal of adding more models?

Mainly inspired by the the ai-benchmark and mlcommons. The goal would be covering specific tasks that we don't have coverage. We won't be adding many models but only representative models within each tasks. There are still a few missing important ones like depth estimation and video super resolution

For more and more models in specific tasks, we can expand to leverage optimum-executorch instead.

@mergennachin mergennachin force-pushed the add_new_models branch 2 times, most recently from faf2916 to 4ba5a0e Compare July 11, 2025 12:57
Added 8 new representative models to ExecutorTorch examples:

EfficientNet-B4: Image classification with CNN architecture
DETR-ResNet50: Object detection using transformer decoder
SegFormer-ADE: Semantic segmentation transformer
Swin2SR: Super-resolution with Swin transformer
ALBERT: Lightweight BERT for NLP tasks
TrOCR: Optical character recognition transformer
Wav2Vec2: Cross-lingual speech representation learning
All models include XNNPACK backend support with appropriate quantization configurations and full CI integration.

Test plan:

Validate model export and execution with portable backend
Test XNNPACK delegation and quantization (with appropriate exclusions)
Integrate into CI workflows for automated testing
Verify all models perform their intended tasks accurately
@cccclai
Copy link
Contributor

cccclai commented Jul 11, 2025

Any specific reason that ai-benchmark and mlcommons are picked as a reference for the model list? Just curious because there are lists from other source

@guangy10
Copy link
Contributor

@mergennachin thanks for the clarification. And I'm happy to know how we can make a joint effort regarding get more task/model coverage, something happening in optimum-et. Some models like EfficientNet, Albert Swin, were added there already.

I looked at https://ai-benchmark.com/ranking.html and https://mlcommons.org/benchmarks/inference-mobile/ models, and see if we can enable any delta that we didn't have. However, it was difficult to find the "official" pytorch and/or huggingface implementation. Most of them are TFLite or ONNX implementations.

Looks like the main motivation is to enable ai-benchmark to use ET generated models? I recall in the meeting with them, they mentioned that we are deploying exactly same model across all devices and the expense of switching to different variant of models are high. Given it, would adding similar but not exact same models help with adoption by ai-benchmark?

There are still a few missing important ones like depth estimation and video super resolution

I recall there are depth estimation models enabled in HF transformers (e.g. DepthAnything). Not sure about video super resolution (HF doesn't have a task classification for image/video super resolution).

The goal would be covering specific tasks that we don't have coverage. We won't be adding many models but only representative models within each tasks.

What are other tasks we would like to cover for GA? Would it be a good idea if we browse top 1-2 popular models based on the task classification on hugging face hub?

Comment on lines +48 to +54
"efficientnet_b4": XNNPACKOptions(QuantType.STATIC_PER_CHANNEL, True),
"detr_resnet50": XNNPACKOptions(QuantType.STATIC_PER_CHANNEL, True),
"segformer_ade": XNNPACKOptions(QuantType.STATIC_PER_CHANNEL, True),
"swin2sr_2x": XNNPACKOptions(QuantType.STATIC_PER_CHANNEL, True),
"albert": XNNPACKOptions(QuantType.DYNAMIC_PER_CHANNEL, True),
"trocr_handwritten": XNNPACKOptions(QuantType.STATIC_PER_CHANNEL, True),
"wav2vec2": XNNPACKOptions(QuantType.DYNAMIC_PER_CHANNEL, True),
Copy link
Contributor

Choose a reason for hiding this comment

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

@mergennachin Are those models calibrated after statically quantized? And I'm curious to know how you decide how to quantize the model (static vs dynamic) and how the quality of the quantized model is validated?

@mergennachin
Copy link
Contributor Author

What are other tasks we would like to cover for GA? Would it be a good idea if we browse top 1-2 popular models based on the task classification on hugging face hub?

@guangy10 here's what I compiled: #12378

@digantdesai
Copy link
Contributor

Any specific reason that ai-benchmark and mlcommons are picked as a reference for the model list? Just curious because there are lists from other source

Popularity? Please include other popular lists here so we can try them as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: examples Changes to any of our example LLMs integrations, such as Llama3 and Llava
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants