





from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding



class 							_UpperCamelCase    (		lowerCAmelCase_   ):
       _UpperCamelCase :    List[str]   			=      ['''image_processor''', '''tokenizer''']
       _UpperCamelCase :    Optional[Any]   			=      '''EfficientNetImageProcessor'''
       _UpperCamelCase :    int   			=      ('''BertTokenizer''', '''BertTokenizerFast''')

       def __init__(						self:       Union[str, Any]    ,      _SCREAMING_SNAKE_CASE:       List[Any]    ,      _SCREAMING_SNAKE_CASE:       Dict						)				->       Any:




              """simple docstring"""


              super().__init__(_SCREAMING_SNAKE_CASE    ,      _SCREAMING_SNAKE_CASE						)

       def __call__(						self:       Any    ,      _SCREAMING_SNAKE_CASE:       List[Any]=None    ,      _SCREAMING_SNAKE_CASE:       int=None    ,      _SCREAMING_SNAKE_CASE:       Union[str, Any]="max_length"    ,      _SCREAMING_SNAKE_CASE:       List[Any]=64    ,      _SCREAMING_SNAKE_CASE:       Union[str, Any]=None    ,      **_SCREAMING_SNAKE_CASE:       Any						)				->       Union[str, Any]:




              """simple docstring"""


              if text is None and images is None:
                     raise ValueError("You have to specify either text or images. Both cannot be none."						)

              if text is not None:
                     UpperCamelCase_      				=     self.tokenizer(
                         _SCREAMING_SNAKE_CASE    ,      padding=_SCREAMING_SNAKE_CASE    ,      max_length=_SCREAMING_SNAKE_CASE    ,      return_tensors=_SCREAMING_SNAKE_CASE    ,      **_SCREAMING_SNAKE_CASE						)

              if images is not None:
                     UpperCamelCase_      				=     self.image_processor(_SCREAMING_SNAKE_CASE    ,      return_tensors=_SCREAMING_SNAKE_CASE    ,      **_SCREAMING_SNAKE_CASE						)

              if text is not None and images is not None:
                     UpperCamelCase_      				=     image_features.pixel_values
                     return encoding
              elif text is not None:
                     return encoding
              else:
                     return BatchEncoding(data=dict(**_SCREAMING_SNAKE_CASE						)    ,      tensor_type=_SCREAMING_SNAKE_CASE						)

       def lowercase       (						self:       Dict    ,      *_SCREAMING_SNAKE_CASE:       List[str]    ,      **_SCREAMING_SNAKE_CASE:       List[str]						)				->       Tuple:




              """simple docstring"""


              return self.tokenizer.batch_decode(*_SCREAMING_SNAKE_CASE    ,      **_SCREAMING_SNAKE_CASE						)

       def lowercase       (						self:       Dict    ,      *_SCREAMING_SNAKE_CASE:       Union[str, Any]    ,      **_SCREAMING_SNAKE_CASE:       Any						)				->       str:




              """simple docstring"""


              return self.tokenizer.decode(*_SCREAMING_SNAKE_CASE    ,      **_SCREAMING_SNAKE_CASE						)



       @property
       def lowercase       (						self:       str						)				->       Optional[int]:




              """simple docstring"""


              UpperCamelCase_      				=     self.tokenizer.model_input_names
              UpperCamelCase_      				=     self.image_processor.model_input_names
              return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names						)						)








from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_UpperCAmelCase				       = {
    'configuration_mpnet': ['MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MPNetConfig'],
    'tokenization_mpnet': ['MPNetTokenizer'],
}

try:
     if not is_tokenizers_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _UpperCAmelCase				       = ['MPNetTokenizerFast']

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _UpperCAmelCase				       = [
         'MPNET_PRETRAINED_MODEL_ARCHIVE_LIST',
         'MPNetForMaskedLM',
         'MPNetForMultipleChoice',
         'MPNetForQuestionAnswering',
         'MPNetForSequenceClassification',
         'MPNetForTokenClassification',
         'MPNetLayer',
         'MPNetModel',
         'MPNetPreTrainedModel',
     ]

try:
     if not is_tf_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _UpperCAmelCase				       = [
         'TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST',
         'TFMPNetEmbeddings',
         'TFMPNetForMaskedLM',
         'TFMPNetForMultipleChoice',
         'TFMPNetForQuestionAnswering',
         'TFMPNetForSequenceClassification',
         'TFMPNetForTokenClassification',
         'TFMPNetMainLayer',
         'TFMPNetModel',
         'TFMPNetPreTrainedModel',
     ]


if TYPE_CHECKING:
     from .configuration_mpnet import MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP, MPNetConfig
     from .tokenization_mpnet import MPNetTokenizer

     try:
          if not is_tokenizers_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_mpnet_fast import MPNetTokenizerFast

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_mpnet import (
              MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
              MPNetForMaskedLM,
              MPNetForMultipleChoice,
              MPNetForQuestionAnswering,
              MPNetForSequenceClassification,
              MPNetForTokenClassification,
              MPNetLayer,
              MPNetModel,
              MPNetPreTrainedModel,
          )

     try:
          if not is_tf_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_tf_mpnet import (
              TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
              TFMPNetEmbeddings,
              TFMPNetForMaskedLM,
              TFMPNetForMultipleChoice,
              TFMPNetForQuestionAnswering,
              TFMPNetForSequenceClassification,
              TFMPNetForTokenClassification,
              TFMPNetMainLayer,
              TFMPNetModel,
              TFMPNetPreTrainedModel,
          )

else:
     import sys

     _UpperCAmelCase				       = _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)

