CSAILVision / CSAILVision/NetDissect-Lite
Torch source change: repo incompatible with versions 0.5.0 and 1.0.0
- Dominant language
- Python
- Stars
- 221
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
It seems the repo is suffering from changes in Torch source code, more specifically in the use of the BatchNorm2d object put possibly on more places.
The repo works fine for the resnet18 model, but downloading and using the pretrained models for resnet50 and densenet161 yields errors:
`AttributeError: 'BatchNorm2d' object has no attribute 'track_running_stats'`
There are also a set of SourceChangeWarnings, among other:
```
/jet/var/python/lib/python3.6/site-packages/torch/serialization.py:425: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm2d' has changed.
you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the chang
es.
```
Tried running both Pytorch versions 0.5.0 and 1.0.0. [This thread](https://discuss.pytorch.org/t/batchnorm2d-object-has-no-attribute-track-running-stats/17525) suggests downgrading Pytorch to 0.3 would make it work, will update if I get the possibility to do so.
#### Error Log
```
Traceback (most recent call last):
File "main.py", line 11, in
features, maxfeature = fo.feature_extraction(model=model)
File "/jet/prs/NetDissect-Lite/feature_operation.py", line 67, in feature_extraction
logit = model.forward(input_var)
File "/jet/var/python/lib/python3.6/site-packages/torchvision/models/densenet.py", line 157, in forward
features = self.features(x)
File "/jet/var/python/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/jet/var/python/lib/python3.6/site-packages/torch/nn/modules/container.py", line 91, in forward
input = module(input)
File "/jet/var/python/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/jet/var/python/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py", line 65, in forward
self.training or not self.track_running_stats,
File "/jet/var/python/lib/python3.6/site-packages/torch/nn/modules/module.py", line 518, in __getattr__
type(self).__name__, name))
AttributeError: 'BatchNorm2d' object has no attribute 'track_running_stats'
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.