Skip to content

Commit 5333e7f

Browse files
mcremon-metafacebook-github-bot
authored andcommitted
Add vision transformer
Summary: As titled. It will be useful for a few Cadence teams to be able to look at least at the AoT graph. Differential Revision: D59097944
1 parent 4fcd903 commit 5333e7f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# Example script for exporting simple models to flatbuffer
8+
9+
import logging
10+
11+
from executorch.backends.cadence.aot.ops_registrations import * # noqa
12+
13+
import torch
14+
import torchvision
15+
16+
from executorch.backends.cadence.aot.export_example import export_model
17+
18+
19+
FORMAT = "[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s"
20+
logging.basicConfig(level=logging.INFO, format=FORMAT)
21+
22+
23+
if __name__ == "__main__":
24+
25+
model = torchvision.models.vit_b_16()
26+
example_inputs = (torch.randn(1, 3, 224, 224),)
27+
28+
export_model(model, example_inputs)

0 commit comments

Comments
 (0)