






"""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						(						UpperCAmelCase ):
    __magic_name__					  =  ['''image_processor''', '''tokenizer''']
    __magic_name__					  =  '''BlipImageProcessor'''
    __magic_name__					  =  '''AutoTokenizer'''





    def __init__(							self			:      int       ,	A			:      str       ,	A			:      Union[str, Any]    ):


      '''simple docstring'''




      a  :    str       =     False
      super().__init__(A       ,	A    )
      a  :    List[Any]       =     self.image_processor





    def __call__(							self			:      Dict       ,	A			:      ImageInput = None       ,	A			:      Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None       ,	A			:      bool = True       ,	A			:      Union[bool, str, PaddingStrategy] = False       ,	A			:      Union[bool, str, TruncationStrategy] = None       ,	A			:      Optional[int] = None       ,	A			:      int = 0       ,	A			:      Optional[int] = None       ,	A			:      Optional[bool] = None       ,	A			:      bool = False       ,	A			:      bool = False       ,	A			:      bool = False       ,	A			:      bool = False       ,	A			:      bool = False       ,	A			:      bool = True       ,	A			:      Optional[Union[str, TensorType]] = None       ,	**A			:      str       ,	):


      '''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=A       ,	add_special_tokens=A       ,	padding=A       ,	truncation=A       ,	max_length=A       ,	stride=A       ,	pad_to_multiple_of=A       ,	return_attention_mask=A       ,	return_overflowing_tokens=A       ,	return_special_tokens_mask=A       ,	return_offsets_mapping=A       ,	return_token_type_ids=A       ,	return_length=A       ,	verbose=A       ,	return_tensors=A       ,	**A       ,	)
        return text_encoding

      # add pixel_values
      a  :    Tuple       =     self.image_processor(A       ,	return_tensors=A    )

      if text is not None:
        a  :    Any       =     self.tokenizer(
            text=A       ,	add_special_tokens=A       ,	padding=A       ,	truncation=A       ,	max_length=A       ,	stride=A       ,	pad_to_multiple_of=A       ,	return_attention_mask=A       ,	return_overflowing_tokens=A       ,	return_special_tokens_mask=A       ,	return_offsets_mapping=A       ,	return_token_type_ids=A       ,	return_length=A       ,	verbose=A       ,	return_tensors=A       ,	**A       ,	)
      else:
        a  :    str       =     None

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

      return encoding_image_processor





    def        lowerCamelCase__   (							self			:      List[str]       ,	*A			:      Union[str, Any]       ,	**A			:      Optional[Any]    ):


      '''simple docstring'''




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





    def        lowerCamelCase__   (							self			:      str       ,	*A			:      Optional[int]       ,	**A			:      List[str]    ):


      '''simple docstring'''




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





    @property
    # Copied from transformers.models.blip.processing_blip.BlipProcessor.model_input_names
    def        lowerCamelCase__   (							self			:      Optional[int]    ):


      '''simple docstring'''




      a  :    Optional[int]       =     self.tokenizer.model_input_names
      a  :    Optional[Any]       =     self.image_processor.model_input_names
      return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names    )    )












"""simple docstring"""


from .glue import GlueDataset, GlueDataTrainingArguments
from .language_modeling import (
    LineByLineTextDataset,
    LineByLineWithRefDataset,
    LineByLineWithSOPTextDataset,
    TextDataset,
    TextDatasetForNextSentencePrediction,
)
from .squad import SquadDataset, SquadDataTrainingArguments




