


from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional

from packaging import version


if TYPE_CHECKING:
 from ... import PreTrainedTokenizer, TensorType

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSpec
from ...utils import is_torch_available, logging


__lowerCAmelCase			=							logging.get_logger(__name__)

__lowerCAmelCase			=							{
    '''bigscience/bloom''': '''https://huggingface.co/bigscience/bloom/resolve/main/config.json''',
    '''bigscience/bloom-560m''': '''https://huggingface.co/bigscience/bloom-560m/blob/main/config.json''',
    '''bigscience/bloom-1b1''': '''https://huggingface.co/bigscience/bloom-1b1/blob/main/config.json''',
    '''bigscience/bloom-1b7''': '''https://huggingface.co/bigscience/bloom-1b7/blob/main/config.json''',
    '''bigscience/bloom-3b''': '''https://huggingface.co/bigscience/bloom-3b/blob/main/config.json''',
    '''bigscience/bloom-7b1''': '''https://huggingface.co/bigscience/bloom-7b1/blob/main/config.json''',
}





class   __a      (   __UpperCamelCase				):
 __lowercase			:							str       					=			'bloom'
 __lowercase			:							Optional[int]       					=			['past_key_values']
 __lowercase			:							int       					=			{
     'num_hidden_layers': 'n_layer',
     'num_attention_heads': 'n_head',
 }
 def __init__(       self    ,			lowerCAmelCase__=250_880    ,			lowerCAmelCase__=64    ,			lowerCAmelCase__=2    ,			lowerCAmelCase__=8    ,			lowerCAmelCase__=1E-5    ,			lowerCAmelCase__=0.0_2    ,			lowerCAmelCase__=True    ,			lowerCAmelCase__=1    ,			lowerCAmelCase__=2    ,			lowerCAmelCase__=False    ,			lowerCAmelCase__=0.0    ,			lowerCAmelCase__=0.0    ,			lowerCAmelCase__=1    ,			lowerCAmelCase__=False    ,			**lowerCAmelCase__    ,			) ->    int:




        '''simple docstring'''
        lowercase__:       str        =       vocab_size
        # Backward compatibility with n_embed kwarg
        lowercase__:       Optional[int]        =       kwargs.pop('n_embed'    ,			lowerCAmelCase__			)
        lowercase__:       Optional[Any]        =       hidden_size if n_embed is None else n_embed
        lowercase__:       int        =       n_layer
        lowercase__:       Tuple        =       n_head
        lowercase__:       int        =       layer_norm_epsilon
        lowercase__:       int        =       initializer_range
        lowercase__:       str        =       use_cache
        lowercase__:       str        =       pretraining_tp
        lowercase__:       Dict        =       apply_residual_connection_post_layernorm
        lowercase__:       Union[str, Any]        =       hidden_dropout
        lowercase__:       Union[str, Any]        =       attention_dropout

        lowercase__:       Optional[Any]        =       bos_token_id
        lowercase__:       Dict        =       eos_token_id
        lowercase__:       str        =       slow_but_exact

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





class   __a      (   __UpperCamelCase				):
 __lowercase			:							List[Any]       					=			version.parse('1.12'				)
 def __init__(       self    ,			lowerCAmelCase__    ,			lowerCAmelCase__ = "default"    ,			lowerCAmelCase__ = None    ,			lowerCAmelCase__ = False    ,			) ->    Optional[Any]:




        '''simple docstring'''
        super().__init__(lowerCAmelCase__    ,			task=lowerCAmelCase__    ,			patching_specs=lowerCAmelCase__    ,			use_past=lowerCAmelCase__			)
        if not getattr(self._config    ,			'pad_token_id'    ,			lowerCAmelCase__			):
               # TODO: how to do that better?
               lowercase__:       Any        =       0
 @property
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    Mapping[str, Mapping[int, str]]:




        '''simple docstring'''
        lowercase__:       Optional[Any]        =       OrderedDict({'input_ids': {0: 'batch', 1: 'sequence'}}			)
        if self.use_past:
               # BLOOM stores values on dynamic axis 2. For more details see: https://github.com/huggingface/transformers/pull/18344
               self.fill_with_past_key_values_(lowerCAmelCase__    ,			direction='inputs'    ,			inverted_values_shape=lowerCAmelCase__			)
               lowercase__:       Any        =       {0: 'batch', 1: 'past_sequence + sequence'}
        else:
               lowercase__:       Optional[Any]        =       {0: 'batch', 1: 'sequence'}

        return common_inputs
 @property
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    int:




        '''simple docstring'''
        return self._config.n_layer
 @property
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    int:




        '''simple docstring'''
        return self._config.n_head
 @property
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    float:




        '''simple docstring'''
        return 1E-3
 def 		SCREAMING_SNAKE_CASE__       (       self    ,			lowerCAmelCase__    ,			lowerCAmelCase__ = -1    ,			lowerCAmelCase__ = -1    ,			lowerCAmelCase__ = False    ,			lowerCAmelCase__ = None    ,			) ->    Mapping[str, Any]:




        '''simple docstring'''
        lowercase__:       Optional[int]        =       super(lowerCAmelCase__    ,			self			).generate_dummy_inputs(
            lowerCAmelCase__    ,			batch_size=lowerCAmelCase__    ,			seq_length=lowerCAmelCase__    ,			is_pair=lowerCAmelCase__    ,			framework=lowerCAmelCase__			)

        # We need to order the input in the way they appears in the forward()
        lowercase__:       Any        =       OrderedDict({'input_ids': common_inputs['input_ids']}			)

        # Need to add the past_keys
        if self.use_past:
               if not is_torch_available():
                      raise ValueError('Cannot generate dummy past_keys inputs without PyTorch installed.'			)
               else:
                      import torch

                      lowercase__      ,						lowercase__:       List[Any]        =       common_inputs['input_ids'].shape
                      # Not using the same length for past_key_values
                      lowercase__:       Union[str, Any]        =       seqlen + 2
                      lowercase__:       Union[str, Any]        =       self._config.hidden_size // self.num_attention_heads
                      lowercase__:       Optional[Any]        =       (
                          batch * self.num_attention_heads,
                          head_dim,
                          past_key_values_length,
                      )
                      lowercase__:       int        =       (
                          batch * self.num_attention_heads,
                          past_key_values_length,
                          head_dim,
                      )
                      lowercase__:       Optional[int]        =       [
                          (torch.zeros(lowerCAmelCase__			), torch.zeros(lowerCAmelCase__			)) for _ in range(self.num_layers			)
                      ]

        lowercase__:       str        =       common_inputs['attention_mask']
        if self.use_past:
               lowercase__:       Dict        =       ordered_inputs['attention_mask'].dtype
               lowercase__:       Optional[Any]        =       torch.cat(
                   [ordered_inputs['attention_mask'], torch.ones(lowerCAmelCase__    ,			lowerCAmelCase__    ,			dtype=lowerCAmelCase__			)]    ,			dim=1			)

        return ordered_inputs
 @property
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    int:




        '''simple docstring'''
        return 13






from __future__ import annotations




def        snake_case_					(  snake_case      ,							snake_case					)  ->    list[int]:
       lowercase__:       Tuple        =       0
       lowercase__:       str        =       len(snake_case					) - 1

       while i < j:
              if nums[i] + nums[j] == target:
                     return [i, j]
              elif nums[i] + nums[j] < target:
                     lowercase__:       str        =       i + 1
              else:
                     lowercase__:       Dict        =       j - 1

       return []


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 print(F'''{two_pointer([2, 7, 11, 15], 9) = }''')


