



'''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  SCREAMING_SNAKE_CASE (  _a		):






    """simple docstring"""





    _SCREAMING_SNAKE_CASE	  =  ["""image_processor""", """tokenizer"""]
    _SCREAMING_SNAKE_CASE	  =  """BlipImageProcessor"""
    _SCREAMING_SNAKE_CASE	  =  ("""BertTokenizer""", """BertTokenizerFast""")






    def __init__(  self      :					Optional[int]  ,						UpperCamelCase__      :					Tuple  ,						UpperCamelCase__      :					Union[str, Any] ):


       """simple docstring"""







       UpperCamelCase					=  False
       super().__init__(UpperCamelCase__  ,						UpperCamelCase__ )
       UpperCamelCase					=  self.image_processor






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


       """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:
          UpperCamelCase					=  self.tokenizer
          UpperCamelCase					=  self.tokenizer(
              text=UpperCamelCase__  ,						add_special_tokens=UpperCamelCase__  ,						padding=UpperCamelCase__  ,						truncation=UpperCamelCase__  ,						max_length=UpperCamelCase__  ,						stride=UpperCamelCase__  ,						pad_to_multiple_of=UpperCamelCase__  ,						return_attention_mask=UpperCamelCase__  ,						return_overflowing_tokens=UpperCamelCase__  ,						return_special_tokens_mask=UpperCamelCase__  ,						return_offsets_mapping=UpperCamelCase__  ,						return_token_type_ids=UpperCamelCase__  ,						return_length=UpperCamelCase__  ,						verbose=UpperCamelCase__  ,						return_tensors=UpperCamelCase__  ,						**UpperCamelCase__  ,						)
          return text_encoding

       # add pixel_values
       UpperCamelCase					=  self.image_processor(UpperCamelCase__  ,						return_tensors=UpperCamelCase__ )

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

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

       return encoding_image_processor






    def  A       (  self      :					Tuple  ,						*UpperCamelCase__      :					Tuple  ,						**UpperCamelCase__      :					Any ):


       """simple docstring"""







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






    def  A       (  self      :					Union[str, Any]  ,						*UpperCamelCase__      :					Tuple  ,						**UpperCamelCase__      :					Dict ):


       """simple docstring"""







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






    @property
    def  A       (  self      :					str ):


       """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_torch_available,
)


UpperCAmelCase						:   Any			  =     {
    '''configuration_falcon''': ['''FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FalconConfig'''],
}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				UpperCAmelCase						:   Any			  =     [
				    '''FALCON_PRETRAINED_MODEL_ARCHIVE_LIST''',
				    '''FalconForCausalLM''',
				    '''FalconModel''',
				    '''FalconPreTrainedModel''',
				    '''FalconForSequenceClassification''',
				    '''FalconForTokenClassification''',
				    '''FalconForQuestionAnswering''',
				]


if TYPE_CHECKING:
				from .configuration_falcon import FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP, FalconConfig

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_falcon import (
								    FALCON_PRETRAINED_MODEL_ARCHIVE_LIST,
								    FalconForCausalLM,
								    FalconForQuestionAnswering,
								    FalconForSequenceClassification,
								    FalconForTokenClassification,
								    FalconModel,
								    FalconPreTrainedModel,
								)


else:
				import sys

				UpperCAmelCase						:   List[str]			  =     _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




