
import collections.abc
from typing import Optional, Tuple, Union

import torch
import torch.utils.checkpoint
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import PreTrainedModel
from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
from .configuration_poolformer import PoolFormerConfig


lowerCamelCase  =logging.get_logger(__name__)

# General docstring
lowerCamelCase  ="PoolFormerConfig"

# Base docstring
lowerCamelCase  ="sail/poolformer_s12"
lowerCamelCase  =[1, 5_1_2, 7, 7]

# Image classification docstring
lowerCamelCase  ="sail/poolformer_s12"
lowerCamelCase  ="tabby, tabby cat"

lowerCamelCase  =[
    "sail/poolformer_s12",
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
]


def 				SCREAMING_SNAKE_CASE_   (      UpperCamelCase__			,		UpperCamelCase__ = 0.0			,		UpperCamelCase__ = False		):
      if drop_prob == 0.0 or not training:
            return input
      UpperCamelCase__     : str											=					1 - drop_prob
      UpperCamelCase__     : str											=					(input.shape[0],) + (1,) * (input.ndim - 1)  # work with diff dim tensors, not just 2D ConvNets
      UpperCamelCase__     : List[str]											=					keep_prob + torch.rand(UpperCamelCase__			,		dtype=input.dtype			,		device=input.device		)
      random_tensor.floor_()  # binarize
      UpperCamelCase__     : Dict											=					input.div(UpperCamelCase__		) * random_tensor
      return output




