diff --git a/timm/models/beit.py b/timm/models/beit.py index 3ba67031..99b5c832 100644 --- a/timm/models/beit.py +++ b/timm/models/beit.py @@ -40,7 +40,7 @@ Modifications by / Copyright 2021 Ross Wightman, original copyrights below import math from functools import partial -from typing import Callable, Optional, Tuple, Union +from typing import Callable, Final, Optional, Tuple, Union import torch import torch.nn as nn @@ -80,6 +80,8 @@ def gen_relative_position_index(window_size: Tuple[int, int]) -> torch.Tensor: class Attention(nn.Module): + fast_attn: Final[bool] + def __init__( self, dim: int, diff --git a/timm/models/eva.py b/timm/models/eva.py index 2daa04c0..92e5c7ad 100644 --- a/timm/models/eva.py +++ b/timm/models/eva.py @@ -26,7 +26,7 @@ Modifications by / Copyright 2023 Ross Wightman, original copyrights below # EVA02 models Copyright (c) 2023 BAAI-Vision import math -from typing import Callable, Optional, Tuple, Union +from typing import Callable, Final, Optional, Tuple, Union import torch import torch.nn as nn @@ -44,6 +44,8 @@ __all__ = ['Eva'] class EvaAttention(nn.Module): + fast_attn: Final[bool] + def __init__( self, dim: int,