





"""simple docstring"""



from typing import List, Optional, Union

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






class 		__snake_case (		__snake_case					):





 """simple docstring"""


 _lowerCamelCase				=					['image_processor', 'tokenizer']
 _lowerCamelCase				=					'BlipImageProcessor'
 _lowerCamelCase				=					('BertTokenizer', 'BertTokenizerFast')

 def __init__(   self ,						__lowerCamelCase ,						__lowerCamelCase  ):



     '''simple docstring'''




     __A   :						Tuple									=					False
     super().__init__(__lowerCamelCase ,						__lowerCamelCase  )
     __A   :						str									=					self.image_processor

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



     '''simple docstring'''




     if images is None and text is None:
         raise ValueError('''You have to specify either images or text.'''  )

     # Get only text
     if images is None:
         __A   :						Tuple									=					self.tokenizer
         __A   :						List[str]									=					self.tokenizer(
             text=__lowerCamelCase ,						add_special_tokens=__lowerCamelCase ,						padding=__lowerCamelCase ,						truncation=__lowerCamelCase ,						max_length=__lowerCamelCase ,						stride=__lowerCamelCase ,						pad_to_multiple_of=__lowerCamelCase ,						return_attention_mask=__lowerCamelCase ,						return_overflowing_tokens=__lowerCamelCase ,						return_special_tokens_mask=__lowerCamelCase ,						return_offsets_mapping=__lowerCamelCase ,						return_token_type_ids=__lowerCamelCase ,						return_length=__lowerCamelCase ,						verbose=__lowerCamelCase ,						return_tensors=__lowerCamelCase ,						**__lowerCamelCase ,						)
         return text_encoding

     # add pixel_values
     __A   :						List[Any]									=					self.image_processor(__lowerCamelCase ,						return_tensors=__lowerCamelCase  )

     if text is not None:
         __A   :						int									=					self.tokenizer(
             text=__lowerCamelCase ,						add_special_tokens=__lowerCamelCase ,						padding=__lowerCamelCase ,						truncation=__lowerCamelCase ,						max_length=__lowerCamelCase ,						stride=__lowerCamelCase ,						pad_to_multiple_of=__lowerCamelCase ,						return_attention_mask=__lowerCamelCase ,						return_overflowing_tokens=__lowerCamelCase ,						return_special_tokens_mask=__lowerCamelCase ,						return_offsets_mapping=__lowerCamelCase ,						return_token_type_ids=__lowerCamelCase ,						return_length=__lowerCamelCase ,						verbose=__lowerCamelCase ,						return_tensors=__lowerCamelCase ,						**__lowerCamelCase ,						)
     else:
         __A   :						Tuple									=					None

     if text_encoding is not None:
         encoding_image_processor.update(__lowerCamelCase  )

     return encoding_image_processor

 def  UpperCamelCase__(   self ,						*__lowerCamelCase ,						**__lowerCamelCase  ):



     '''simple docstring'''




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

 def  UpperCamelCase__(   self ,						*__lowerCamelCase ,						**__lowerCamelCase  ):



     '''simple docstring'''




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







 @property
 def  UpperCamelCase__(   self  ):



     '''simple docstring'''




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










"""simple docstring"""



# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


a_			=      {
    """configuration_vivit""": ["""VIVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VivitConfig"""],
}
try:
       if not is_vision_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a_			=      ["""VivitImageProcessor"""]


try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a_			=      [
           """VIVIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """VivitModel""",
           """VivitPreTrainedModel""",
           """VivitForVideoClassification""",
       ]


if TYPE_CHECKING:
       from .configuration_vivit import VIVIT_PRETRAINED_CONFIG_ARCHIVE_MAP, VivitConfig

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .image_processing_vivit import VivitImageProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_vivit import (
                  VIVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  VivitForVideoClassification,
                  VivitModel,
                  VivitPreTrainedModel,
              )


else:
       import sys

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