class 					_lowerCamelCase			(   nn.Module			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE = None	)	-> None:




           """simple docstring"""







           super().__init__()
           UpperCamelCase__     : Tuple											=					drop_prob






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> torch.Tensor:




           """simple docstring"""







           return drop_path(__SCREAMING_SNAKE_CASE    ,    self.drop_prob    ,    self.training	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> str:




           """simple docstring"""







           return "p={}".format(self.drop_prob	)




class 					_lowerCamelCase			(   nn.Module			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE=None	)	-> List[Any]:




           """simple docstring"""







           super().__init__()
           UpperCamelCase__     : Optional[int]											=					patch_size if isinstance(__SCREAMING_SNAKE_CASE    ,    collections.abc.Iterable	) else (patch_size, patch_size)
           UpperCamelCase__     : Optional[int]											=					stride if isinstance(__SCREAMING_SNAKE_CASE    ,    collections.abc.Iterable	) else (stride, stride)
           UpperCamelCase__     : List[Any]											=					padding if isinstance(__SCREAMING_SNAKE_CASE    ,    collections.abc.Iterable	) else (padding, padding)

           UpperCamelCase__     : int											=					nn.Convad(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    kernel_size=__SCREAMING_SNAKE_CASE    ,    stride=__SCREAMING_SNAKE_CASE    ,    padding=__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Dict											=					norm_layer(__SCREAMING_SNAKE_CASE	) if norm_layer else nn.Identity()






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> Any:




           """simple docstring"""







           UpperCamelCase__     : Optional[Any]											=					self.projection(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Dict											=					self.norm(__SCREAMING_SNAKE_CASE	)
           return embeddings




class 					_lowerCamelCase			(   nn.GroupNorm			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE    ,    **__SCREAMING_SNAKE_CASE	)	-> List[Any]:




           """simple docstring"""







           super().__init__(1    ,    __SCREAMING_SNAKE_CASE    ,    **__SCREAMING_SNAKE_CASE	)




class 					_lowerCamelCase			(   nn.Module			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE	)	-> Optional[int]:




           """simple docstring"""







           super().__init__()
           UpperCamelCase__     : Tuple											=					nn.AvgPoolad(__SCREAMING_SNAKE_CASE    ,    stride=1    ,    padding=pool_size // 2    ,    count_include_pad=__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> str:




           """simple docstring"""







           return self.pool(__SCREAMING_SNAKE_CASE	) - hidden_states




class 					_lowerCamelCase			(   nn.Module			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Tuple:




           """simple docstring"""







           super().__init__()
           UpperCamelCase__     : Optional[int]											=					nn.Convad(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    1	)
           UpperCamelCase__     : List[Any]											=					nn.Convad(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    1	)
           UpperCamelCase__     : Any											=					PoolFormerDropPath(__SCREAMING_SNAKE_CASE	)
           if isinstance(config.hidden_act    ,    __SCREAMING_SNAKE_CASE	):
                 UpperCamelCase__     : Union[str, Any]											=					ACTaFN[config.hidden_act]
           else:
                 UpperCamelCase__     : List[str]											=					config.hidden_act






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> List[Any]:




           """simple docstring"""







           UpperCamelCase__     : List[str]											=					self.conva(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : int											=					self.act_fn(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Tuple											=					self.drop(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : List[str]											=					self.conva(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : List[str]											=					self.drop(__SCREAMING_SNAKE_CASE	)

           return hidden_states




class 					_lowerCamelCase			(   nn.Module			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Any:




           """simple docstring"""







           super().__init__()
           UpperCamelCase__     : List[Any]											=					PoolFormerPooling(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Any											=					PoolFormerOutput(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : str											=					PoolFormerGroupNorm(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : str											=					PoolFormerGroupNorm(__SCREAMING_SNAKE_CASE	)

           # Useful for training neural nets
           UpperCamelCase__     : str											=					PoolFormerDropPath(__SCREAMING_SNAKE_CASE	) if drop_path > 0.0 else nn.Identity()
           UpperCamelCase__     : List[str]											=					config.use_layer_scale
           if config.use_layer_scale:
                 UpperCamelCase__     : str											=					nn.Parameter(
                     config.layer_scale_init_value * torch.ones((__SCREAMING_SNAKE_CASE)	)    ,    requires_grad=__SCREAMING_SNAKE_CASE	)
                 UpperCamelCase__     : Optional[int]											=					nn.Parameter(
                     config.layer_scale_init_value * torch.ones((__SCREAMING_SNAKE_CASE)	)    ,    requires_grad=__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> Optional[Any]:




           """simple docstring"""







           if self.use_layer_scale:
                 UpperCamelCase__     : List[str]											=					self.pooling(self.before_norm(__SCREAMING_SNAKE_CASE	)	)
                 UpperCamelCase__     : Tuple											=					self.layer_scale_a.unsqueeze(-1	).unsqueeze(-1	) * pooling_output
                 # First residual connection
                 UpperCamelCase__     : Union[str, Any]											=					hidden_states + self.drop_path(__SCREAMING_SNAKE_CASE	)
                 UpperCamelCase__     : Union[str, Any]											=					()

                 UpperCamelCase__     : List[str]											=					self.output(self.after_norm(__SCREAMING_SNAKE_CASE	)	)
                 UpperCamelCase__     : Dict											=					self.layer_scale_a.unsqueeze(-1	).unsqueeze(-1	) * layer_output
                 # Second residual connection
                 UpperCamelCase__     : Any											=					hidden_states + self.drop_path(__SCREAMING_SNAKE_CASE	)

                 UpperCamelCase__     : Dict											=					(output,) + outputs
                 return outputs

           else:
                 UpperCamelCase__     : Dict											=					self.drop_path(self.pooling(self.before_norm(__SCREAMING_SNAKE_CASE	)	)	)
                 # First residual connection
                 UpperCamelCase__     : int											=					pooling_output + hidden_states
                 UpperCamelCase__     : Any											=					()

                 # Second residual connection inside the PoolFormerOutput block
                 UpperCamelCase__     : Optional[int]											=					self.drop_path(self.output(self.after_norm(__SCREAMING_SNAKE_CASE	)	)	)
                 UpperCamelCase__     : List[Any]											=					hidden_states + layer_output

                 UpperCamelCase__     : Optional[int]											=					(output,) + outputs
                 return outputs




class 					_lowerCamelCase			(   nn.Module			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE	)	-> Optional[Any]:




           """simple docstring"""







           super().__init__()
           UpperCamelCase__     : List[Any]											=					config
           # stochastic depth decay rule
           UpperCamelCase__     : Any											=					[x.item() for x in torch.linspace(0    ,    config.drop_path_rate    ,    sum(config.depths	)	)]

           # patch embeddings
           UpperCamelCase__     : str											=					[]
           for i in range(config.num_encoder_blocks	):
                 embeddings.append(
                     PoolFormerEmbeddings(
                         patch_size=config.patch_sizes[i]    ,    stride=config.strides[i]    ,    padding=config.padding[i]    ,    num_channels=config.num_channels if i == 0 else config.hidden_sizes[i - 1]    ,    hidden_size=config.hidden_sizes[i]    ,    )	)
           UpperCamelCase__     : List[Any]											=					nn.ModuleList(__SCREAMING_SNAKE_CASE	)

           # Transformer blocks
           UpperCamelCase__     : Any											=					[]
           UpperCamelCase__     : List[Any]											=					0
           for i in range(config.num_encoder_blocks	):
                 # each block consists of layers
                 UpperCamelCase__     : List[str]											=					[]
                 if i != 0:
                       cur += config.depths[i - 1]
                 for j in range(config.depths[i]	):
                       layers.append(
                           PoolFormerLayer(
                               __SCREAMING_SNAKE_CASE    ,    num_channels=config.hidden_sizes[i]    ,    pool_size=config.pool_size    ,    hidden_size=config.hidden_sizes[i]    ,    intermediate_size=int(config.hidden_sizes[i] * config.mlp_ratio	)    ,    drop_path=dpr[cur + j]    ,    )	)
                 blocks.append(nn.ModuleList(__SCREAMING_SNAKE_CASE	)	)

           UpperCamelCase__     : List[str]											=					nn.ModuleList(__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE=False    ,    __SCREAMING_SNAKE_CASE=True	)	-> int:




           """simple docstring"""







           UpperCamelCase__     : Any											=					() if output_hidden_states else None

           UpperCamelCase__     : int											=					pixel_values
           for idx, layers in enumerate(zip(self.patch_embeddings    ,    self.block	)	):
                 UpperCamelCase__					,UpperCamelCase__     : Optional[int]											=					layers
                 # Get patch embeddings from hidden_states
                 UpperCamelCase__     : Any											=					embedding_layer(__SCREAMING_SNAKE_CASE	)
                 # Send the embeddings through the blocks
                 for _, blk in enumerate(__SCREAMING_SNAKE_CASE	):
                       UpperCamelCase__     : Dict											=					blk(__SCREAMING_SNAKE_CASE	)
                       UpperCamelCase__     : Optional[Any]											=					layer_outputs[0]

                 if output_hidden_states:
                       UpperCamelCase__     : Tuple											=					all_hidden_states + (hidden_states,)

           if not return_dict:
                 return tuple(v for v in [hidden_states, all_hidden_states] if v is not None	)

           return BaseModelOutputWithNoAttention(last_hidden_state=__SCREAMING_SNAKE_CASE    ,    hidden_states=__SCREAMING_SNAKE_CASE	)




class 					_lowerCamelCase			(   UpperCamelCase_			):





     """simple docstring"""







     SCREAMING_SNAKE_CASE_		 =	PoolFormerConfig
     SCREAMING_SNAKE_CASE_		 =	'''poolformer'''
     SCREAMING_SNAKE_CASE_		 =	'''pixel_values'''
     SCREAMING_SNAKE_CASE_		 =	True






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> int:




           """simple docstring"""







           if isinstance(__SCREAMING_SNAKE_CASE    ,    (nn.Linear, nn.Convad)	):
                 module.weight.data.normal_(mean=0.0    ,    std=self.config.initializer_range	)
                 if module.bias is not None:
                       module.bias.data.zero_()
           elif isinstance(__SCREAMING_SNAKE_CASE    ,    nn.LayerNorm	):
                 module.bias.data.zero_()
                 module.weight.data.fill_(1.0	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE=False	)	-> str:




           """simple docstring"""







           if isinstance(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	):
                 UpperCamelCase__     : Optional[int]											=					value
lowerCamelCase  =R"\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use\n    it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n    behavior.\n\n    Parameters:\n        config ([`PoolFormerConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.\n"

lowerCamelCase  =R"\n    Args:\n        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See\n            [`PoolFormerImageProcessor.__call__`] for details.\n"




@add_start_docstrings(
    '''The bare PoolFormer Model transformer outputting raw hidden-states without any specific head on top.'''						,				UpperCamelCase_						,				)
class 					_lowerCamelCase			(   UpperCamelCase_			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE	)	-> str:




           """simple docstring"""







           super().__init__(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : List[Any]											=					config

           UpperCamelCase__     : Dict											=					PoolFormerEncoder(__SCREAMING_SNAKE_CASE	)

           # Initialize weights and apply final processing
           self.post_init()






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Union[str, Any]:




           """simple docstring"""







           return self.embeddings.patch_embeddings






     @add_start_docstrings_to_model_forward(__SCREAMING_SNAKE_CASE	)
     @add_code_sample_docstrings(
         checkpoint=_CHECKPOINT_FOR_DOC    ,    output_type=__SCREAMING_SNAKE_CASE    ,    config_class=_CONFIG_FOR_DOC    ,    modality='''vision'''    ,    expected_output=_EXPECTED_OUTPUT_SHAPE    ,    )
     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE = None    ,    __SCREAMING_SNAKE_CASE = None    ,    __SCREAMING_SNAKE_CASE = None    ,    )	-> Union[Tuple, BaseModelOutputWithNoAttention]:




           """simple docstring"""







           UpperCamelCase__     : Any											=					(
               output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
           )
           UpperCamelCase__     : Optional[Any]											=					return_dict if return_dict is not None else self.config.use_return_dict

           if pixel_values is None:
                 raise ValueError('''You have to specify pixel_values'''	)

           UpperCamelCase__     : Union[str, Any]											=					self.encoder(
               __SCREAMING_SNAKE_CASE    ,    output_hidden_states=__SCREAMING_SNAKE_CASE    ,    return_dict=__SCREAMING_SNAKE_CASE    ,    )
           UpperCamelCase__     : int											=					encoder_outputs[0]

           if not return_dict:
                 return (sequence_output, None) + encoder_outputs[1:]

           return BaseModelOutputWithNoAttention(
               last_hidden_state=__SCREAMING_SNAKE_CASE    ,    hidden_states=encoder_outputs.hidden_states    ,    )




class 					_lowerCamelCase			(   nn.Module			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE	)	-> str:




           """simple docstring"""







           super().__init__()
           UpperCamelCase__     : str											=					nn.Linear(config.hidden_size    ,    config.hidden_size	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> List[str]:




           """simple docstring"""







           UpperCamelCase__     : Dict											=					self.dense(__SCREAMING_SNAKE_CASE	)
           return output




@add_start_docstrings(
    '''
    PoolFormer Model transformer with an image classification head on top
    '''						,				UpperCamelCase_						,				)
class 					_lowerCamelCase			(   UpperCamelCase_			):





     """simple docstring"""







     def __init__(				self    ,    __SCREAMING_SNAKE_CASE	)	-> int:




           """simple docstring"""







           super().__init__(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : List[str]											=					config.num_labels
           UpperCamelCase__     : Union[str, Any]											=					PoolFormerModel(__SCREAMING_SNAKE_CASE	)

           # Final norm
           UpperCamelCase__     : List[str]											=					PoolFormerGroupNorm(config.hidden_sizes[-1]	)
           # Classifier head
           UpperCamelCase__     : Any											=					(
               nn.Linear(config.hidden_sizes[-1]    ,    config.num_labels	) if config.num_labels > 0 else nn.Identity()
           )

           # Initialize weights and apply final processing
           self.post_init()






     @add_start_docstrings_to_model_forward(__SCREAMING_SNAKE_CASE	)
     @add_code_sample_docstrings(
         checkpoint=_IMAGE_CLASS_CHECKPOINT    ,    output_type=__SCREAMING_SNAKE_CASE    ,    config_class=_CONFIG_FOR_DOC    ,    expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT    ,    )
     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE = None    ,    __SCREAMING_SNAKE_CASE = None    ,    __SCREAMING_SNAKE_CASE = None    ,    __SCREAMING_SNAKE_CASE = None    ,    )	-> Union[Tuple, ImageClassifierOutputWithNoAttention]:




           """simple docstring"""







           UpperCamelCase__     : Optional[int]											=					return_dict if return_dict is not None else self.config.use_return_dict

           UpperCamelCase__     : List[Any]											=					self.poolformer(
               __SCREAMING_SNAKE_CASE    ,    output_hidden_states=__SCREAMING_SNAKE_CASE    ,    return_dict=__SCREAMING_SNAKE_CASE    ,    )

           UpperCamelCase__     : int											=					outputs[0]

           UpperCamelCase__     : Optional[int]											=					self.classifier(self.norm(__SCREAMING_SNAKE_CASE	).mean([-2, -1]	)	)

           UpperCamelCase__     : Dict											=					None
           if labels is not None:
                 if self.config.problem_type is None:
                       if self.num_labels == 1:
                             UpperCamelCase__     : Optional[Any]											=					'''regression'''
                       elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
                             UpperCamelCase__     : Dict											=					'''single_label_classification'''
                       else:
                             UpperCamelCase__     : str											=					'''multi_label_classification'''

                 if self.config.problem_type == "regression":
                       UpperCamelCase__     : Tuple											=					MSELoss()
                       if self.num_labels == 1:
                             UpperCamelCase__     : int											=					loss_fct(logits.squeeze()    ,    labels.squeeze()	)
                       else:
                             UpperCamelCase__     : str											=					loss_fct(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)
                 elif self.config.problem_type == "single_label_classification":
                       UpperCamelCase__     : Union[str, Any]											=					CrossEntropyLoss()
                       UpperCamelCase__     : List[str]											=					loss_fct(logits.view(-1    ,    self.num_labels	)    ,    labels.view(-1	)	)
                 elif self.config.problem_type == "multi_label_classification":
                       UpperCamelCase__     : Tuple											=					BCEWithLogitsLoss()
                       UpperCamelCase__     : Dict											=					loss_fct(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)

           if not return_dict:
                 UpperCamelCase__     : Any											=					(logits,) + outputs[2:]
                 return ((loss,) + output) if loss is not None else output

           return ImageClassifierOutputWithNoAttention(loss=__SCREAMING_SNAKE_CASE    ,    logits=__SCREAMING_SNAKE_CASE    ,    hidden_states=outputs.hidden_states	)




from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCamelCase  ={
    "configuration_luke": ["LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP", "LukeConfig"],
    "tokenization_luke": ["LukeTokenizer"],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase  =[
        "LUKE_PRETRAINED_MODEL_ARCHIVE_LIST",
        "LukeForEntityClassification",
        "LukeForEntityPairClassification",
        "LukeForEntitySpanClassification",
        "LukeForMultipleChoice",
        "LukeForQuestionAnswering",
        "LukeForSequenceClassification",
        "LukeForTokenClassification",
        "LukeForMaskedLM",
        "LukeModel",
        "LukePreTrainedModel",
    ]


if TYPE_CHECKING:
    from .configuration_luke import LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP, LukeConfig
    from .tokenization_luke import LukeTokenizer

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_luke import (
            LUKE_PRETRAINED_MODEL_ARCHIVE_LIST,
            LukeForEntityClassification,
            LukeForEntityPairClassification,
            LukeForEntitySpanClassification,
            LukeForMaskedLM,
            LukeForMultipleChoice,
            LukeForQuestionAnswering,
            LukeForSequenceClassification,
            LukeForTokenClassification,
            LukeModel,
            LukePreTrainedModel,
        )

else:
    import sys

    lowerCamelCase  =_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


