unibench show_results - ValueError: too many inputs
LudovicArnould1 opened this issue · 1 comments
Thank you for your amazing work.
After I installed your library using pip install git+ ...
, I received a ValueError: too many inputs
when running unibench show_results
.
Apparently there is a limitation of the number of conditions passed in pandas.query() due to the numexpr package where a NPY_MAXARGS argument is set (related issue).
Maybe it can be solved by upgrading numpy to 2.1 but I did not try. So I slightly changed the query
method from the OutputHandler
Class by using a mask and applying the isin()
method to efficiently look for the list/df value matching.
def query(self, df=None, **kwargs):
if df is None:
df = self._model_csv
if len(kwargs) == 0:
return df
mask = pd.Series([True] * len(df))
for k, v in kwargs.items():
if isinstance(v, list):
mask &= df[k].isin(v)
else:
mask &= (df[k] == v)
return df[mask]
Then unibench show_results
worked properly.
The full Traceback :
Traceback (most recent call last):
File "/home//anaconda3/bin/unibench", line 8, in <module>
sys.exit(run())
^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/unibench/evaluator.py", line 321, in run
fire.Fire(Evaluator)
File "/home//anaconda3/lib/python3.11/site-packages/fire/core.py", line 143, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/fire/core.py", line 477, in _Fire
component, remaining_args = _CallAndUpdateTrace(
^^^^^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/unibench/evaluator.py", line 172, in show_results
self.outputhandler.print_dataframe(
File "/home//anaconda3/lib/python3.11/site-packages/unibench/output.py", line 188, in print_dataframe
df = self.query(df=self._aggregate, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/unibench/output.py", line 143, in query
return df.query(expr)
^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/pandas/core/frame.py", line 4599, in query
res = self.eval(expr, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/pandas/core/frame.py", line 4725, in eval
return _eval(expr, inplace=inplace, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/pandas/core/computation/eval.py", line 357, in eval
ret = eng_inst.evaluate()
^^^^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/pandas/core/computation/engines.py", line 81, in evaluate
res = self._evaluate()
^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/pandas/core/computation/engines.py", line 121, in _evaluate
return ne.evaluate(s, local_dict=scope)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/numexpr/necompiler.py", line 973, in evaluate
return re_evaluate(local_dict=local_dict, _frame_depth=_frame_depth)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home//anaconda3/lib/python3.11/site-packages/numexpr/necompiler.py", line 1004, in re_evaluate
return compiled_ex(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many inputs
Config :
Ubuntu 22.04.4
Pandas: 2.1.4
Python: 3.11.7
Pip: 23.3.1
Numpy : 1.26.4
Thank you for pointing that out, I will push a new release with a fix!