@@ -81,6 +81,7 @@ def skl2onnx_convert_lightgbm(scope, operator, container):
81
81
###############################################
82
82
# Or with the following command.
83
83
out , err = run_cmd ("cat /proc/cpuinfo" )
84
+ print (out )
84
85
85
86
###############################################
86
87
# Fonction to measure inference time
@@ -124,8 +125,6 @@ def measure_inference(fct, X, repeat, max_time=5, quantile=1):
124
125
# model for a random forest and onnxruntime after it was converted
125
126
# into ONNX and for the following configurations.
126
127
127
- legend = "parallel-batch-4096-block"
128
-
129
128
small = cpu_count () < 12
130
129
if small :
131
130
N = 1000
@@ -142,6 +141,8 @@ def measure_inference(fct, X, repeat, max_time=5, quantile=1):
142
141
depth = [6 , 8 , 10 , 12 , 14 ]
143
142
Regressor = RandomForestRegressor
144
143
144
+ legend = f"parallel-nf-{ n_features } -"
145
+
145
146
# avoid duplicates on machine with 1 or 2 cores.
146
147
n_jobs = list (sorted (set (n_jobs ), reverse = True ))
147
148
@@ -175,7 +176,7 @@ def measure_inference(fct, X, repeat, max_time=5, quantile=1):
175
176
176
177
# parallelization
177
178
cache_name = os .path .join (
178
- cache_dir , f"rf-J-{ n_j } -E-{ n_estimators } -D-{ max_depth } .pkl"
179
+ cache_dir , f"nf- { X . shape [ 1 ] } - rf-J-{ n_j } -E-{ n_estimators } -D-{ max_depth } .pkl"
179
180
)
180
181
if os .path .exists (cache_name ):
181
182
with open (cache_name , "rb" ) as f :
@@ -196,7 +197,7 @@ def measure_inference(fct, X, repeat, max_time=5, quantile=1):
196
197
so = SessionOptions ()
197
198
so .intra_op_num_threads = n_j
198
199
cache_name = os .path .join (
199
- cache_dir , f"rf-J-{ n_j } -E-{ n_estimators } -D-{ max_depth } .onnx"
200
+ cache_dir , f"nf- { X . shape [ 1 ] } - rf-J-{ n_j } -E-{ n_estimators } -D-{ max_depth } .onnx"
200
201
)
201
202
if os .path .exists (cache_name ):
202
203
sess = InferenceSession (cache_name , so )
@@ -268,7 +269,7 @@ def measure_inference(fct, X, repeat, max_time=5, quantile=1):
268
269
269
270
270
271
fig , axes = plt .subplots (n_rows , n_cols , figsize = (4 * n_cols , 4 * n_rows ))
271
- fig .suptitle (f"{ rf .__class__ .__name__ } " )
272
+ fig .suptitle (f"{ rf .__class__ .__name__ } \n X.shape= { X . shape } " )
272
273
273
274
for n_j , n_estimators in tqdm (product (n_jobs , n_ests )):
274
275
i = n_jobs .index (n_j )
0 commit comments