Open oliver-batchelor opened 2 years ago
I don't see layer1
in regnetx_004
model. You can try printing the model after you create it to see the different layers and their names.
Yes you are right - I edited the report, initially I had resnet18 (which has layer1) and then realized resnet18 didn't trigger the problem, but forgot to update the layer name. Sorry! It should be "s1" for the regnetx model.
Btw. a simple way to fix the issue seems to be to change the if
statement to use torch._assert
- I am curious as to how it is decided to use if
rather than torch._assert
in these cases?
Is this specific to timm models? I see the same error as above when trying to list the node names.
from torchvision.models.feature_extraction import get_graph_node_names
model = timm.create_model('regnetx_004')
get_graph_node_names(model)
I am able to use regnet models from torchvision though:
from torchvision.models import create_feature_extractor, regnet_x_8gf
model = regnet_x_8gf()
extractor = feature_extraction.create_feature_extractor(model, ["trunk_output.block1"])
Yes you are right, I don't see any problem with the torchvision regnet_x either.
this happens if you, for example, try to analyze a hf "gpt2" model
🐛 Describe the bug
Using the new torch fx feature extractor has trouble with the standard module BatchNorm2d (and presumably others?). Edited as original report was not quite correct.
Code in question:
Versions
Collecting environment information... PyTorch version: 1.10.0 Is debug build: False CUDA used to build PyTorch: 11.3 ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.2 LTS (x86_64) GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Clang version: Could not collect CMake version: version 3.16.3 Libc version: glibc-2.31
Python version: 3.9.5 (default, Jun 4 2021, 12:28:51) [GCC 7.5.0] (64-bit runtime) Python platform: Linux-5.4.0-91-generic-x86_64-with-glibc2.31 Is CUDA available: True CUDA runtime version: 11.4.120 GPU models and configuration: GPU 0: NVIDIA GeForce RTX 2070 Nvidia driver version: 470.86 cuDNN version: Probably one of the following: /usr/lib/x86_64-linux-gnu/libcudnn.so.8.2.1 /usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.2.1 /usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.2.1 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.2.1 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.2.1 /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.2.1 /usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.2.1