

'''simple docstring'''



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       SCREAMING_SNAKE_CASE       (				unittest.TestCase   ,lowercase_       ):






      '''simple docstring'''






      def 						__UpperCAmelCase      (       self			:		int ):



          """simple docstring"""





          _snake_case			:			List[Any]				       =		load_tool('text-to-speech' )
          self.tool.setup()




      def 						__UpperCAmelCase      (       self			:		Optional[int] ):



          """simple docstring"""





          torch.manual_seed(0 )
          _snake_case			:			Dict				       =		self.tool('hey' )
          _snake_case			:			List[str]				       =		result.to_raw()
          self.assertTrue(
              torch.allclose(
                  resulting_tensor[:3]  ,       torch.tensor([-0.000_5966_6688_3211_5829, -0.000_3657_6401_9079_5064, -0.0001_3439_5027_9988_3485] )  ,       ) )




      def 						__UpperCAmelCase      (       self			:		Optional[Any] ):



          """simple docstring"""





          torch.manual_seed(0 )
          _snake_case			:			Dict				       =		self.tool('hey' )
          _snake_case			:			Any				       =		result.to_raw()
          self.assertTrue(
              torch.allclose(
                  resulting_tensor[:3]  ,       torch.tensor([-0.000_5966_6688_3211_5829, -0.000_3657_6401_9079_5064, -0.0001_3439_5027_9988_3485] )  ,       ) )




"""simple docstring"""






from typing import TYPE_CHECKING

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


__lowerCAmelCase       :			Optional[int]   	={
    """configuration_chinese_clip""": [
        """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """ChineseCLIPConfig""",
        """ChineseCLIPOnnxConfig""",
        """ChineseCLIPTextConfig""",
        """ChineseCLIPVisionConfig""",
    ],
    """processing_chinese_clip""": ["""ChineseCLIPProcessor"""],
}

try:
       if not is_vision_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCAmelCase       :			List[Any]   	=["""ChineseCLIPFeatureExtractor"""]
       __lowerCAmelCase       :			List[Any]   	=["""ChineseCLIPImageProcessor"""]

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCAmelCase       :			Tuple   	=[
           """CHINESE_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """ChineseCLIPModel""",
           """ChineseCLIPPreTrainedModel""",
           """ChineseCLIPTextModel""",
           """ChineseCLIPVisionModel""",
       ]

if TYPE_CHECKING:
       from .configuration_chinese_clip import (
           CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
           ChineseCLIPConfig,
           ChineseCLIPOnnxConfig,
           ChineseCLIPTextConfig,
           ChineseCLIPVisionConfig,
       )
       from .processing_chinese_clip import ChineseCLIPProcessor

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .feature_extraction_chinese_clip import ChineseCLIPFeatureExtractor, ChineseCLIPImageProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_chinese_clip import (
                  CHINESE_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
                  ChineseCLIPModel,
                  ChineseCLIPPreTrainedModel,
                  ChineseCLIPTextModel,
                  ChineseCLIPVisionModel,
              )

else:
       import sys

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



