Open
Description
Describe the bug
The example in examples/02_data/01_read_dataset.py.
is crashing due to a mismatch between the default features considered by KNNgraph and the input features given in the example.
To Reproduce
- Start your GraphNeT enviroment
- Run
python examples/02_data/01_read_dataset.py
Full traceback
The error message show is the following one
Traceback (most recent call last):
File "/lustre/ific.uv.es/ml/ific128/jprado/graphnet_jorge_dev/km3net-graphnet/examples/02_data/01_read_dataset.py", line 126, in <module>
main(args.backend)
File "/lustre/ific.uv.es/ml/ific128/jprado/graphnet_jorge_dev/km3net-graphnet/examples/02_data/01_read_dataset.py", line 80, in main
logger.info(str(dataset[1]))
~~~~~~~^^^
File "/lustre/ific.uv.es/ml/ific128/jprado/graphnet_jorge_dev/km3net-graphnet/src/graphnet/data/dataset/dataset.py", line 458, in __getitem__
graph = self._create_graph(features, truth, node_truth, loss_weight)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lustre/ific.uv.es/ml/ific128/jprado/graphnet_jorge_dev/km3net-graphnet/src/graphnet/data/dataset/dataset.py", line 647, in _create_graph
graph = self._graph_definition(
^^^^^^^^^^^^^^^^^^^^^^^
File "/lustre/ific.uv.es/ml/ific128/jprado/graphnet_jorge_dev/km3net-graphnet/cpu_venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lustre/ific.uv.es/ml/ific128/jprado/graphnet_jorge_dev/km3net-graphnet/cpu_venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lustre/ific.uv.es/ml/ific128/jprado/graphnet_jorge_dev/km3net-graphnet/src/graphnet/models/graphs/graph_definition.py", line 183, in forward
self._validate_input(
File "/lustre/ific.uv.es/ml/ific128/jprado/graphnet_jorge_dev/km3net-graphnet/src/graphnet/models/graphs/graph_definition.py", line 336, in _validate_input
assert len(input_feature_names) == len(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Input features (['dom_x', 'dom_y', 'dom_z', 'dom_time', 'charge', 'rde', 'pmt_area']) is not what
KNNGraph was instatiated
with (['dom_x', 'dom_y', 'dom_z', 'dom_time', 'charge', 'rde', 'pmt_area', 'hlc'])```
Additional context
In order to fix this error, it is just needed to instantiate the graph in the 01_read_dataset.py
script with:
graph_definition = KNNGraph(detector=IceCubeDeepCore(),
input_feature_names = ['dom_x', 'dom_y', 'dom_z', 'dom_time', 'charge', 'rde', 'pmt_area'])
instead of how it is currently instantiated with:
graph_definition = KNNGraph(detector=IceCubeDeepCore())