



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__lowerCamelCase       			=   {"""configuration_nat""": ["""NAT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NatConfig"""]}


try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCamelCase       			=   [
        """NAT_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """NatForImageClassification""",
        """NatModel""",
        """NatPreTrainedModel""",
        """NatBackbone""",
    ]

if TYPE_CHECKING:
    from .configuration_nat import NAT_PRETRAINED_CONFIG_ARCHIVE_MAP, NatConfig

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_nat import (
            NAT_PRETRAINED_MODEL_ARCHIVE_LIST,
            NatBackbone,
            NatForImageClassification,
            NatModel,
            NatPreTrainedModel,
        )

else:
    import sys

    __lowerCamelCase       			=   _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)




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.'''							)