Skip to content

Better comments #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions _doc/examples/plot_benchmark_rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import numpy
import pandas
from lightgbm import LGBMRegressor
from onnxmltools.convert.lightgbm.operator_converters.LightGbm import convert_lightgbm
from onnxmltools.convert.xgboost.operator_converters.XGBoost import convert_xgboost
from onnxruntime import InferenceSession, SessionOptions
from psutil import cpu_count
from sphinx_runpython.runpython import run_cmd
Expand All @@ -33,9 +31,14 @@
from sklearn.ensemble import RandomForestRegressor
from tqdm import tqdm
from xgboost import XGBRegressor
from onnxmltools.convert.xgboost.operator_converters.XGBoost import convert_xgboost


def skl2onnx_convert_lightgbm(scope, operator, container):
from onnxmltools.convert.lightgbm.operator_converters.LightGbm import (
convert_lightgbm,
)

options = scope.get_options(operator.raw_operator)
if "split" in options:
operator.split = options["split"]
Expand Down
6 changes: 6 additions & 0 deletions onnx_array_api/_command_lines_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,14 @@ def _cmd_compare(argv: List[Any]):

parser = get_parser_compare()
args = parser.parse_args(argv[1:])
if args.verbose in ("1", 1, "True", True):
print(f"[compare] first model {args.model1!r}")
print(f"[compare] second model {args.model2!r}")
onx1 = onnx.load(args.model1)
onx2 = onnx.load(args.model2)
if args.verbose in ("1", 1, "True", True):
print(f"[compare] first model has {len(onx1.graph.node)} nodes")
print(f"[compare] second model has {len(onx2.graph.node)} nodes")
res1, res2, align, dc = compare_onnx_execution(
onx1,
onx2,
Expand Down
5 changes: 3 additions & 2 deletions onnx_array_api/reference/evaluator_yield.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,15 +642,16 @@ def compare_onnx_execution(
print("[compare_onnx_execution] loading first model")
proto1 = load(model1) if isinstance(model1, str) else model1
if verbose:
print("[compare_onnx_execution] loading first model")
print("[compare_onnx_execution] loading second model")
proto2 = load(model2) if isinstance(model2, str) else model2
res1 = list(_enumerate_result_no_execution(proto1))
res2 = list(_enumerate_result_no_execution(proto2))
else:
return

if verbose:
print(f"[compare_onnx_execution] got {len(res2)} results")
print(f"[compare_onnx_execution] got {len(res1)} results (first model)")
print(f"[compare_onnx_execution] got {len(res2)} results (second model)")
print("[compare_onnx_execution] compute edit distance")
dc = DistanceExecution()
_, align = dc.distance_sequence(res1, res2)
Expand Down