nnUNet
nnUNet copied to clipboard
network_architecture not available
Hi! I have trained my networks before, but I would like to see the network architecture. Thus, I installed hiddenlayer and ipython and graphviz. When I restart the training of a fold, a file network_architecture is created. However, it is not a pdf but just a 'file'. How do I get a figure of the architecture?
Hey it could be that there is still some error message. Check the stdout of your script for any error messages (we just skip ahead if exporting the pdf does not work for some reason as this is a non-critical component of nnU-Net)
Hi! I was facing the same issue, where the generated network architecture file was not a pdf. I fixed it by replacing _optimize_trace with _optimize_graph inside pytorch_builder.py [Line 71] file inside the installed hiddenlayer package. Followed the answer in this thread: https://stackoverflow.com/questions/74394812/cannot-plot-model-graph-with-pytorch-hiddenlayer-module-torch-onnx-has-no-at.
@FabianIsensee should we add this fix to nnUNet permanently?
If you are willing to do a PR about this then I can merge it :+1:
Hi @hep-raidium,
Do you know which torch version you are using? Also do you have torchvision installed?
Hi,
I had the same issue and dealt with it with what @Mohinta2892 offered. Unfortunately, it triggers a new error for creating the network architecture :
'torch._C.Node' object is not subscriptable
Do you know what I can do ?
Hey,
found the solution. After doing what @Mohinta2892 suggested I then solved the 'torch._C.Node' error with replacing the line "params = ..... " (line n° 85 approximately in PyTorch_builder.py) by : "params = {k: getattr(torch_node, torch_node.kindOf(k))(k) for k in torch_node.attributeNames()}" (cf https://github.com/tianyic/only_train_once/issues/6 ) and it worked :) I was using '2.0.0+cu117' torch version :) Best,
I had the same problem and followed the solutions mentioned above, but since the server didn't have Graphviz installed, it returned the following error message
2023-04-07 16:59:58.575276: Unable to plot network architecture:
2023-04-07 16:59:58.611060: failed to execute PosixPath('dot'), make sure the Graphviz executables are on your systems' PATH
However, in the nnunet_results folder "/results/Dataset032_BraTS2018/nnUNetTrainer__nnUNetPlans__3d_fullres/fold_0/network_architecture", there was a "network_architecture" file (probably a Dot file) saved with no extension (I don't know which line of code saved this). Therefore, I was able to visualize the network architecture, in the end, using my local computer.
It would be useful if nnunetv2 could save the network architecture Dot file even though hiddenlayer no longer works.
PR is merged - it should work now
@LouisDo2108 I had the same issue and was able to resolve it by running 'conda install python-graphviz'.
@LouisDo2108 I had the same issue and was able to resolve it by running 'conda install python-graphviz'.
That's helpful, thanks!