Skip to content

Commit 8533016

Browse files
chunnienchaozha111vamsimanchalawrighkv1advaitjain
committed
Initial commit
--------- Co-authored-by: Haoliang Zhang <[email protected]> Co-authored-by: Vamsi Krishna Manchala <[email protected]> Co-authored-by: wrighkv1 <[email protected]> Co-authored-by: Advait Jain <[email protected]> Co-authored-by: Majid Dadashi <[email protected]> Co-authored-by: T.J. Alumbaugh <[email protected]> Co-authored-by: hheydary <[email protected]> Co-authored-by: Pauline Sho <[email protected]> Co-authored-by: marialyu <[email protected]> Co-authored-by: Eric Yang <[email protected]> Co-authored-by: Jun Jiang <[email protected]> Co-authored-by: Matthew Soulanille <[email protected]> Co-authored-by: Pulkit Bhuwalka <[email protected]> Co-authored-by: Yasir Modak <[email protected]> Co-authored-by: Arian Arfaian <[email protected]> Co-authored-by: Kristen Wright <[email protected]> Co-authored-by: qihqi <[email protected]> Co-authored-by: suleshahid <[email protected]> Co-authored-by: yishuangP <[email protected]> Co-authored-by: zeekco <[email protected]>
0 parents  commit 8533016

File tree

208 files changed

+55570
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+55570
-0
lines changed

.bazelrc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Tensorflow needs remote repo
2+
common --experimental_repo_remote_exec
3+
4+
# Basic build settings
5+
build --jobs 128
6+
build --enable_platform_specific_config
7+
8+
build --define xnnpack_use_latest_ops=true
9+
10+
# Linux
11+
build:linux --cxxopt=-std=c++17
12+
build:linux --host_cxxopt=-std=c++17
13+
build:linux --copt=-w
14+
15+
# Android configs.
16+
build:android --crosstool_top=//external:android/crosstool
17+
build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
18+
build:android --copt=-DABSL_FLAGS_STRIP_NAMES=0
19+
build:android --linkopt=-landroid
20+
build:android --linkopt=-ldl
21+
build:android --linkopt=-llog
22+
build:android --linkopt=-lm
23+
build:android --linkopt=-Wl,--gc-sections
24+
# TODO: Remove this flag once we updated to NDK 25
25+
build:android --define=xnn_enable_arm_i8mm=false
26+
27+
build:android_arm --config=android
28+
build:android_arm --cpu=armeabi-v7a
29+
build:android_arm --fat_apk_cpu=armeabi-v7a
30+
build:android_arm --platforms=//build_config:android_arm
31+
32+
build:android_arm64 --config=android
33+
build:android_arm64 --cpu=arm64-v8a
34+
build:android_arm64 --fat_apk_cpu=arm64-v8a
35+
build:android_arm64 --platforms=//build_config:android_arm64

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Bug report
2+
description: Use this template to report bugs
3+
labels: ["type:bug", "component:converter", "component:quantization"]
4+
body:
5+
- type: textarea
6+
id: description
7+
attributes:
8+
label: >
9+
Description of the bug:
10+
- type: textarea
11+
id: behavior
12+
attributes:
13+
label: >
14+
Actual vs expected behavior:
15+
- type: textarea
16+
id: info
17+
attributes:
18+
label: >
19+
Any other information you'd like to share?
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Feature request
2+
description: Use this template to report feature requests
3+
labels: ["type:feature request", "component:converter", "component:quantization"]
4+
body:
5+
- type: textarea
6+
id: description
7+
attributes:
8+
label: >
9+
Description of the bug:
10+
- type: textarea
11+
id: behavior
12+
attributes:
13+
label: >
14+
Actual vs expected behavior:
15+
- type: textarea
16+
id: info
17+
attributes:
18+
label: >
19+
Any other information you'd like to share?

