




'''simple docstring'''





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


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

UpperCamelCase_		:    List[str]									=		{
    '''google/pegasus-x-base''': '''https://huggingface.co/google/pegasus-x-base/resolve/main/config.json''',
    '''google/pegasus-x-large''': '''https://huggingface.co/google/pegasus-x-large/resolve/main/config.json''',
    # See all PEGASUS-X models at https://huggingface.co/models?filter=pegasus-x
}

class      _a       (		lowercase__							):

     '''simple docstring'''





     SCREAMING_SNAKE_CASE_							:					Union[str, Any]					       =		"""pegasus_x"""
     SCREAMING_SNAKE_CASE_							:					str					       =		["""past_key_values"""]
     SCREAMING_SNAKE_CASE_							:					List[Any]					       =		{"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}






     def __init__(				self      ,_SCREAMING_SNAKE_CASE=96_103      ,_SCREAMING_SNAKE_CASE=16_384      ,_SCREAMING_SNAKE_CASE=16      ,_SCREAMING_SNAKE_CASE=4_096      ,_SCREAMING_SNAKE_CASE=16      ,_SCREAMING_SNAKE_CASE=16      ,_SCREAMING_SNAKE_CASE=4_096      ,_SCREAMING_SNAKE_CASE=16      ,_SCREAMING_SNAKE_CASE=0.0      ,_SCREAMING_SNAKE_CASE=0.0      ,_SCREAMING_SNAKE_CASE=True      ,_SCREAMING_SNAKE_CASE=True      ,_SCREAMING_SNAKE_CASE="gelu"      ,_SCREAMING_SNAKE_CASE=1_024      ,_SCREAMING_SNAKE_CASE=0.1      ,_SCREAMING_SNAKE_CASE=0.0      ,_SCREAMING_SNAKE_CASE=0.0      ,_SCREAMING_SNAKE_CASE=0.0_2      ,_SCREAMING_SNAKE_CASE=0      ,_SCREAMING_SNAKE_CASE=True      ,_SCREAMING_SNAKE_CASE=0      ,_SCREAMING_SNAKE_CASE=1      ,_SCREAMING_SNAKE_CASE=1      ,_SCREAMING_SNAKE_CASE=32      ,_SCREAMING_SNAKE_CASE=512      ,_SCREAMING_SNAKE_CASE=True      ,**_SCREAMING_SNAKE_CASE      ,)							->    Any:
          _snake_case							=   vocab_size
          _snake_case							=   max_position_embeddings
          _snake_case							=   d_model
          _snake_case							=   encoder_ffn_dim
          _snake_case							=   encoder_layers
          _snake_case							=   encoder_attention_heads
          _snake_case							=   decoder_ffn_dim
          _snake_case							=   decoder_layers
          _snake_case							=   decoder_attention_heads
          _snake_case							=   dropout
          _snake_case							=   attention_dropout
          _snake_case							=   activation_dropout
          _snake_case							=   activation_function
          _snake_case							=   init_std
          _snake_case							=   encoder_layerdrop
          _snake_case							=   decoder_layerdrop
          _snake_case							=   use_cache
          _snake_case							=   encoder_layers
          _snake_case							=   scale_embedding  # scale factor will be sqrt(d_model) if True

          _snake_case							=   num_global_tokens
          _snake_case							=   block_size
          _snake_case							=   stagger_local_blocks

          super().__init__(
              pad_token_id=_A      ,eos_token_id=_A      ,is_encoder_decoder=_A      ,decoder_start_token_id=_A      ,forced_eos_token_id=_A      ,**_A      ,)






     @property
     def        _lowercase			(				self					)							->    int:
          return self.encoder_attention_heads






     @property
     def        _lowercase			(				self					)							->    int:
          return self.d_model








'''simple docstring'''





import argparse
import os


UpperCamelCase_		:    Union[str, Any]									=		{
    '''pytorch''': {
        '''1.13''': {
            '''torch''': '''1.13.1''',
            '''torchvision''': '''0.14.1''',
            '''torchaudio''': '''0.13.1''',
            '''python''': 3.9,
            '''cuda''': '''cu116''',
            '''install''': (
                '''python3 -m pip install --no-cache-dir -U torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1'''
                ''' --extra-index-url https://download.pytorch.org/whl/cu116'''
            ),
            '''base_image''': '''nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04''',
        },
        '''1.12''': {
            '''torch''': '''1.12.1''',
            '''torchvision''': '''0.13.1''',
            '''torchaudio''': '''0.12.1''',
            '''python''': 3.9,
            '''cuda''': '''cu113''',
            '''install''': (
                '''python3 -m pip install --no-cache-dir -U torch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1'''
                ''' --extra-index-url https://download.pytorch.org/whl/cu113'''
            ),
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
        '''1.11''': {
            '''torch''': '''1.11.0''',
            '''torchvision''': '''0.12.0''',
            '''torchaudio''': '''0.11.0''',
            '''python''': 3.9,
            '''cuda''': '''cu113''',
            '''install''': (
                '''python3 -m pip install --no-cache-dir -U torch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0'''
                ''' --extra-index-url https://download.pytorch.org/whl/cu113'''
            ),
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
        '''1.10''': {
            '''torch''': '''1.10.2''',
            '''torchvision''': '''0.11.3''',
            '''torchaudio''': '''0.10.2''',
            '''python''': 3.9,
            '''cuda''': '''cu113''',
            '''install''': (
                '''python3 -m pip install --no-cache-dir -U torch==1.10.2 torchvision==0.11.3 torchaudio==0.10.2'''
                ''' --extra-index-url https://download.pytorch.org/whl/cu113'''
            ),
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
        # torchaudio < 0.10 has no CUDA-enabled binary distributions
        '''1.9''': {
            '''torch''': '''1.9.1''',
            '''torchvision''': '''0.10.1''',
            '''torchaudio''': '''0.9.1''',
            '''python''': 3.9,
            '''cuda''': '''cu111''',
            '''install''': (
                '''python3 -m pip install --no-cache-dir -U torch==1.9.1 torchvision==0.10.1 torchaudio==0.9.1'''
                ''' --extra-index-url https://download.pytorch.org/whl/cu111'''
            ),
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
    },
    '''tensorflow''': {
        '''2.11''': {
            '''tensorflow''': '''2.11.1''',
            '''install''': '''python3 -m pip install --no-cache-dir -U tensorflow==2.11.1''',
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
        '''2.10''': {
            '''tensorflow''': '''2.10.1''',
            '''install''': '''python3 -m pip install --no-cache-dir -U tensorflow==2.10.1''',
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
        '''2.9''': {
            '''tensorflow''': '''2.9.3''',
            '''install''': '''python3 -m pip install --no-cache-dir -U tensorflow==2.9.3''',
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
        '''2.8''': {
            '''tensorflow''': '''2.8.2''',
            '''install''': '''python3 -m pip install --no-cache-dir -U tensorflow==2.8.2''',
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
        '''2.7''': {
            '''tensorflow''': '''2.7.3''',
            '''install''': '''python3 -m pip install --no-cache-dir -U tensorflow==2.7.3''',
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
        '''2.6''': {
            '''tensorflow''': '''2.6.5''',
            '''install''': '''python3 -m pip install --no-cache-dir -U tensorflow==2.6.5''',
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
        '''2.5''': {
            '''tensorflow''': '''2.5.3''',
            '''install''': '''python3 -m pip install --no-cache-dir -U tensorflow==2.5.3''',
            '''base_image''': '''nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04''',
        },
    },
}


if __name__ == "__main__":
   UpperCamelCase_		:    Optional[Any]									=		argparse.ArgumentParser('''Choose the framework and version to install''')
   parser.add_argument(
       '''--framework''', help='''The framework to install. Should be `torch` or `tensorflow`''', type=str, required=True
   )
   parser.add_argument('''--version''', help='''The version of the framework to install.''', type=str, required=True)
   UpperCamelCase_		:    Tuple									=		parser.parse_args()

   UpperCamelCase_		:    Optional[int]									=		past_versions_testing[args.framework][args.version]

   os.system(F'echo "export INSTALL_CMD=\'{info["install"]}\'" >> ~/.profile')
   print(F'echo "export INSTALL_CMD=\'{info["install"]}\'" >> ~/.profile')

   UpperCamelCase_		:    List[Any]									=		''''''
   if args.framework == "pytorch":
      UpperCamelCase_		:    str									=		info['''cuda''']
   os.system(F'echo \"export CUDA=\'{cuda}\'\" >> ~/.profile')
   print(F'echo \"export CUDA=\'{cuda}\'\" >> ~/.profile')


