


import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey





class  lowerCAmelCase__:






    '''simple docstring'''





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





       '''simple docstring'''
       if dst_width < 0 or dst_height < 0:
          raise ValueError('''Destination width/height should be > 0'''	)

       UpperCAmelCase_							:      Dict						=   img
       UpperCAmelCase_							:      Any						=   img.shape[1]
       UpperCAmelCase_							:      List[Any]						=   img.shape[0]
       UpperCAmelCase_							:      Optional[int]						=   dst_width
       UpperCAmelCase_							:      Any						=   dst_height

       UpperCAmelCase_							:      Dict						=   self.src_w / self.dst_w
       UpperCAmelCase_							:      Union[str, Any]						=   self.src_h / self.dst_h

       UpperCAmelCase_							:      Union[str, Any]						=   (
           np.ones((self.dst_h, self.dst_w, 3)       ,   np.uinta	) * 255
       )





    def 					_lowerCamelCase (	self				:   Tuple	):





       '''simple docstring'''
       for i in range(self.dst_h	):
          for j in range(self.dst_w	):
             UpperCAmelCase_							:      Dict						=   self.img[self.get_y(__snake_case	)][self.get_x(__snake_case	)]





    def 					_lowerCamelCase (	self				:   Optional[int]       ,   __snake_case				:   int	):





       '''simple docstring'''
       return int(self.ratio_x * x	)





    def 					_lowerCamelCase (	self				:   int       ,   __snake_case				:   int	):





       '''simple docstring'''
       return int(self.ratio_y * y	)


if __name__ == "__main__":
       __UpperCamelCase					,					__UpperCamelCase				:  Tuple      					=							800, 600
       __UpperCamelCase				:  Optional[Any]      					=							imread('image_data/lena.jpg', 1)
       __UpperCamelCase				:  str      					=							NearestNeighbour(im, dst_w, dst_h)
       n.process()

       imshow(
           F'Image resized from: {im.shape[1]}x{im.shape[0]} to {dst_w}x{dst_h}', n.output
       )
       waitKey(0)
       destroyAllWindows()



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


__UpperCamelCase				:  Any      					=							logging.get_logger(__name__)

__UpperCamelCase				:  Dict      					=							{
    'bigcode/gpt_bigcode-santacoder': 'https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json',
}





class  lowerCAmelCase__(    snake_case__						):






    '''simple docstring'''





    A_  :     List[str]			= 'gpt_bigcode'
    A_  :     Optional[Any]			= ['past_key_values']
    A_  :     Optional[int]			= {
        'hidden_size': 'n_embd',
        'max_position_embeddings': 'n_positions',
        'num_attention_heads': 'n_head',
        'num_hidden_layers': 'n_layer',
    }





    def __init__(	self				:   int       ,   __snake_case				:   Dict=50_257       ,   __snake_case				:   List[str]=1_024       ,   __snake_case				:   Dict=768       ,   __snake_case				:   Optional[int]=12       ,   __snake_case				:   str=12       ,   __snake_case				:   List[str]=None       ,   __snake_case				:   List[str]="gelu_pytorch_tanh"       ,   __snake_case				:   Optional[Any]=0.1       ,   __snake_case				:   str=0.1       ,   __snake_case				:   Optional[Any]=0.1       ,   __snake_case				:   List[str]=1E-5       ,   __snake_case				:   Dict=0.02       ,   __snake_case				:   Optional[int]=True       ,   __snake_case				:   Tuple=True       ,   __snake_case				:   Optional[Any]=50_256       ,   __snake_case				:   Optional[Any]=50_256       ,   __snake_case				:   Optional[Any]=True       ,   __snake_case				:   Optional[Any]=True       ,   __snake_case				:   List[Any]=True       ,   **__snake_case				:   List[str]       ,   ):





       '''simple docstring'''
       UpperCAmelCase_							:      Any						=   vocab_size
       UpperCAmelCase_							:      int						=   n_positions
       UpperCAmelCase_							:      Any						=   n_embd
       UpperCAmelCase_							:      Union[str, Any]						=   n_layer
       UpperCAmelCase_							:      List[str]						=   n_head
       UpperCAmelCase_							:      List[Any]						=   n_inner
       UpperCAmelCase_							:      Optional[int]						=   activation_function
       UpperCAmelCase_							:      str						=   resid_pdrop
       UpperCAmelCase_							:      Optional[Any]						=   embd_pdrop
       UpperCAmelCase_							:      str						=   attn_pdrop
       UpperCAmelCase_							:      Any						=   layer_norm_epsilon
       UpperCAmelCase_							:      List[str]						=   initializer_range
       UpperCAmelCase_							:      Optional[int]						=   scale_attn_weights
       UpperCAmelCase_							:      Union[str, Any]						=   use_cache
       UpperCAmelCase_							:      Dict						=   attention_softmax_in_fpaa
       UpperCAmelCase_							:      Union[str, Any]						=   scale_attention_softmax_in_fpaa
       UpperCAmelCase_							:      Optional[int]						=   multi_query

       UpperCAmelCase_							:      Optional[Any]						=   bos_token_id
       UpperCAmelCase_							:      Tuple						=   eos_token_id

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