diff --git a/easycv/models/backbones/efficientformer.py b/easycv/models/backbones/efficientformer.py index f3f95098..73acbb6e 100644 --- a/easycv/models/backbones/efficientformer.py +++ b/easycv/models/backbones/efficientformer.py @@ -1,15 +1,21 @@ # Copyright (c) 2022 Snap Inc. All rights reserved. import itertools import os +from distutils.version import LooseVersion +import timm import torch import torch.nn as nn from timm.models.layers import DropPath, trunc_normal_ -from timm.models.layers.helpers import to_2tuple from ..modelzoo import efficientformer as model_urls from ..registry import BACKBONES +if LooseVersion(timm.__version__) <= LooseVersion('0.8.2'): + from timm.models.layers.helpers import to_2tuple +else: + from timm.layers.helpers import to_2tuple + class Attention(torch.nn.Module):