



import warnings
from typing import List, Optional, Union

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType



class   UpperCAmelCase_    (       a):
							lowerCamelCase__   			=		['image_processor', 'tokenizer']
							lowerCamelCase__   			=		'ViltImageProcessor'
							lowerCamelCase__   			=		('BertTokenizer', 'BertTokenizerFast')







							def __init__(   self,			__a=None,			__a=None,			**__a):

														'''simple docstring'''

														_lowerCAmelCase     :							int    =    None
														if "feature_extractor" in kwargs:
																					warnings.warn(
																					    "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
																					    " instead.",			__a,			)
																					_lowerCAmelCase     :							int    =    kwargs.pop("feature_extractor")

														_lowerCAmelCase     :							str    =    image_processor if image_processor is not None else feature_extractor
														if image_processor is None:
																					raise ValueError("You need to specify an `image_processor`.")
														if tokenizer is None:
																					raise ValueError("You need to specify a `tokenizer`.")

														super().__init__(__a,			__a)
														_lowerCAmelCase     :							int    =    self.image_processor







							def __call__(   self,			__a,			__a = None,			__a = True,			__a = False,			__a = None,			__a = None,			__a = 0,			__a = None,			__a = None,			__a = None,			__a = False,			__a = False,			__a = False,			__a = False,			__a = True,			__a = None,			**__a,			):

														'''simple docstring'''

														_lowerCAmelCase     :							Dict    =    self.tokenizer(
														    text=__a,			add_special_tokens=__a,			padding=__a,			truncation=__a,			max_length=__a,			stride=__a,			pad_to_multiple_of=__a,			return_token_type_ids=__a,			return_attention_mask=__a,			return_overflowing_tokens=__a,			return_special_tokens_mask=__a,			return_offsets_mapping=__a,			return_length=__a,			verbose=__a,			return_tensors=__a,			**__a,			)
														# add pixel_values + pixel_mask
														_lowerCAmelCase     :							List[Any]    =    self.image_processor(__a,			return_tensors=__a)
														encoding.update(__a)

														return encoding







							def    snake_case__      (   self,			*__a,			**__a):

														'''simple docstring'''

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







							def    snake_case__      (   self,			*__a,			**__a):

														'''simple docstring'''

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







							@property
							def    snake_case__      (   self):

														'''simple docstring'''

														_lowerCAmelCase     :							Dict    =    self.tokenizer.model_input_names
														_lowerCAmelCase     :							int    =    self.image_processor.model_input_names
														return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names))







							@property
							def    snake_case__      (   self):

														'''simple docstring'''

														warnings.warn(
														    "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.",			__a,			)
														return self.image_processor_class







							@property
							def    snake_case__      (   self):

														'''simple docstring'''

														warnings.warn(
														    "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.",			__a,			)
														return self.image_processor

'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


__a: Dict          =   {
    """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""],
    """tokenization_ctrl""": ["""CTRLTokenizer"""],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __a: int          =   [
      """CTRL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """CTRLForSequenceClassification""",
      """CTRLLMHeadModel""",
      """CTRLModel""",
      """CTRLPreTrainedModel""",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __a: int          =   [
      """TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TFCTRLForSequenceClassification""",
      """TFCTRLLMHeadModel""",
      """TFCTRLModel""",
      """TFCTRLPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_ctrl import CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRLConfig
  from .tokenization_ctrl import CTRLTokenizer

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_ctrl import (
        CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
        CTRLForSequenceClassification,
        CTRLLMHeadModel,
        CTRLModel,
        CTRLPreTrainedModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_ctrl import (
        TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFCTRLForSequenceClassification,
        TFCTRLLMHeadModel,
        TFCTRLModel,
        TFCTRLPreTrainedModel,
    )

else:
  import sys

  __a: Dict          =   _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)

