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 9import logging 10 11from executorch.backends.cadence.aot.ops_registrations import * # noqa 12 13import torch 14import torchvision 15 16from executorch.backends.cadence.aot.export_example import export_model 17 18 19FORMAT = "[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s" 20logging.basicConfig(level=logging.INFO, format=FORMAT) 21 22 23if __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) 29