diff --git a/.github/workflows/export-stories-model.yml b/.github/workflows/export-stories-model.yml new file mode 100644 index 00000000000..2507487afa0 --- /dev/null +++ b/.github/workflows/export-stories-model.yml @@ -0,0 +1,68 @@ +name: Export Stories Model + +on: + pull_request: + workflow_dispatch: + schedule: + - cron: '0 10 * * *' + +jobs: + export-dl3-model: + name: export-dl3-model + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + id-token: write + contents: read + steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install executorch + run: | + pip install torchvision executorch + + - name: Export model to PTE + run: | + cat < export_dl3.py + import torch + import torchvision.models as models + from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner + from executorch.exir import to_edge_transform_and_lower + def main() -> None: + model = models.segmentation.deeplabv3_resnet101(weights='DEFAULT').eval() + sample_inputs = (torch.randn(1, 3, 224, 224), ) + et_program = to_edge_transform_and_lower( + torch.export.export(model, sample_inputs), + partitioner=[XnnpackPartitioner()], + ).to_executorch() + with open("dl3_xnnpack_fp32.pte", "wb") as file: + et_program.write_to_file(file) + if __name__ == "__main__": + main() + EOF + + python export_dl3.py + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: dl3-pte + path: | + dl3_xnnpack_fp32.pte + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1.7.0 + with: + role-to-assume: arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-android + aws-region: us-east-1 + + - name: Upload to S3 + run: | + pip install awscli==1.32.18 + + VERSION="snapshot-$(date +"%Y%m%d")" + + aws s3 cp dl3_xnnpack_fp32.pte s3://ossci-android/executorch/models/${VERSION}/dl3_xnnpack_fp32.pte --acl public-read