



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


__lowerCamelCase								=   logging.get_logger(__name__)

__lowerCamelCase								=   {
    """openbmb/cpm-ant-10b""": """https://huggingface.co/openbmb/cpm-ant-10b/blob/main/config.json"""
    # See all CPMAnt models at https://huggingface.co/models?filter=cpmant
}



class 						_snake_case (     lowerCamelCase			):





 """simple docstring"""



 lowerCamelCase_       =     '''cpmant'''
 def __init__(  self		,      a = 3_0_7_2_0		,      a = 4_0_9_6		,      a = 3_2		,      a = 1_2_8		,      a = 1_0_2_4_0		,      a = 4_8		,      a = 0.0		,      a = 5_1_2		,      a = 2_0_4_8		,      a = 1e-6		,      a = 1.0		,      a = 3_2		,      a = 3_2		,      a = 3_2		,      a = True		,      **a		,      )		->							Tuple:




   """simple docstring"""







   super().__init__(**a   )
   _A          =      prompt_types
   _A          =      prompt_length
   _A          =      segment_types
   _A          =      hidden_size
   _A          =      num_attention_heads
   _A          =      dim_head
   _A          =      dim_ff
   _A          =      num_hidden_layers
   _A          =      position_bias_num_buckets
   _A          =      position_bias_max_distance
   _A          =      dropout_p
   _A          =      eps
   _A          =      use_cache
   _A          =      vocab_size
   _A          =      init_std




import importlib.metadata
import subprocess
import sys




def       UpperCAmelCase__	(							__snake_case = False							)				->	List[Any]:
  _A          =      False
  if "IPython" in sys.modules:
    _A          =      '''google.colab''' in str(sys.modules['''IPython'''].get_ipython()							)

  if in_colab:
    if upgrade:
      _A          =      ['''pip''', '''install''', '''-U''', '''torch''']
      subprocess.run(__snake_case  ,			check=__snake_case							)
    # get the current version of torch
    _A          =      importlib.metadata.version('''torch'''							)
    _A          =      torch_version[: torch_version.rindex('''.'''							)]
    _A          =      F'''https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-{torch_version_trunc}-cp37-cp37m-linux_x86_64.whl'''
    _A          =      ['''pip''', '''install''', xla_wheel]
    subprocess.run(__snake_case  ,			check=__snake_case							)
  else:
    raise RuntimeError('''`install_xla` utility works only on google colab.'''							)