

def    A_  (							a  ):

      """simple docstring"""



      if upper_limit < 0:
            raise ValueError('Limit for the Catalan sequence must be ≥ 0'  )

      SCREAMING_SNAKE_CASE_				:  List[str]           =     [0] * (upper_limit + 1)

      # Base case: C(0) = C(1) = 1
      SCREAMING_SNAKE_CASE_				:  Any           =     1
      if upper_limit > 0:
            SCREAMING_SNAKE_CASE_				:  int           =     1

      # Recurrence relation: C(i) = sum(C(j).C(i-j-1)), from j = 0 to i
      for i in range(2					,   upper_limit + 1  ):
            for j in range(a  ):
                  catalan_list[i] += catalan_list[j] * catalan_list[i - j - 1]

      return catalan_list


if __name__ == "__main__":
    print('\n********* Catalan Numbers Using Dynamic Programming ************\n')
    print('\n*** Enter -1 at any time to quit ***')
    print('\nEnter the upper limit (≥ 0) for the Catalan number sequence: ', end='')
    try:
        while True:
            lowerCAmelCase     :   Union[str, Any]						     =  int(input().strip())
            if N < 0:
                print('\n********* Goodbye!! ************')
                break
            else:
                print(F'The Catalan numbers from 0 through {N} are:')
                print(catalan_numbers(N))
                print('Try another upper limit for the sequence: ', end='')
    except (NameError, ValueError):
        print('\n********* Invalid input, goodbye! ************\n')

    import doctest

    doctest.testmod()









import copy
import os
from typing import Union

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


lowerCAmelCase     :   Optional[int]						     =  logging.get_logger(__name__)

