Skip to content

Conversation

@guangy10
Copy link
Contributor

What does this PR do?

MobileBERT is ExecuTorch compatible.

Unit Test:
RUN_SLOW=1 pytest tests/models/bert/test_modeling_mobilebert.py -k test_export -v

tests/models/mobilebert/test_modeling_mobilebert.py::MobileBertModelIntegrationTests::test_export PASSED                                                                                [100%]

E2E test in ExecuTorch:
Patch pytorch/executorch#6509
python -m extension.export_util.export_hf_model -hfm="google/mobilebert-uncased" -lm="masked_lm"

Saved exported program to ./mobilebert.pte

./cmake-out/backends/xnnpack/xnn_executor_runner --model_path mobilebert.pte

I 00:00:00.052851 executorch:executor_runner.cpp:82] Model file mobilebert.pte is loaded.
I 00:00:00.052931 executorch:executor_runner.cpp:91] Using method forward
I 00:00:00.052941 executorch:executor_runner.cpp:138] Setting up planned buffer 0, size 78562304.
I 00:00:00.080190 executorch:executor_runner.cpp:161] Method loaded.
I 00:00:00.080223 executorch:executor_runner.cpp:171] Inputs prepared.
I 00:00:01.315332 executorch:executor_runner.cpp:180] Model executed successfully.
I 00:00:01.315349 executorch:executor_runner.cpp:184] 1 outputs:
Output 0: tensor(sizes=[1, 64, 30522], [
  -8.54569, -9.2325, -9.63534, -9.15334, -8.9625, -8.23703, -8.13457, -8.46437, -9.27599, -10.4376,
  -9.40925, -8.32582, -7.68392, -9.18805, -9.3336, -8.71841, -9.52881, -8.03673, -10.02, -9.08982,
  -10.1946, -9.01746, -8.93738, -8.80435, -9.85641, -10.1131, -8.68367, -7.66197, -11.1961, -9.6375,
  -10.6121, -9.54771, -9.9602, -9.8043, -8.37304, -9.33157, -10.0574, -9.67762, -8.67488, -9.94721,
  -8.77431, -11.054, -9.39442, -9.91193, -8.54864, -10.2091, -9.69447, -10.2535, -8.71598, -8.85885,
  -10.5134, -10.151, -9.6825, -10.2545, -9.03317, -9.3754, -10.1931, -8.01357, -7.8706, -9.44086,
  -7.66918, -8.66947, -8.13562, -8.58915, -11.6404, -8.62273, -8.92262, -9.81593, -8.25118, -8.82181,
  -11.4176, -9.58474, -8.92113, -8.37405, -8.7471, -8.637, -9.41958, -8.99523, -10.1699, -9.5519,
  -8.48485, -9.90429, -8.82682, -9.10106, -9.65399, -9.55595, -9.16413, -7.88924, -8.53024, -8.77796,
  -9.7509, -9.06045, -10.9217, -10.7008, -8.35735, -10.2375, -9.26975, -8.89627, -9.15771, -9.24441,
  ...,
  -7.41324, -7.98777, -6.96755, -5.78335, -6.45162, -6.61997, -7.14526, -7.84212, -7.80403, -6.78576,
  -6.23739, -6.91561, -5.49068, -6.96955, -6.45688, -6.2613, -5.91608, -6.87685, -6.08245, -6.84436,
  -7.63106, -6.86492, -7.27272, -7.66639, -5.61715, -6.88419, -6.54495, -7.39954, -4.94468, -7.13938,
  -6.0773, -6.17809, -6.97764, -7.4307, -6.80996, -6.7768, -7.37503, -7.60815, -7.17836, -6.44587,
  -7.20048, -5.83285, -6.8438, -5.48847, -6.91492, -6.98491, -5.9548, -7.00031, -6.17852, -6.701,
  -6.21065, -7.01716, -7.04772, -7.45687, -7.57249, -5.39035, -6.14504, -6.50262, -6.42711, -7.29622,
  -6.24016, -7.12543, -7.03201, -7.88257, -7.04191, -7.0761, -6.95057, -6.0472, -5.97595, -6.85439,
  -5.8476, -6.37267, -6.20555, -7.30387, -6.25161, -7.53724, -6.54707, -6.81088, -6.88549, -6.02146,
  -6.34617, -6.92539, -7.22334, -7.04436, -6.80034, -6.05272, -6.70695, -8.43641, -0.241071, -2.15037,
  -6.41449, -5.42762, -6.04412, -7.70756, -7.53018, -6.31514, -7.02132, -6.56385, -7.70365, 0.30994,
])

Before submitting

Who can review?

@ArthurZucker
@qubvel

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@ArthurZucker ArthurZucker merged commit 34620e8 into huggingface:main Oct 29, 2024
13 checks passed
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants