From bd669f9955a06dd0d7fb5a72e83cb0101afdc3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Dupr=C3=A9?= Date: Wed, 12 Nov 2025 20:26:42 +0100 Subject: [PATCH 1/2] fix documentation --- _doc/examples/plot_export_tiny_llm_dim01_onnx.py | 8 +++++++- _doc/examples/plot_export_tiny_llm_dim01_onnx_custom.py | 8 +++++++- onnx_diagnostic/helpers/mini_onnx_builder.py | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/_doc/examples/plot_export_tiny_llm_dim01_onnx.py b/_doc/examples/plot_export_tiny_llm_dim01_onnx.py index 829618f8..2855e722 100644 --- a/_doc/examples/plot_export_tiny_llm_dim01_onnx.py +++ b/_doc/examples/plot_export_tiny_llm_dim01_onnx.py @@ -128,7 +128,13 @@ def validation(ep, input_sets, expected, catch_exception=True): ep.model_proto.SerializeToString(), providers=["CPUExecutionProvider"] ) for k, v in input_sets.items(): - feeds = make_feeds(sess, torch_deepcopy(v), use_numpy=True) + try: + feeds = make_feeds(sess, torch_deepcopy(v), use_numpy=True) + except Exception as e: + if not catch_exception: + raise + yield k, e + continue try: got = sess.run(None, feeds) except Exception as e: diff --git a/_doc/examples/plot_export_tiny_llm_dim01_onnx_custom.py b/_doc/examples/plot_export_tiny_llm_dim01_onnx_custom.py index 34e7dc18..ec4bc09f 100644 --- a/_doc/examples/plot_export_tiny_llm_dim01_onnx_custom.py +++ b/_doc/examples/plot_export_tiny_llm_dim01_onnx_custom.py @@ -146,7 +146,13 @@ def validation(onx, input_sets, expected, catch_exception=True): onx.SerializeToString(), providers=["CPUExecutionProvider"] ) for k, v in input_sets.items(): - feeds = make_feeds(sess, torch_deepcopy(v), use_numpy=True) + try: + feeds = make_feeds(sess, torch_deepcopy(v), use_numpy=True) + except Exception as e: + if not catch_exception: + raise + yield k, e + continue try: got = sess.run(None, feeds) except Exception as e: diff --git a/onnx_diagnostic/helpers/mini_onnx_builder.py b/onnx_diagnostic/helpers/mini_onnx_builder.py index 648155a2..7b945ecd 100644 --- a/onnx_diagnostic/helpers/mini_onnx_builder.py +++ b/onnx_diagnostic/helpers/mini_onnx_builder.py @@ -485,7 +485,7 @@ def _unflatten( try: return pos + 1, torch.from_numpy(outputs[pos]).to(device) except TypeError: - # it shuold be more robusts + # it should be more robust import ml_dtypes if outputs[pos].dtype == ml_dtypes.bfloat16: From 629e193cea321499deeca6fcba34db336f3dec7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Dupr=C3=A9?= Date: Wed, 12 Nov 2025 21:06:44 +0100 Subject: [PATCH 2/2] doc --- onnx_diagnostic/helpers/mini_onnx_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnx_diagnostic/helpers/mini_onnx_builder.py b/onnx_diagnostic/helpers/mini_onnx_builder.py index 7b945ecd..c00baee9 100644 --- a/onnx_diagnostic/helpers/mini_onnx_builder.py +++ b/onnx_diagnostic/helpers/mini_onnx_builder.py @@ -589,7 +589,7 @@ def create_input_tensors_from_onnx_model( See example :ref:`l-plot-intermediate-results` for an example. - .. code-bloc:: python + .. code-block:: python import os from onnx_diagnostic.helpers.mini_onnx_builder import (