






from typing import TYPE_CHECKING

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


snake_case_   :	int							      ={'''configuration_vilt''': ['''VILT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViltConfig''']}

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_   :	List[str]							      =['''ViltFeatureExtractor''']
					snake_case_   :	List[str]							      =['''ViltImageProcessor''']
					snake_case_   :	Optional[int]							      =['''ViltProcessor''']

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_   :	str							      =[
					    '''VILT_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''ViltForImageAndTextRetrieval''',
					    '''ViltForImagesAndTextClassification''',
					    '''ViltForTokenClassification''',
					    '''ViltForMaskedLM''',
					    '''ViltForQuestionAnswering''',
					    '''ViltLayer''',
					    '''ViltModel''',
					    '''ViltPreTrainedModel''',
					]


if TYPE_CHECKING:
					from .configuration_vilt import VILT_PRETRAINED_CONFIG_ARCHIVE_MAP, ViltConfig

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .feature_extraction_vilt import ViltFeatureExtractor
										from .image_processing_vilt import ViltImageProcessor
										from .processing_vilt import ViltProcessor

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_vilt import (
										    VILT_PRETRAINED_MODEL_ARCHIVE_LIST,
										    ViltForImageAndTextRetrieval,
										    ViltForImagesAndTextClassification,
										    ViltForMaskedLM,
										    ViltForQuestionAnswering,
										    ViltForTokenClassification,
										    ViltLayer,
										    ViltModel,
										    ViltPreTrainedModel,
										)


else:
					import sys

					snake_case_   :	Dict							      =_LazyModule(__name__, globals()['''__file__'''], _import_structure)





'''simple docstring'''



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

__UpperCAmelCase     :Tuple												=  [(1,)]




def       _a      (		):





     '''simple docstring'''






     __UpperCAmelCase      :					Any    				=     bool(os.getenv('''RUN_SLOW'''     ,   0    )    )
     if run_slow:
          assert True
     else:
          assert False, "should have been skipped"




def       _a      (		):





     '''simple docstring'''






     __UpperCAmelCase      :					str    				=     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       a							(						unittest.TestCase			):


     """simple docstring"""






     @slow
     @require_torch_gpu
     def 					lowerCamelCase__					(							self	:						Tuple     )		->				str:
          check_slow_torch_cuda()

     @require_torch_gpu
     @slow
     def 					lowerCamelCase__					(							self	:						Any     )		->				List[Any]:
          check_slow_torch_cuda()






     @parameterized.expand(snake_case     )
     @slow
     def 					lowerCamelCase__					(							self	:						Union[str, Any]				,					snake_case	:						int=None     )		->				Union[str, Any]:
          check_slow()




@slow
@require_torch_gpu
def       _a      (		):





     '''simple docstring'''






     check_slow_torch_cuda()




@require_torch_gpu
@slow
def       _a      (		):





     '''simple docstring'''






     check_slow_torch_cuda()




@slow
@pytest.mark.parametrize('''param'''     ,   [1]    )
def       _a      (		_lowercase   :      Union[str, Any]    ):





     '''simple docstring'''






     check_slow()




@pytest.mark.parametrize('''param'''     ,   [1]    )
@slow
def       _a      (		_lowercase   :      Dict    ):





     '''simple docstring'''






     check_slow()