.github/workflows/formatting.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# YAML schema for GitHub Actions:
2+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
3+
#
4+
# Helpful YAML parser to clarify YAML syntax:
5+
# https://yaml-online-parser.appspot.com/
6+
#
7+
# This workflow will run nightly or when triggered from PR comment
8+
9+
name: Formatting
10+
11+
on:
12+
workflow_call:
13+
inputs:
14+
trigger-sha:
15+
required: true
16+
type: string
17+
18+
jobs:
19+
check-code-style:
20+
runs-on: ubuntu-latest
21+
22+
name: Code Style
23+
steps:
24+
- uses: actions/setup-python@v4
25+
with:
26+
python-version: "3.11"
27+
- uses: actions/checkout@v3
28+
with:
29+
ref: ${{ inputs.trigger-sha }}
30+
- name: Install dependencies
31+
run: |
32+
pip3 install pyink isort
33+
- name: Check code style
34+
run: |
35+
ci/test_code_style.sh
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# YAML schema for GitHub Actions:
2+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
3+
#
4+
# Helpful YAML parser to clarify YAML syntax:
5+
# https://yaml-online-parser.appspot.com/
6+
#
7+
# This workflow will run nightly or when triggered from PR comment
8+
9+
name: Generative API Examples
10+
11+
on:
12+
workflow_call:
13+
inputs:
14+
trigger-sha:
15+
required: true
16+
type: string
17+
18+
jobs:
19+
check-examples:
20+
runs-on:
21+
labels: Linux_runner_8_core
22+
23+
steps:
24+
- uses: actions/setup-python@v4
25+
with:
26+
python-version: "3.11"
27+
- uses: bazel-contrib/[email protected]
28+
with:
29+
# Avoid downloading Bazel every time.
30+
bazelisk-cache: true
31+
# Store build cache per workflow.
32+
disk-cache: false
33+
# Share repository cache between workflows.
34+
repository-cache: false
35+
- uses: nttld/setup-ndk@v1
36+
id: setup-ndk
37+
with:
38+
ndk-version: r21e
39+
add-to-path: false
40+
- uses: actions/setup-java@v3
41+
with:
42+
java-version: "17"
43+
distribution: "temurin"
44+
- uses: android-actions/setup-android@v3
45+
- run: |
46+
sdkmanager "build-tools;30.0.3" "platform-tools"
47+
sdkmanager "platforms;android-30" "extras;android;m2repository"
48+
- uses: actions/checkout@v3
49+
with:
50+
ref: ${{ inputs.trigger-sha }}
51+
- name: Install python dependencies
52+
run: |
53+
pip3 install numpy
54+
- name: Build
55+
run: |
56+
ci/test_examples_build.sh
57+
env:
58+
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}

.github/workflows/mark_stale.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2+
#
3+
# You can adjust the behavior by modifying this file.
4+
# For more information, see:
5+
# https://github.com/actions/stale
6+
name: Mark stale issues and pull requests
7+
8+
on:
9+
schedule:
10+
# Scheduled to run at 1.30 UTC everyday
11+
- cron: '30 1 * * *'
12+
13+
jobs:
14+
stale:
15+
16+
runs-on: ubuntu-latest
17+
permissions:
18+
issues: write
19+
pull-requests: write
20+
actions: write
21+
22+
steps:
23+
- uses: actions/stale@v9
24+
with:
25+
days-before-issue-stale: 7
26+
days-before-issue-close: 7
27+
stale-issue-label: "status:stale"
28+
close-issue-reason: completed
29+
any-of-labels: "status:awaiting user response,status:more data needed"
30+
stale-issue-message: >
31+
Marking this issue as stale since it has been open for 7 days with no activity.
32+
This issue will be closed if no further activity occurs.
33+
close-issue-message: >
34+
This issue was closed because it has been inactive for 14 days.
35+
Please post a new issue if you need further assistance. Thanks!
36+
days-before-pr-stale: 14
37+
days-before-pr-close: 14
38+
stale-pr-label: "status:stale"
39+
stale-pr-message: >
40+
Marking this pull request as stale since it has been open for 14 days with no activity.
41+
This PR will be closed if no further activity occurs.
42+
close-pr-message: >
43+
This pull request was closed because it has been inactive for 28 days.
44+
Please open a new pull request if you need further assistance. Thanks!
45+
# Label that can be assigned to issues to exclude them from being marked as stale
46+
exempt-issue-labels: 'override-stale'
47+
# Label that can be assigned to PRs to exclude them from being marked as stale
48+
exempt-pr-labels: "override-stale"

