dianna-ai / dianna

Deep Insight And Neural Network Analysis
https://dianna.readthedocs.io
Apache License 2.0
48 stars 13 forks source link

FRB example fails in dashboard #858

Closed elboyran closed 1 month ago

elboyran commented 1 month ago

The FRB example in the dashboard fails. Below is error message.

InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Invalid rank for input: conv2d_1_input:0 Got: 3 Expected: 4 Please fix either the inputs/outputs or the model. Traceback:

File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 85, in exec_func_with_error_handling result = func() File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 576, in code_to_exec exec(code, module.dict) File "/mnt/c/Projects/eStep/DIANNA/dianna/dianna/dashboard/Home.py", line 123, in page = importlib.import_module(page_module) File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/mnt/c/Projects/eStep/DIANNA/dianna/dianna/dashboard/pages/Time_series.py", line 199, in explanation = func(serialized_model, ts_data=ts_data_explainer, kwargs) File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 168, in wrapper return cached_func(*args, *kwargs) File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 197, in call return self._get_or_create_cached_value(args, kwargs) File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 224, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 280, in _handle_cache_miss computed_value = self._info.func(func_args, func_kwargs) File "/mnt/c/Projects/eStep/DIANNA/dianna/dianna/dashboard/_models_ts.py", line 32, in _run_rise_timeseries explanation = dianna.explain_timeseries( File "/home/elenar/.local/lib/python3.10/site-packages/dianna/init.py", line 62, in explain_timeseries return explainer.explain(model_or_function, input_timeseries, labels, File "/home/elenar/.local/lib/python3.10/site-packages/dianna/methods/rise_timeseries.py", line 78, in explain predictions = make_predictions(masked, runner, batch_size) File "/home/elenar/.local/lib/python3.10/site-packages/dianna/utils/predict.py", line 22, in make_predictions predictions.append(runner(data[i:i + batch_size])) File "/mnt/c/Projects/eStep/DIANNA/dianna/dianna/dashboard/_models_ts.py", line 30, in run_model return predict(model=_model, ts_data=ts_data) File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 168, in wrapper return cached_func(*args, *kwargs) File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 197, in call return self._get_or_create_cached_value(args, kwargs) File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 224, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) File "/home/elenar/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 280, in _handle_cache_miss computed_value = self._info.func(func_args, **func_kwargs) File "/mnt/c/Projects/eStep/DIANNA/dianna/dianna/dashboard/_models_ts.py", line 17, in predict pred_onnx = sess.run([output_name], onnx_input)[0] File "/home/elenar/.local/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 220, in run return self._sess.run(output_names, input_feed, run_options)

loostrum commented 1 month ago

I remember we explicitly had to add two axes for make the FRB model work. @laurasootes do you know if that's still hardcoded somewhere in the dashboard?

laurasootes commented 1 month ago

Yeah I remember, I'll look into it

laurasootes commented 1 month ago

It was just the change in the name of the example, further down in the script there are some exceptions for the FRB case, because the data is different from regular timeseries data.

fixed in #855