huggingface / pytorch-image-models

The largest collection of PyTorch image encoders / backbones. Including train, eval, inference, export scripts, and pretrained weights -- ResNet, ResNeXT, EfficientNet, NFNet, Vision Transformer (ViT), MobileNetV4, MobileNet-V3 & V2, RegNet, DPN, CSPNet, Swin Transformer, MaxViT, CoAtNet, ConvNeXt, and more
https://huggingface.co/docs/timm
Apache License 2.0
32.2k stars 4.75k forks source link

[BUG] Loading Tresnet error #710

Closed XiaoyuWant closed 3 years ago

XiaoyuWant commented 3 years ago

Describe the bug Loading Tresnet models error

Traceback (most recent call last):
  File "ResnetTrain.py", line 55, in <module>
    resnet50 = timm.create_model('tresnet_l', pretrained=True, num_classes=85)
  File "/root/anaconda3/envs/universal/lib/python3.8/site-packages/timm/models/factory.py", line 81, in create_model
    model = create_fn(pretrained=pretrained, **kwargs)
  File "/root/anaconda3/envs/universal/lib/python3.8/site-packages/timm/models/tresnet.py", line 273, in tresnet_l
    return _create_tresnet('tresnet_l', pretrained=pretrained, **model_kwargs)
  File "/root/anaconda3/envs/universal/lib/python3.8/site-packages/timm/models/tresnet.py", line 251, in _create_tresnet
    return build_model_with_cfg(
  File "/root/anaconda3/envs/universal/lib/python3.8/site-packages/timm/models/helpers.py", line 434, in build_model_with_cfg
    model = model_cls(**kwargs) if model_cfg is None else model_cls(cfg=model_cfg, **kwargs)
  File "/root/anaconda3/envs/universal/lib/python3.8/site-packages/timm/models/tresnet.py", line 169, in __init__
    layer2 = self._make_layer(
  File "/root/anaconda3/envs/universal/lib/python3.8/site-packages/timm/models/tresnet.py", line 226, in _make_layer
    layers.append(block(
  File "/root/anaconda3/envs/universal/lib/python3.8/site-packages/timm/models/tresnet.py", line 81, in __init__
    aa_layer(channels=planes, filt_size=3, stride=2))
  File "/root/anaconda3/envs/universal/lib/python3.8/site-packages/timm/models/layers/blur_pool.py", line 38, in __init__
    self.register_buffer('filt', blur_filter, persistent=False)
TypeError: register_buffer() got an unexpected keyword argument 'persistent'

To Reproduce Steps to reproduce the behavior:

  1. pip install timm
  2. mdoel = timm.create_model('tresnet_l', pretrained=True, num_classes=85)
rwightman commented 3 years ago

Update your pytorch version, I'm no longer trying to maintain compat below 1.7 though most things should work