BNN-UPC / RouteNet-Fermi

Apache License 2.0
21 stars 4 forks source link

TypeError: 'NoneType' object is not subscriptable #5

Closed ChuvashaevaAlena closed 8 months ago

ChuvashaevaAlena commented 8 months ago

Hello Dear developers! I really like your project and I would like to implement it also. I am new in GNN and would like to learn. I was able to create datasets. But when I am running file main.py I have this error. I have checked my datasets. They have values. Also read_dataset.py produce them. I am trying to understand why model receiving NoneType. Could you guide me please where I am making mistake? Thank you in advance! TypeError: 'NoneType' object is not subscriptable Call arguments received by layer 'route_net_model' (type RouteNetModel): • inputs={'traffic': 'tf.Tensor(shape=(None,), dtype=float32)', 'packets': 'tf.Tensor(shape=(None,), dtype=float32)', 'capacity': 'tf.Tensor(shape=(None,), dtype=float32)', 'link_to_path': ' and so on.

MiquelFerriol commented 8 months ago

Dear @ChuvashaevaAlena , Thanks for your interest in our research and for posting here an issue.

This problem may be caused by several reasons. Just so we can help you, which version of Python and Tensorflow are you using? Do you face the same problem when using the provided public datasets?

Bests, Miquel

ChuvashaevaAlena commented 8 months ago

Dear @MiquelFerriol, Thanks for replying. I am using Python version 3.11 and tensorflow 2.13.0. I have tried the dataset, which I have created, and also tried the public ones from the different GitHub sources. When I apply a function to access data in a dataset I can see the output: ({'traffic': <tf.Tensor: shape=(30,), dtype=float32, numpy= array([283.696, 349.71 , 662.785, 968.66 , 145.932, 856.894, 400.746, 331.265, 276.196, 241.366, 356.865, 398.966, 812.34 , 396.992, 22.186, 431.314, 880.467, 189.669, 321.083, 298.666, 487.126, 641.932, 295.597, 150.916, 922.97 , 214.42 , 913.6 , 106.957, 163.085, 807.507], dtype=float32)>, 'packets': <tf.Tensor: shape=(30,), dtype=float32, numpy= array([0.366441, 0.447425, 0.848902, 1.24209 , 0.145846, 0.857928, 0.400574, 0.333046, 0.350153, 0.309538, 0.355774, 0.402297, 0.810502, 0.396102, 0.02843 , 0.432205, 0.880984, 0.190358, 0.324184, 0.301538, 0.485374, 0.642994, 0.378666, 0.195364, 1.18113 , 0.273723, 0.906994, 0.105148, 0.208123, 0.812964], dtype=float32)>, 'capacity': <tf.Tensor: shape=(16,), dtype=float32, numpy= array([100000., 100000., 100000., 100000., 100000., 100000., 100000., 100000., 100000., 100000., 100000., 100000., 100000., 100000., 100000., 100000.], dtype=float32)>, and so on. It means that the dataset has data, but when I am fitting the model it gives me the error mentioned above. I can't understand what the issue here. And struggling just to fit the model. I have tried different once, but the error is the same. And one more question, please. If I understand correctly the dataset, created by the function "input_fn" should be given as output tf.data.dataset structure such as: inputs (for NN as an input parameter) and delay (as an output parameter and as a ground truth) is that correct? Hope for your answer.

MiquelFerriol commented 8 months ago

That is weird. I know there are some issues with TF versions greater than 2.7 and tf.dataset. Can you try with this 2.7 version of TF and see if it is a compatibility issue? We are aware of some other dimensionality problems that TF creates "artificially" with 2.7+ versions, but this is for sure a new one.

And one more question, please. If I understand correctly the dataset, created by the function "input_fn" should be given as output tf.data.dataset structure such as: inputs (for NN as an input parameter) and delay (as an output parameter and as a ground truth) is that correct?

Yes, that is correct.

ChuvashaevaAlena commented 8 months ago

I have downgraded the version of TF to 2.7, and now it's working. Thank you so much for your help. Appreciate it! Now I can actually explore the model and its possibilities! Cheers!

MiquelFerriol commented 8 months ago

Nice! Thank you for pointing this out.

I will try to investigate the issue and try to release a TF-updated version.

Cheers!

(Closing since the issue is solved)