






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


lowerCamelCase	:							Tuple				={'''configuration_vit''': ['''VIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTConfig''', '''ViTOnnxConfig''']}

try:
 if not is_vision_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase	:							int				=['''ViTFeatureExtractor''']
 lowerCamelCase	:							Optional[int]				=['''ViTImageProcessor''']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase	:							List[Any]				=[
     '''VIT_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''ViTForImageClassification''',
     '''ViTForMaskedImageModeling''',
     '''ViTModel''',
     '''ViTPreTrainedModel''',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase	:							List[str]				=[
     '''TFViTForImageClassification''',
     '''TFViTModel''',
     '''TFViTPreTrainedModel''',
 ]

try:
 if not is_flax_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase	:							int				=[
     '''FlaxViTForImageClassification''',
     '''FlaxViTModel''',
     '''FlaxViTPreTrainedModel''',
 ]

if TYPE_CHECKING:
 from .configuration_vit import VIT_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTConfig, ViTOnnxConfig

 try:
  if not is_vision_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .feature_extraction_vit import ViTFeatureExtractor
  from .image_processing_vit import ViTImageProcessor

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_vit import (
      VIT_PRETRAINED_MODEL_ARCHIVE_LIST,
      ViTForImageClassification,
      ViTForMaskedImageModeling,
      ViTModel,
      ViTPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_vit import TFViTForImageClassification, TFViTModel, TFViTPreTrainedModel

 try:
  if not is_flax_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_flax_vit import FlaxViTForImageClassification, FlaxViTModel, FlaxViTPreTrainedModel


else:
 import sys

 lowerCamelCase	:							Optional[Any]				=_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)







import unittest

from transformers import load_tool
from transformers.utils import is_torch_available


if is_torch_available():
 import torch

from transformers.testing_utils import require_torch

from .test_tools_common import ToolTesterMixin





@require_torch
class 			__a  (    unittest.TestCase       ,   A__       ):







 def 					__lowercase					(		self					:   Any						):


      '''simple docstring'''






      UpperCamelCase__			:   Dict       				=  load_tool("text-to-speech"						)
      self.tool.setup()







 def 					__lowercase					(		self					:   Union[str, Any]						):


      '''simple docstring'''






      torch.manual_seed(0						)
      UpperCamelCase__			:   Union[str, Any]       				=  self.tool("hey"						)
      UpperCamelCase__			:   Any       				=  result.to_raw()
      self.assertTrue(
          torch.allclose(
              resulting_tensor[:3]							,   torch.tensor([-0.0_0_0_5_9_6_6_6_6_8_8_3_2_1_1_5_8_2_9, -0.0_0_0_3_6_5_7_6_4_0_1_9_0_7_9_5_0_6_4, -0.0_0_0_1_3_4_3_9_5_0_2_7_9_9_8_8_3_4_8_5]						)							,   )						)







 def 					__lowercase					(		self					:   List[Any]						):


      '''simple docstring'''






      torch.manual_seed(0						)
      UpperCamelCase__			:   List[Any]       				=  self.tool("hey"						)
      UpperCamelCase__			:   int       				=  result.to_raw()
      self.assertTrue(
          torch.allclose(
              resulting_tensor[:3]							,   torch.tensor([-0.0_0_0_5_9_6_6_6_6_8_8_3_2_1_1_5_8_2_9, -0.0_0_0_3_6_5_7_6_4_0_1_9_0_7_9_5_0_6_4, -0.0_0_0_1_3_4_3_9_5_0_2_7_9_9_8_8_3_4_8_5]						)							,   )						)