NeuroTechX / moabb

Mother of All BCI Benchmarks
https://neurotechx.github.io/moabb/
BSD 3-Clause "New" or "Revised" License
646 stars 168 forks source link

RuntimeError: self must be a matrix #536

Closed dawin2015 closed 5 months ago

dawin2015 commented 6 months ago

When ran the examples/plot_benchmark_braindecode.py, it came up with the error: RuntimeError: self must be a matrix.

Moabb Version: 1.0.0 Braindecode Version: 0.8

Detailed content as showed below:

Traceback (most recent call last):
  File "/home/dawin/my_projects/moabb/examples/plot_benchmark_braindecode.py", line 77, in <module>
    results = benchmark(
  File "/root/anaconda3/lib/python3.9/site-packages/moabb/benchmark.py", line 130, in benchmark
    pipeline_configs = parse_pipelines_from_directory(pipelines)
  File "/root/anaconda3/lib/python3.9/site-packages/moabb/pipelines/utils.py", line 131, in parse_pipelines_from_directory
    spec.loader.exec_module(foo)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "./pipelines_braindecode/braindecode_ShallowFBCSPNet.py", line 29, in <module>
    model = ShallowFBCSPNet(
  File "/root/anaconda3/lib/python3.9/site-packages/braindecode/models/shallow_fbcsp.py", line 182, in __init__
    self.final_conv_length = self.get_output_shape()[2]
  File "/root/anaconda3/lib/python3.9/site-packages/braindecode/models/base.py", line 218, in get_output_shape
    raise exc
  File "/root/anaconda3/lib/python3.9/site-packages/braindecode/models/base.py", line 199, in get_output_shape
    return tuple(self.forward(
  File "/root/anaconda3/lib/python3.9/site-packages/torch/nn/modules/container.py", line 215, in forward
    input = module(input)
  File "/root/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/root/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/root/anaconda3/lib/python3.9/site-packages/braindecode/models/modules.py", line 348, in forward
    self.conv_spat.weight.squeeze()
RuntimeError: self must be a matrix
bruAristimunha commented 5 months ago

Hey @dawin2015,

Thank you for discovering this issue. For now, I recommend downgrading the braindecode.

bruAristimunha commented 5 months ago

FYI. @PierreGtch and @sylvchev, it looks like the InputShapeSetterEEG from moabb is not enough to change the model dynamically with the new version of braindecode with the ch_info. Not fully sure of my initial analysis, could be something else.

bruAristimunha commented 5 months ago

Hey @dawin2015,

Can you check if, with the GitHub version and the new tutorial, the issue still exists?

dawin2015 commented 5 months ago

Thanks for @bruAristimunha 's soon reply and the issue is fixed.