Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in graph definition in example 01_read_dataset.py #774

Open
giogiopg opened this issue Dec 9, 2024 · 0 comments
Open

Bug in graph definition in example 01_read_dataset.py #774

giogiopg opened this issue Dec 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@giogiopg
Copy link
Collaborator

giogiopg commented Dec 9, 2024

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

  1. Start your GraphNeT enviroment
  2. 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())
@giogiopg giogiopg added the bug Something isn't working label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant