



import os
import unittest

import pytest
from parameterized import parameterized

from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device


# skipping in unittest tests

__lowerCamelCase       			=   [(1,)]




def       UpperCAmelCase__	(							)				->	List[Any]:
  _A          =      bool(os.getenv('''RUN_SLOW'''  ,			0							)							)
  if run_slow:
    assert True
  else:
    assert False, "should have been skipped"




def       UpperCAmelCase__	(							)				->	Any:
  _A          =      bool(os.getenv('''RUN_SLOW'''  ,			0							)							)
  if run_slow and torch_device == "cuda":
    assert True
  else:
    assert False, "should have been skipped"



@require_torch
class 						_snake_case (     unittest.TestCase			):





 """simple docstring"""



 @slow
 @require_torch_gpu
 def lowercase_						(  self   )		->							Union[str, Any]:




   """simple docstring"""







   check_slow_torch_cuda()
 @require_torch_gpu
 @slow
 def lowercase_						(  self   )		->							Optional[Any]:




   """simple docstring"""







   check_slow_torch_cuda()



 @parameterized.expand(a   )
 @slow
 def lowercase_						(  self		,      a=None   )		->							Tuple:




   """simple docstring"""







   check_slow()







@slow
@require_torch_gpu
def       UpperCAmelCase__	(							)				->	Optional[Any]:
  check_slow_torch_cuda()




@require_torch_gpu
@slow
def       UpperCAmelCase__	(							)				->	Optional[Any]:
  check_slow_torch_cuda()




@slow
@pytest.mark.parametrize('''param'''  ,			[1]							)
def       UpperCAmelCase__	(							__snake_case							)				->	str:
  check_slow()




@pytest.mark.parametrize('''param'''  ,			[1]							)
@slow
def       UpperCAmelCase__	(							__snake_case							)				->	Tuple:
  check_slow()




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