

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   lowercase_   (  lowerCAmelCase__					):
						UpperCamelCase_      :		int										=    ["image_processor", "tokenizer"]
						UpperCamelCase_      :		Optional[Any]										=    "ViltImageProcessor"
						UpperCamelCase_      :		int										=    ("BertTokenizer", "BertTokenizerFast")



						def __init__(      self				:    List[str]      , A__				:    Optional[int]=None      , A__				:    Optional[int]=None      , **A__				:    Dict		)   ->					Tuple:
								_snake_case						=							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__      , )
										_snake_case						=							kwargs.pop('''feature_extractor'''		)

								_snake_case						=							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__		)
								_snake_case						=							self.image_processor



						def __call__(      self				:    Union[str, Any]      , A__				:    str      , A__				:    int = None      , A__				:    Dict = True      , A__				:    Optional[Any] = False      , A__				:    Tuple = None      , A__				:    str = None      , A__				:    Tuple = 0      , A__				:    str = None      , A__				:    int = None      , A__				:    int = None      , A__				:    str = False      , A__				:    List[Any] = False      , A__				:    Optional[Any] = False      , A__				:    str = False      , A__				:    Any = True      , A__				:    str = None      , **A__				:    List[str]      , )   ->					int:
								_snake_case						=							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
								_snake_case						=							self.image_processor(a__      , return_tensors=a__		)
								encoding.update(a__		)

								return encoding



						def 						UpperCamelCase_		(      self				:    Optional[int]      , *A__				:    List[str]      , **A__				:    Union[str, Any]		)   ->					List[Any]:
								return self.tokenizer.batch_decode(*a__      , **a__		)



						def 						UpperCamelCase_		(      self				:    Optional[Any]      , *A__				:    List[Any]      , **A__				:    List[str]		)   ->					Dict:
								return self.tokenizer.decode(*a__      , **a__		)



						@property
						def 						UpperCamelCase_		(      self				:    List[Any]		)   ->					Optional[int]:
								_snake_case						=							self.tokenizer.model_input_names
								_snake_case						=							self.image_processor.model_input_names
								return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names		)		)



						@property
						def 						UpperCamelCase_		(      self				:    int		)   ->					int:
								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 						UpperCamelCase_		(      self				:    Any		)   ->					Optional[Any]:
								warnings.warn(
								    '''`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'''      , a__      , )
								return self.image_processor




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


__A      		=     {
    '''configuration_falcon''': ['''FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FalconConfig'''],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __A      		=     [
     '''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

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