lowerCAmelCase     :   str						     =  {
    'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json',
}
class  _A		(  __magic_name__):
  SCREAMING_SNAKE_CASE    :      Optional[int]       =  '''git_vision_model'''

  def __init__(				self ,					_SCREAMING_SNAKE_CASE=768 ,					_SCREAMING_SNAKE_CASE=3072 ,					_SCREAMING_SNAKE_CASE=12 ,					_SCREAMING_SNAKE_CASE=12 ,					_SCREAMING_SNAKE_CASE=3 ,					_SCREAMING_SNAKE_CASE=224 ,					_SCREAMING_SNAKE_CASE=16 ,					_SCREAMING_SNAKE_CASE="quick_gelu" ,					_SCREAMING_SNAKE_CASE=1e-5 ,					_SCREAMING_SNAKE_CASE=0.0 ,					_SCREAMING_SNAKE_CASE=0.02 ,					**_SCREAMING_SNAKE_CASE ,					):





        """simple docstring"""







        super().__init__(**_SCREAMING_SNAKE_CASE					)

        SCREAMING_SNAKE_CASE_				:  List[str]           =     hidden_size
        SCREAMING_SNAKE_CASE_				:  Any           =     intermediate_size
        SCREAMING_SNAKE_CASE_				:  List[str]           =     num_hidden_layers
        SCREAMING_SNAKE_CASE_				:  Optional[Any]           =     num_attention_heads
        SCREAMING_SNAKE_CASE_				:  Optional[Any]           =     num_channels
        SCREAMING_SNAKE_CASE_				:  Dict           =     patch_size
        SCREAMING_SNAKE_CASE_				:  Any           =     image_size
        SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     initializer_range
        SCREAMING_SNAKE_CASE_				:  Any           =     attention_dropout
        SCREAMING_SNAKE_CASE_				:  List[Any]           =     layer_norm_eps
        SCREAMING_SNAKE_CASE_				:  Tuple           =     hidden_act



  @classmethod
  def  UpperCAmelCase    (				cls ,					_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        cls._set_token_in_kwargs(_SCREAMING_SNAKE_CASE					)

        SCREAMING_SNAKE_CASE_       ,						SCREAMING_SNAKE_CASE_				:  str           =     cls.get_config_dict(_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					)

        # get the vision config dict if we are loading from GITConfig
        if config_dict.get('model_type'					) == "git":
              SCREAMING_SNAKE_CASE_				:  str           =     config_dict['vision_config']

        if "model_type" in config_dict and hasattr(cls ,					'model_type'					) and config_dict["model_type"] != cls.model_type:
              logger.warning(
                  f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
                  f"{cls.model_type}. This is not supported for all configurations of models and can yield errors."					)

        return cls.from_dict(_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					)

class  _A		(  __magic_name__):
  SCREAMING_SNAKE_CASE    :      Optional[Any]       =  '''git'''

  def __init__(				self ,					_SCREAMING_SNAKE_CASE=None ,					_SCREAMING_SNAKE_CASE=3_0522 ,					_SCREAMING_SNAKE_CASE=768 ,					_SCREAMING_SNAKE_CASE=6 ,					_SCREAMING_SNAKE_CASE=12 ,					_SCREAMING_SNAKE_CASE=3072 ,					_SCREAMING_SNAKE_CASE="gelu" ,					_SCREAMING_SNAKE_CASE=0.1 ,					_SCREAMING_SNAKE_CASE=0.1 ,					_SCREAMING_SNAKE_CASE=1024 ,					_SCREAMING_SNAKE_CASE=0.02 ,					_SCREAMING_SNAKE_CASE=1e-12 ,					_SCREAMING_SNAKE_CASE=0 ,					_SCREAMING_SNAKE_CASE="absolute" ,					_SCREAMING_SNAKE_CASE=True ,					_SCREAMING_SNAKE_CASE=False ,					_SCREAMING_SNAKE_CASE=101 ,					_SCREAMING_SNAKE_CASE=102 ,					_SCREAMING_SNAKE_CASE=None ,					**_SCREAMING_SNAKE_CASE ,					):





        """simple docstring"""







        super().__init__(bos_token_id=_SCREAMING_SNAKE_CASE ,					eos_token_id=_SCREAMING_SNAKE_CASE ,					pad_token_id=_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					)

        if vision_config is None:
              SCREAMING_SNAKE_CASE_				:  Any           =     {}
              logger.info('vision_config is None. initializing the GitVisionConfig with default values.'					)

        SCREAMING_SNAKE_CASE_				:  Optional[Any]           =     GitVisionConfig(**_SCREAMING_SNAKE_CASE					)
        SCREAMING_SNAKE_CASE_				:  Dict           =     vocab_size
        SCREAMING_SNAKE_CASE_				:  List[Any]           =     hidden_size
        SCREAMING_SNAKE_CASE_				:  Dict           =     num_hidden_layers
        SCREAMING_SNAKE_CASE_				:  List[str]           =     num_attention_heads
        SCREAMING_SNAKE_CASE_				:  List[str]           =     hidden_act
        SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     intermediate_size
        SCREAMING_SNAKE_CASE_				:  Any           =     hidden_dropout_prob
        SCREAMING_SNAKE_CASE_				:  Tuple           =     attention_probs_dropout_prob
        SCREAMING_SNAKE_CASE_				:  int           =     max_position_embeddings
        SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     initializer_range
        SCREAMING_SNAKE_CASE_				:  int           =     layer_norm_eps
        SCREAMING_SNAKE_CASE_				:  List[str]           =     position_embedding_type
        SCREAMING_SNAKE_CASE_				:  List[str]           =     use_cache
        SCREAMING_SNAKE_CASE_				:  Optional[int]           =     tie_word_embeddings
        SCREAMING_SNAKE_CASE_				:  List[Any]           =     num_image_with_embedding

        SCREAMING_SNAKE_CASE_				:  Tuple           =     bos_token_id
        SCREAMING_SNAKE_CASE_				:  Optional[int]           =     eos_token_id



  def  UpperCAmelCase    (				self					):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_				:  List[str]           =     copy.deepcopy(self.__dict__					)
        SCREAMING_SNAKE_CASE_				:  List[str]           =     self.vision_config.to_dict()
        SCREAMING_SNAKE_CASE_				:  int           =     self.__class__.model_type
        return output






