Skip to content

Commit 5805786

Browse files
martinlsmMartin Lindström
andauthored
Arm backend: Add unit test for DeiT-Tiny model on TOSA-MI backend (#10391)
Add unit test that runs the DeiT-Tiny model on the TOSA-MI profile. The output performance is not great at the moment. An internal ticket has been created to debug this problem later. ### Test plan Command used to test the patch: `python -m pytest -s -c /dev/null --log-level=DEBUG "backends/arm/test/models/test_deit_tiny_arm.py"` Co-authored-by: Martin Lindström <Martin.Lindstroem@arm.com>
1 parent 59dce3d commit 5805786

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2025 Arm Limited and/or its affiliates.
2+
#
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
import logging
7+
8+
from typing import Tuple
9+
10+
import timm
11+
12+
import torch
13+
14+
from executorch.backends.arm.test.tester.test_pipeline import TosaPipelineMI
15+
16+
from timm.data import IMAGENET_INCEPTION_MEAN, IMAGENET_INCEPTION_STD
17+
from torchvision import transforms
18+
19+
logger = logging.getLogger(__name__)
20+
logger.setLevel(logging.INFO)
21+
22+
23+
deit_tiny = timm.models.deit.deit_tiny_patch16_224(pretrained=True)
24+
deit_tiny.eval()
25+
26+
normalize = transforms.Normalize(
27+
mean=IMAGENET_INCEPTION_MEAN, std=IMAGENET_INCEPTION_STD
28+
)
29+
model_inputs = (normalize(torch.rand((1, 3, 224, 224))),)
30+
31+
input_t = Tuple[torch.Tensor]
32+
33+
34+
def test_deit_tiny_tosa_MI():
35+
pipeline = TosaPipelineMI[input_t](
36+
deit_tiny,
37+
model_inputs,
38+
aten_op=[],
39+
exir_op=[],
40+
use_to_edge_transform_and_lower=True,
41+
atol=6.5, # This needs to go down: MLETORCH-940
42+
qtol=1,
43+
)
44+
pipeline.run()

0 commit comments

Comments
 (0)