Skip to content

[BUG] nn.Hardswish does not exist in pytorch 1.5 #661

@ShoufaChen

Description

@ShoufaChen

Describe the bug
07d952c implemented the levit, which uses nn.Hardswish.

However, nn.Hardswish does not exist in pytorch1.5.

    from .models import create_model, list_models, is_model, list_modules, model_entrypoint, \
  File "/mnt/lustre/chenshoufa/workspace/deit_timm/timm/models/__init__.py", line 19, in <module>
    from .models import create_model, list_models, is_model, list_modules, model_entrypoint, \
  File "/mnt/lustre/chenshoufa/workspace/deit_timm/timm/models/__init__.py", line 19, in <module>
    from .levit import *
  File "/mnt/lustre/chenshoufa/workspace/deit_timm/timm/models/levit.py", line 428, in <module>
    from .levit import *
  File "/mnt/lustre/chenshoufa/workspace/deit_timm/timm/models/levit.py", line 428, in <module>
    class Levit(nn.Module):
  File "/mnt/lustre/chenshoufa/workspace/deit_timm/timm/models/levit.py", line 446, in Levit
    class Levit(nn.Module):
  File "/mnt/lustre/chenshoufa/workspace/deit_timm/timm/models/levit.py", line 446, in Levit
    act_layer=nn.Hardswish,
AttributeError: module 'torch.nn' has no attribute 'Hardswish'

Currently I just removed levit import because I do not need it.
I wonder if there is an elegant way to hack this bug.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions