





import importlib.metadata
import subprocess
import sys

def      a    (   _lowercase :  Optional[int] = False							)  ->Any:
		UpperCamelCase__								=						False
		if "IPython" in sys.modules:
				UpperCamelCase__								=						"""google.colab""" in str(sys.modules["""IPython"""].get_ipython()							)

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











from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


UpperCAmelCase_    ={
    """configuration_splinter""": ["""SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SplinterConfig"""],
    """tokenization_splinter""": ["""SplinterTokenizer"""],
}

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase_    =["""SplinterTokenizerFast"""]

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase_    =[
		    """SPLINTER_PRETRAINED_MODEL_ARCHIVE_LIST""",
		    """SplinterForQuestionAnswering""",
		    """SplinterForPreTraining""",
		    """SplinterLayer""",
		    """SplinterModel""",
		    """SplinterPreTrainedModel""",
		]


if TYPE_CHECKING:
		from .configuration_splinter import SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP, SplinterConfig
		from .tokenization_splinter import SplinterTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_splinter_fast import SplinterTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_splinter import (
				    SPLINTER_PRETRAINED_MODEL_ARCHIVE_LIST,
				    SplinterForPreTraining,
				    SplinterForQuestionAnswering,
				    SplinterLayer,
				    SplinterModel,
				    SplinterPreTrainedModel,
				)


else:
		import sys

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