.github/workflows/model_coverage.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# YAML schema for GitHub Actions:
2+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
3+
#
4+
# Helpful YAML parser to clarify YAML syntax:
5+
# https://yaml-online-parser.appspot.com/
6+
#
7+
# This workflow will run nightly or when triggered from PR comment
8+
9+
name: Model Coverage
10+
11+
on:
12+
workflow_call:
13+
inputs:
14+
trigger-sha:
15+
required: true
16+
type: string
17+
18+
jobs:
19+
test-model-coverage:
20+
strategy:
21+
matrix:
22+
python-version: ["3.9", "3.10", "3.11"]
23+
runs-on:
24+
labels: Linux_runner_8_core
25+
steps:
26+
- uses: actions/checkout@v3
27+
with:
28+
ref: ${{ inputs.trigger-sha }}
29+
30+
- name: Checkout benchmark repository
31+
uses: actions/checkout@v3
32+
with:
33+
repository: ${{ secrets.PYTORCH_BENCHMARK_REPO }}
34+
path: ${{ github.workspace }}/benchmark
35+
token: ${{ secrets.PYTORCH_BENCHMARK_REPO_READER }}
36+
37+
- uses: actions/setup-python@v4
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
cache: "pip"
41+
cache-dependency-path: "**/*requirements.txt"
42+
43+
- run: python -m pip install --upgrade pip setuptools
44+
45+
- name: Setup benchmark repository
46+
run: |
47+
bash ${{ github.workspace }}/benchmark/ci_ai_edge_torch/ci_setup.sh
48+
49+
- name: Install ai-edge-torch
50+
run: |
51+
python -m pip install -r dev-requirements.txt --force-reinstall
52+
python -m pip install . --no-cache-dir
53+
54+
- name: Run tests
55+
run: |
56+
cd ${{ github.workspace }}/benchmark
57+
python -m pytest ci_ai_edge_torch -n 4
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Helpful YAML parser to clarify YAML syntax:
2+
# https://yaml-online-parser.appspot.com/
3+
4+
name: Generative API (nightly)
5+
6+
on:
7+
schedule:
8+
# 10 am UTC is 3am or 4am PT depending on daylight savings.
9+
- cron: '0 10 * * *'
10+
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
run-generative-api-examples:
15+
name: Generative API Examples
16+
uses: ./.github/workflows/generative_api_examples.yml
17+
with:
18+
trigger-sha: ${{ github.sha }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Helpful YAML parser to clarify YAML syntax:
2+
# https://yaml-online-parser.appspot.com/
3+
4+
name: Model Coverage (nightly)
5+
6+
on:
7+
schedule:
8+
# 10 am UTC is 3am or 4am PT depending on daylight savings.
9+
- cron: '0 10 * * *'
10+
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
run-model-coverage:
15+
name: Model Coverage (nightly)
16+
uses: ./.github/workflows/model_coverage.yml
17+
secrets: inherit
18+
with:
19+
trigger-sha: ${{ github.sha }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Helpful YAML parser to clarify YAML syntax:
2+
# https://yaml-online-parser.appspot.com/
3+
4+
name: pip Install Test (nightly)
5+
6+
on:
7+
schedule:
8+
# 10 am UTC is 3am or 4am PT depending on daylight savings.
9+
- cron: '0 10 * * *'
10+
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
run-pip-install:
15+
strategy:
16+
matrix:
17+
python-version: ["3.9", "3.10", "3.11"]
18+
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install requirements
25+
run: |
26+
pip install -r https://raw.githubusercontent.com/google-ai-edge/ai-edge-torch/main/requirements.txt
27+
- name: Install ai-edge-torch
28+
run: |
29+
pip install ai-edge-torch
30+
- name: Import ai-edge-torch
31+
run: |
32+
python -c "import ai_edge_torch"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Helpful YAML parser to clarify YAML syntax:
2+
# https://yaml-online-parser.appspot.com/
3+
4+
name: Unit Tests (nightly)
5+
6+
on:
7+
schedule:
8+
# 10 am UTC is 3am or 4am PT depending on daylight savings.
9+
- cron: '0 10 * * *'
10+
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
run-unittests-python:
15+
name: Unit Tests Python
16+
uses: ./.github/workflows/unittests_python.yml
17+
with:
18+
trigger-sha: ${{ github.sha }}

.github/workflows/run_post_merge.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Helpful YAML parser to clarify YAML syntax:
2+
# https://yaml-online-parser.appspot.com/
3+
4+
name: Run Post Merge
5+
6+
on:
7+
push:
8+
branches:
9+
- 'main'
10+
- 'releases/**'
11+
12+
jobs:
13+
run-model-coverage:
14+
name: Model Coverage
15+
uses: ./.github/workflows/model_coverage.yml
16+
secrets: inherit
17+
with:
18+
trigger-sha: ${{ github.event.after }}

0 commit comments

Comments
 (0)