
"""simple docstring"""

import copy
import os

import cva
import numpy as np
from matplotlib import pyplot as plt
class   _UpperCAmelCase				:




      def __init__(				self				)    ->       Optional[Any]:
          UpperCAmelCase          =       ''
          UpperCAmelCase          =       ''
          UpperCAmelCase          =       []
          UpperCAmelCase          =       0
          UpperCAmelCase          =       2_5_6
          UpperCAmelCase          =       0
          UpperCAmelCase          =       0
          UpperCAmelCase          =       0
          UpperCAmelCase          =       0




      def      a_   (				self ,							lowercase_				)    ->       List[str]:
          UpperCAmelCase          =       cva.imread(lowercase_ ,							0				)
          UpperCAmelCase          =       copy.deepcopy(self.img				)
          UpperCAmelCase      ,				UpperCAmelCase      ,				UpperCAmelCase          =       plt.hist(self.img.ravel() ,							2_5_6 ,							[0, 2_5_6] ,							label='x'				)
          UpperCAmelCase          =       np.sum(lowercase_				)
          for i in range(len(lowercase_				)				):
              UpperCAmelCase          =       x[i] / self.k
              self.sk += prk
              UpperCAmelCase          =       (self.L - 1) * self.sk
              if self.rem != 0:
                  UpperCAmelCase          =       int(last % last				)
              UpperCAmelCase          =       int(last + 1 if self.rem >= 0.5 else last				)
              self.last_list.append(lowercase_				)
              UpperCAmelCase          =       int(np.ma.count(self.img				) / self.img[1].size				)
              UpperCAmelCase          =       self.img[1].size
          for i in range(self.number_of_cols				):
              for j in range(self.number_of_rows				):
                  UpperCAmelCase          =       self.img[j][i]
                  if num != self.last_list[num]:
                      UpperCAmelCase          =       self.last_list[num]
          cva.imwrite('output_data/output.jpg' ,							self.img				)




      def      a_   (				self				)    ->       Optional[int]:
          plt.hist(self.img.ravel() ,							2_5_6 ,							[0, 2_5_6]				)




      def      a_   (				self				)    ->       Tuple:
          cva.imshow('Output-Image' ,							self.img				)
          cva.imshow('Input-Image' ,							self.original_image				)
          cva.waitKey(5_0_0_0				)
          cva.destroyAllWindows()


if __name__ == "__main__":
   SCREAMING_SNAKE_CASE_            =    os.path.join(os.path.basename(__file__), '''image_data/input.jpg''')
   SCREAMING_SNAKE_CASE_            =    ConstantStretch()
   stretcher.stretch(file_path)
   stretcher.plot_histogram()
   stretcher.show_image()





"""simple docstring"""

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


SCREAMING_SNAKE_CASE_            =    logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_            =    {
    '''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   _UpperCAmelCase				(		SCREAMING_SNAKE_CASE_				):
      __SCREAMING_SNAKE_CASE :				Optional[Any]				   =						"falcon"
      __SCREAMING_SNAKE_CASE :				List[Any]				   =						["past_key_values"]




      def __init__(				self ,							lowercase_=6_5_0_2_4 ,							lowercase_=4_5_4_4 ,							lowercase_=3_2 ,							lowercase_=7_1 ,							lowercase_=1E-5 ,							lowercase_=0.0_2 ,							lowercase_=True ,							lowercase_=0.0 ,							lowercase_=0.0 ,							lowercase_=None ,							lowercase_=False ,							lowercase_=False ,							lowercase_=True ,							lowercase_=True ,							lowercase_=False ,							lowercase_=1_1 ,							lowercase_=1_1 ,							**lowercase_ ,							)    ->       Any:
          UpperCAmelCase          =       vocab_size
          # Backward compatibility with n_embed kwarg
          UpperCAmelCase          =       kwargs.pop('n_embed' ,							lowercase_				)
          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=lowercase_ ,							eos_token_id=lowercase_ ,							**lowercase_				)




      @property
      def      a_   (				self				)    ->       List[Any]:
          return self.hidden_size // self.num_attention_heads




      @property
      def      a_   (				self				)    ->       List[str]:
          return not self.alibi



