


from ...configuration_utils import PretrainedConfig
from ...utils import logging


__a	 =      logging.get_logger(__name__)

__a	 =      {
    """tiiuae/falcon-40b""": """https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json""",
    """tiiuae/falcon-7b""": """https://huggingface.co/tiiuae/falcon-7b/resolve/main/config.json""",
}






class 	__lowercase					(	__snake_case	):
      UpperCamelCase										=							'''falcon'''
      UpperCamelCase										=							['''past_key_values''']





      def __init__(		self    :       Tuple       ,							__lowerCamelCase    :       int=6_5_0_2_4       ,							__lowerCamelCase    :       Dict=4_5_4_4       ,							__lowerCamelCase    :       Any=3_2       ,							__lowerCamelCase    :       Dict=7_1       ,							__lowerCamelCase    :       Dict=1e-5       ,							__lowerCamelCase    :       Union[str, Any]=0.02       ,							__lowerCamelCase    :       Optional[int]=True       ,							__lowerCamelCase    :       Optional[Any]=0.0       ,							__lowerCamelCase    :       str=0.0       ,							__lowerCamelCase    :       List[str]=None       ,							__lowerCamelCase    :       str=False       ,							__lowerCamelCase    :       Tuple=False       ,							__lowerCamelCase    :       Optional[Any]=True       ,							__lowerCamelCase    :       Any=True       ,							__lowerCamelCase    :       Optional[int]=False       ,							__lowerCamelCase    :       Optional[Any]=1_1       ,							__lowerCamelCase    :       Dict=1_1       ,							**__lowerCamelCase    :       Union[str, Any]       ,							)     -> int:






         """simple docstring"""







         UpperCAmelCase      					=  vocab_size
         # Backward compatibility with n_embed kwarg
         UpperCAmelCase      					=  kwargs.pop("""n_embed"""       ,							__lowerCamelCase							)
         UpperCAmelCase      					=  hidden_size if n_embed is None else n_embed
         UpperCAmelCase      					=  num_hidden_layers
         UpperCAmelCase      					=  num_attention_heads
         UpperCAmelCase      					=  layer_norm_epsilon
         UpperCAmelCase      					=  initializer_range
         UpperCAmelCase      					=  use_cache
         UpperCAmelCase      					=  hidden_dropout
         UpperCAmelCase      					=  attention_dropout

         UpperCAmelCase      					=  bos_token_id
         UpperCAmelCase      					=  eos_token_id
         UpperCAmelCase      					=  num_attention_heads if num_kv_heads is None else num_kv_heads
         UpperCAmelCase      					=  alibi
         UpperCAmelCase      					=  new_decoder_architecture
         UpperCAmelCase      					=  multi_query  # Ignored when new_decoder_architecture is True
         UpperCAmelCase      					=  parallel_attn
         UpperCAmelCase      					=  bias

         super().__init__(bos_token_id=__lowerCamelCase       ,							eos_token_id=__lowerCamelCase       ,							**__lowerCamelCase							)





      @property
      def 							_lowercase					(		self    :       int							)     -> Union[str, Any]:






         """simple docstring"""







         return self.hidden_size // self.num_attention_heads





      @property
      def 							_lowercase					(		self    :       Union[str, Any]							)     -> Dict:






         """simple docstring"""







         return not self.alibi







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					(	__snake_case	):
      UpperCamelCase										=							['''image_processor''', '''tokenizer''']
      UpperCamelCase										=							'''BridgeTowerImageProcessor'''
      UpperCamelCase										=							('''RobertaTokenizer''', '''RobertaTokenizerFast''')





      def __init__(		self    :       int       ,							__lowerCamelCase    :       Tuple       ,							__lowerCamelCase    :       List[Any]							)     -> Union[str, Any]:






         """simple docstring"""







         super().__init__(__lowerCamelCase       ,							__lowerCamelCase							)





      def __call__(		self    :       Any       ,							__lowerCamelCase    :       Optional[int]       ,							__lowerCamelCase    :       Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None       ,							__lowerCamelCase    :       bool = True       ,							__lowerCamelCase    :       Union[bool, str, PaddingStrategy] = False       ,							__lowerCamelCase    :       Union[bool, str, TruncationStrategy] = None       ,							__lowerCamelCase    :       Optional[int] = None       ,							__lowerCamelCase    :       int = 0       ,							__lowerCamelCase    :       Optional[int] = None       ,							__lowerCamelCase    :       Optional[bool] = None       ,							__lowerCamelCase    :       Optional[bool] = None       ,							__lowerCamelCase    :       bool = False       ,							__lowerCamelCase    :       bool = False       ,							__lowerCamelCase    :       bool = False       ,							__lowerCamelCase    :       bool = False       ,							__lowerCamelCase    :       bool = True       ,							__lowerCamelCase    :       Optional[Union[str, TensorType]] = None       ,							**__lowerCamelCase    :       Dict       ,							)     -> BatchEncoding:






         """simple docstring"""







         UpperCAmelCase      					=  self.tokenizer(
             text=__lowerCamelCase       ,							add_special_tokens=__lowerCamelCase       ,							padding=__lowerCamelCase       ,							truncation=__lowerCamelCase       ,							max_length=__lowerCamelCase       ,							stride=__lowerCamelCase       ,							pad_to_multiple_of=__lowerCamelCase       ,							return_token_type_ids=__lowerCamelCase       ,							return_attention_mask=__lowerCamelCase       ,							return_overflowing_tokens=__lowerCamelCase       ,							return_special_tokens_mask=__lowerCamelCase       ,							return_offsets_mapping=__lowerCamelCase       ,							return_length=__lowerCamelCase       ,							verbose=__lowerCamelCase       ,							return_tensors=__lowerCamelCase       ,							**__lowerCamelCase       ,							)
         # add pixel_values + pixel_mask
         UpperCAmelCase      					=  self.image_processor(
             __lowerCamelCase       ,							return_tensors=__lowerCamelCase       ,							do_normalize=__lowerCamelCase       ,							do_center_crop=__lowerCamelCase       ,							**__lowerCamelCase							)
         encoding.update(__lowerCamelCase							)

         return encoding





      def 							_lowercase					(		self    :       Optional[Any]       ,							*__lowerCamelCase    :       Optional[int]       ,							**__lowerCamelCase    :       List[str]							)     -> str:






         """simple docstring"""







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





      def 							_lowercase					(		self    :       Dict       ,							*__lowerCamelCase    :       Any       ,							**__lowerCamelCase    :       List[Any]							)     -> Optional[int]:






         """simple docstring"""







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





      @property
      def 							_lowercase					(		self    :       List[Any]							)     -> Optional[int]:






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



