-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support ONNX Runtime optimizations in exporters.onnx (#807)
* test support * fix decoder merge to work with ORT optimizer * add tests * fix test * fix dockerfile * fix * fix doc * fix * properly raise an error at validation * raise error * fix * fix some test * fix bloom validation * fix broken initializer deduplication in case of name collision * Update optimum/onnx/graph_transformations.py Co-authored-by: Michael Benayoun <mickbenayoun@gmail.com> * Update tests/exporters/onnx/test_exporters_onnx_cli.py Co-authored-by: Michael Benayoun <mickbenayoun@gmail.com> * remove print * fix on suggestions * fix remaining tests * Update docs/source/onnxruntime/usage_guides/optimization.mdx Co-authored-by: regisss <15324346+regisss@users.noreply.github.com> * Update optimum/onnx/graph_transformations.py Co-authored-by: Michael Benayoun <mickbenayoun@gmail.com> * Update optimum/exporters/onnx/convert.py Co-authored-by: Michael Benayoun <mickbenayoun@gmail.com> * Update optimum/onnx/graph_transformations.py Co-authored-by: Michael Benayoun <mickbenayoun@gmail.com> --------- Co-authored-by: Michael Benayoun <mickbenayoun@gmail.com> Co-authored-by: regisss <15324346+regisss@users.noreply.github.com>
- Loading branch information
1 parent
0c72a56
commit 3591786
Showing
19 changed files
with
451 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Exporters / Test GPU | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: 0 1 */3 * * # at 1am every 3 days | ||
pull_request: | ||
types: [labeled] | ||
# uncomment to enable on PR merge on main branch: | ||
#push: | ||
# branches: | ||
# - main | ||
|
||
jobs: | ||
start-runner: | ||
name: Start self-hosted EC2 runner | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_REGION: us-east-1 | ||
EC2_AMI_ID: ami-0dc1c26161f869ed1 | ||
EC2_INSTANCE_TYPE: g4dn.xlarge | ||
EC2_SUBNET_ID: subnet-859322b4,subnet-b7533b96,subnet-47cfad21,subnet-a396b2ad,subnet-06576a4b,subnet-df0f6180 | ||
EC2_SECURITY_GROUP: sg-0bb210cd3ec725a13 | ||
EC2_IAM_ROLE: optimum-ec2-github-actions-role | ||
outputs: | ||
label: ${{ steps.start-ec2-runner.outputs.label }} | ||
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | ||
steps: | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
- name: Start EC2 runner | ||
id: start-ec2-runner | ||
uses: philschmid/philschmid-ec2-github-runner@main | ||
with: | ||
mode: start | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
ec2-image-id: ${{ env.EC2_AMI_ID }} | ||
ec2-instance-type: ${{ env.EC2_INSTANCE_TYPE }} | ||
subnet-id: ${{ env.EC2_SUBNET_ID }} | ||
security-group-id: ${{ env.EC2_SECURITY_GROUP }} | ||
iam-role-name: ${{ env.EC2_IAM_ROLE }} | ||
aws-resource-tags: > # optional, requires additional permissions | ||
[ | ||
{"Key": "Name", "Value": "ec2-optimum-github-runner"}, | ||
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"} | ||
] | ||
do-the-job: | ||
name: Setup | ||
needs: start-runner # required to start the main job when the runner is ready | ||
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner | ||
env: | ||
AWS_REGION: us-east-1 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Build image | ||
run: | | ||
docker build -f tests/exporters/Dockerfile_exporters_gpu -t exporters-gpu . | ||
- name: Test with unittest within docker container | ||
run: | | ||
docker run --rm --gpus all -v $(pwd)/hf_cache:/root/.cache/huggingface --workdir=/workspace/optimum/tests exporters-gpu:latest | ||
stop-runner: | ||
name: Stop self-hosted EC2 runner | ||
needs: | ||
- start-runner # required to get output from the start-runner job | ||
- do-the-job # required to wait when the main job is done | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_REGION: us-east-1 | ||
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs | ||
steps: | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
- name: Stop EC2 runner | ||
uses: philschmid/philschmid-ec2-github-runner@main | ||
with: | ||
mode: stop | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
label: ${{ needs.start-runner.outputs.label }} | ||
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.