Skip to content

Commit 1fbaed4

Browse files
authored
documentation (#13)
* improve ci * fix README * change version * spelling * change style * fix a few things * rename
1 parent 3df4bc0 commit 1fbaed4

21 files changed

+121
-43
lines changed

.github/workflows/spell-check.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Spell Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
spell-check:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# Checkout the repository
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
# Install codespell
19+
- name: Install codespell
20+
run: pip install codespell
21+
22+
# Run codespell
23+
- name: Run codespell
24+
run: codespell --skip="*.png,*.jpg,*.jpeg,*.gif,*.svg,*.ico,*.pdf,*.js" --ignore-words-list="nd,te,OT" --check-filenames

.github/workflows/wheels-any.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ jobs:
2222
python-version: '3.12'
2323

2424
- name: build wheel
25-
run: python -m pip wheel .
25+
run: python -m pip wheel . -v
26+
27+
- name: install twine
28+
run: python -m pip install twine
29+
30+
- name: check wheel
31+
run: python -m twine check ./onnx_diagnostic*.whl
2632

2733
- uses: actions/upload-artifact@v4
2834
with:

README.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ onnx-diagnostic: investigate onnx models
2626
:target: https://codecov.io/gh/sdpython/onnx-diagnostic
2727

2828
Helps investigating onnx models, exporting modes into onnx.
29-
See :epkg:`documentation of onnx-diagnostic <https://sdpython.github.io/doc/onnx-diagnostic/dev/>`_.
29+
See `documentation of onnx-diagnostic <https://sdpython.github.io/doc/onnx-diagnostic/dev/>`_.
3030

3131
Getting started
3232
+++++++++++++++
@@ -43,18 +43,26 @@ or
4343

4444
pip install onnx-diagnostic
4545

46-
**Enlightening Examples**
46+
Enlightening Examples
47+
+++++++++++++++++++++
48+
49+
**Torch Export**
4750

4851
* `Use DYNAMIC or AUTO when exporting if dynamic shapes has constraints
4952
<https://sdpython.github.io/doc/onnx-diagnostic/dev/auto_examples/plot_export_with_dynamic_shapes_auto.html>`_
5053
* `Export with DynamicCache and dynamic shapes
5154
<https://sdpython.github.io/doc/onnx-diagnostic/dev/auto_examples/plot_export_with_dynamic_cache.html>`_
5255
* `Steel method forward to guess the dynamic shapes
5356
<https://sdpython.github.io/doc/onnx-diagnostic/dev/auto_examples/plot_export_tiny_llm.html>`_
54-
* `Running ReferenceEvaluator on a failing model
55-
<https://sdpython.github.io/doc/onnx-diagnostic/dev/auto_examples/plot_failing_reference_evaluator.html>`_
57+
58+
**Investigate ONNX models**
59+
5660
* `Find where a model is failing by running submodels
5761
<https://sdpython.github.io/doc/onnx-diagnostic/dev/auto_examples/plot_failing_model_extract.html>`_
62+
* `Intermediate results with (ONNX) ReferenceEvaluator
63+
<https://sdpython.github.io/doc/onnx-diagnostic/dev/auto_examples/plot_failing_reference_evaluator.html>`_
64+
* `Intermediate results with onnxruntime
65+
<https://sdpython.github.io/doc/onnx-diagnostic/dev/auto_examples/plot_failing_onnxruntime_evaluator.html>`_
5866

5967
Snapshot of usefuls tools
6068
+++++++++++++++++++++++++
@@ -99,4 +107,4 @@ Snapshot of usefuls tools
99107

100108
**max_diff**
101109

102-
Returns the maximum discrancies accross nested containers containing tensors.
110+
Returns the maximum discrancies across nested containers containing tensors.

_doc/_static/custom.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.output {
2+
background-color: #f8f9fa;
3+
border-left: 4px solid #0078d4;
4+
padding: 10px;
5+
font-family: monospace;
6+
font-size: 0.9em;
7+
}
8+
.sphx-glr-script-out {
9+
padding: 10px;
10+
font-family: monospace;
11+
font-size: 0.9em;
12+
overflow-x: auto;
13+
}

_doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
html_theme_path = ["_static"]
5151
html_theme_options = {}
5252
html_static_path = ["_static"]
53+
html_css_files = ["custom.css"]
5354
html_sourcelink_suffix = ""
5455

5556
issues_github_path = "sdpython/onnx-diagnostic"

_doc/examples/plot_export_tiny_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Steel method forward to guess the dynamic shapes
55
================================================
66
7-
Inputs are always dynamic with LLMs that is why dyanmic shapes
7+
Inputs are always dynamic with LLMs that is why dynamic shapes
88
needs to be specified when a LLM is exported with:func:`torch.export.export`.
99
Most of the examples on :epkg:`HuggingFace` use method
1010
:meth:`transformers.GenerationMixin.generate` but we only want to
@@ -15,7 +15,7 @@
1515
1616
We focus on the model
1717
`Tiny-LLM <https://huggingface.co/arnir0/Tiny-LLM>`_.
18-
To avoid downloading any weigths, we write a function creating a
18+
To avoid downloading any weights, we write a function creating a
1919
random model based on the same architecture.
2020
2121
Steel the forward method

_doc/examples/plot_export_with_dynamic_cache.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def forward(self, x, y):
5454
pprint.pprint(ds)
5555

5656
# %%
57-
# The function returns a tuple with two objets.
57+
# The function returns a tuple with two objects.
5858
# The first one for the positional arguments, the other one
59-
# for the named arguments. There is no named argements. We
59+
# for the named arguments. There is no named arguments. We
6060
# we used the first result to export.
6161

6262
ep = torch.export.export(model, (x, y), dynamic_shapes=ds[0])
@@ -66,7 +66,7 @@ def forward(self, x, y):
6666
# kwargs
6767
# ++++++
6868
#
69-
# We do the same with named argments.
69+
# We do the same with named arguments.
7070

7171

7272
class Model(torch.nn.Module):

_doc/examples/plot_export_with_dynamic_shapes_auto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Use DYNAMIC or AUTO when exporting if dynamic shapes has constraints
55
====================================================================
66
7-
Settings the dynamic shapes is not always easy.
7+
Setting the dynamic shapes is not always easy.
88
Here are a few tricks to make it work.
99
1010
dx + dy not allowed?

_doc/examples/plot_failing_model_extract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
oh.make_node("Cast", ["C"], ["X999"], to=999, name="failing"),
4040
oh.make_node("CastLike", ["X999", "Y"], ["Z"], name="n4"),
4141
],
42-
"nd",
42+
"-nd-",
4343
[
4444
oh.make_tensor_value_info("X", TFLOAT, ["a", "b", "c"]),
4545
oh.make_tensor_value_info("Y", TFLOAT, ["a", "b", "c"]),

_doc/examples/plot_failing_onnxruntime_evaluator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""
22
.. _l-plot-failing-onnxruntime-evaluator:
33
4-
Running OnnxruntimeEvaluator on a failing model
5-
===============================================
4+
Intermediate results with onnxruntime
5+
=====================================
66
77
Example :ref:`l-plot-failing-reference-evaluator` demonstrated
88
how to run a python runtime on a model but it may very slow sometimes
99
and it could show some discrepancies if the only provider is not CPU.
1010
Let's use :class:`OnnxruntimeEvaluator <onnx_diagnostic.reference.OnnxruntimeEvaluator>`.
11-
It splits the model into node and runs them independantly until it succeeds
11+
It splits the model into node and runs them independently until it succeeds
1212
or fails. This class converts every node into model based on the types
1313
discovered during the execution. It relies on :class:`InferenceSessionForTorch
1414
<onnx_diagnostic.ort_session.InferenceSessionForTorch>` or
@@ -43,7 +43,7 @@
4343
oh.make_node("Cast", ["C"], ["X999"], to=999, name="failing"),
4444
oh.make_node("CastLike", ["X999", "Y"], ["Z"], name="n4"),
4545
],
46-
"nd",
46+
"-nd-",
4747
[
4848
oh.make_tensor_value_info("X", TBFLOAT16, ["a", "b", "c"]),
4949
oh.make_tensor_value_info("Y", TBFLOAT16, ["a", "b", "c"]),
@@ -100,7 +100,7 @@
100100
# %%
101101
# We can see it run until it reaches `Cast` and stops.
102102
# The error message is not always obvious to interpret.
103-
# It gets improved everytime from time to time.
103+
# It gets improved every time from time to time.
104104
# This runtime is useful when it fails for a numerical reason.
105105
# It is possible to insert prints in the python code to print
106106
# more information or debug if needed.

0 commit comments

Comments
 (0)