Skip to content

Commit 7f2fd2b

Browse files
authored
Merge branch 'main' into justinchu/migrate-irbuilder
2 parents ce2428f + 8a94ad6 commit 7f2fd2b

File tree

147 files changed

+9073
-4629
lines changed

Some content is hidden

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

147 files changed

+9073
-4629
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
steps:
4343
- name: Checkout repository
44-
uses: actions/checkout@v4
44+
uses: actions/checkout@v5
4545

4646
# Initializes the CodeQL tools for scanning.
4747
- name: Initialize CodeQL

.github/workflows/lint.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
pull-requests: write
2121

2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v5
2424
- name: misspell # Check spelling
2525
uses: reviewdog/action-misspell@v1
2626
with:
@@ -43,9 +43,9 @@ jobs:
4343
permissions:
4444
security-events: write
4545
steps:
46-
- uses: actions/checkout@v4
46+
- uses: actions/checkout@v5
4747
- name: Setup Python
48-
uses: actions/setup-python@v5
48+
uses: actions/setup-python@v6
4949
with:
5050
# Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset.
5151
python-version: "3.10"

.github/workflows/main.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ jobs:
5757
nox-tag: test-onnx-ir-git
5858
runs-on: ${{ matrix.os }}
5959
steps:
60-
- uses: actions/checkout@v4
60+
- uses: actions/checkout@v5
6161
- name: Setup Python ${{ matrix.python-version }}
62-
uses: actions/setup-python@v5
62+
uses: actions/setup-python@v6
6363
with:
6464
python-version: ${{ matrix.python-version }}
6565
- name: Install nox
@@ -95,9 +95,9 @@ jobs:
9595
os: [ubuntu-latest, windows-latest]
9696
runs-on: ${{ matrix.os }}
9797
steps:
98-
- uses: actions/checkout@v4
98+
- uses: actions/checkout@v5
9999
- name: Setup Python
100-
uses: actions/setup-python@v5
100+
uses: actions/setup-python@v6
101101
with:
102102
python-version: "3.10"
103103
cache: pip
@@ -119,9 +119,9 @@ jobs:
119119
update_readme:
120120
runs-on: ubuntu-latest
121121
steps:
122-
- uses: actions/checkout@v4
122+
- uses: actions/checkout@v5
123123
- name: Setup Python
124-
uses: actions/setup-python@v5
124+
uses: actions/setup-python@v6
125125
- name: Update readme
126126
run: |
127127
python docs/update_readme.py

.github/workflows/pages.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@v5
2929
- name: Setup Pages
3030
uses: actions/configure-pages@v4
3131
- name: Setup Python
32-
uses: actions/setup-python@v5
32+
uses: actions/setup-python@v6
3333
with:
3434
python-version: "3.10"
35-
- uses: actions/checkout@v4
35+
- uses: actions/checkout@v5
3636
- name: Install dependencies
3737
run: |
3838
python -m pip install --upgrade pip setuptools wheel
@@ -42,7 +42,7 @@ jobs:
4242
- name: Build documentation
4343
run: python -m sphinx docs dist/html
4444
- name: Upload documentation archive
45-
uses: actions/upload-pages-artifact@v3
45+
uses: actions/upload-pages-artifact@v4
4646
with:
4747
path: 'dist/html'
4848
- name: Deploy to GitHub Pages

.lintrunner.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ exclude_patterns = [
5757
'onnxscript/rewriter/onnxruntime/transformers/multihead_attention.py', # FIXME
5858
'onnxscript/tools/function_unittest_producer.py', # FIXME
5959
'onnxscript/rewriter/onnxruntime/transformers/layernorm.py', # FIXME
60-
'onnxscript/rewriter/generic_pattern.py', # FIXME
6160
]
6261
command = [
6362
'python',

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0
1+
0.5.5

docs/api/optimizer.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515
optimizer.inline
1616
optimizer.basic_constant_propagation
1717
optimizer.fold_constants
18-
optimizer.remove_unused_nodes
1918
```

examples/pattern_rewriting.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -141,28 +141,3 @@ def rotary_apply_pattern(op, x, pos_ids, axis):
141141
rule = pattern.RewriteRule(rotary_match_pattern, rotary_apply_pattern, verbose=10)
142142

143143
rule.apply_to_model(ir_model)
144-
145-
# TODO(rama): Update the following, the trace-printed looks different now.
146-
147-
######################################
148-
# The logs shows every time the algorithm rejected a pattern.
149-
# We can see the following:
150-
#
151-
# ::
152-
#
153-
# [OnnxGenericPattern.match] NONE - line: 673:onnxscript.rewriter.generic_pattern, op_type=Cast
154-
# --hint--: BACKWARD: different node types
155-
# --pattern
156-
# ConcatTraining(transpose, transpose) -> (output, length)
157-
# -- model
158-
# ConcatTrainingBad(_onx_transpose0, _onx_transpose0) -> (_onx_concattraining0, _onx_concattraining1)
159-
# iteration=1
160-
# --marked-- #2
161-
# Cast(_onx_cos0) ~ Cast(cos) [140186194226496-140186194222320]
162-
# Cos(_onx_concattraining0) ~ Cos(output) [140186194230816-140186194223472]
163-
# len(stacked)=0:[]
164-
#
165-
# Line 673 in file `generic_pattern.py`, the match was rejected.
166-
# It says while comparing two nodes in the backward direction,
167-
# node types do not match.
168-
# It also says that two nodes were actually matched.

noxfile.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313

1414
COMMON_TEST_DEPENDENCIES = (
15-
"beartype==0.17.2",
1615
"expecttest==0.1.6",
1716
"hypothesis",
1817
"numpy",
@@ -30,9 +29,9 @@
3029
"ml-dtypes",
3130
)
3231
ONNX = "onnx==1.17"
33-
ONNX_RUNTIME = "onnxruntime==1.20.1"
34-
PYTORCH = "torch==2.5.1"
35-
TORCHVISON = "torchvision==0.20.1"
32+
ONNX_RUNTIME = "onnxruntime==1.23.0"
33+
PYTORCH = "torch==2.7.1"
34+
TORCHVISON = "torchvision==0.22.1"
3635
TRANSFORMERS = "transformers==4.37.2"
3736
ONNX_RUNTIME_NIGHTLY_DEPENDENCIES = (
3837
"flatbuffers",
@@ -42,7 +41,7 @@
4241
"packaging",
4342
"protobuf",
4443
)
45-
ONNX_IR = "onnx_ir==0.1.3"
44+
ONNX_IR = "onnx_ir==0.1.10"
4645
ONNX_IR_MAIN = "git+https://github.com/onnx/ir-py.git@main#egg=onnx_ir"
4746

4847

onnxscript/_framework_apis/torch_2_5.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ def save_model_with_external_data(model: ir.Model, model_path: str | os.PathLike
6767
"""Save the model with external data. The model is unchanged after saving."""
6868

6969
# TODO(#1835): Decide if we want to externalize large attributes as well
70-
for value in model.graph.initializers.values():
71-
if value.const_value is None:
72-
raise ValueError(
73-
"The model contains uninitialized initializer values. "
74-
"Please make sure all initializer values are initialized."
75-
)
70+
uninitialized_values = [
71+
value.name for value in model.graph.initializers.values() if value.const_value is None
72+
]
73+
if uninitialized_values:
74+
raise ValueError(
75+
f"The model contains uninitialized initializer values ({uninitialized_values}). "
76+
"Please make sure all initializer values are initialized."
77+
)
7678
destination_path = pathlib.Path(model_path)
7779
data_path = f"{destination_path.name}.data"
7880

0 commit comments

Comments
 (0)