


"""simple docstring"""
from typing import TYPE_CHECKING

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


UpperCAmelCase				=						{
    """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:
 UpperCAmelCase				=						["""ChineseCLIPFeatureExtractor"""]
 UpperCAmelCase				=						["""ChineseCLIPImageProcessor"""]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase				=						[
     """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

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





"""simple docstring"""
from datetime import datetime

import matplotlib.pyplot as plt
import torch

def 				_snake_case      (   __snake_case							:      List[str]   ):




   """simple docstring"""







   for param in module.parameters():
      _lowerCamelCase	:					Optional[Any]   =		False

def 				_snake_case      (   ):




   """simple docstring"""







   _lowerCamelCase	:					Any   =		"""cuda""" if torch.cuda.is_available() else """cpu"""
   if torch.backends.mps.is_available() and torch.backends.mps.is_built():
      _lowerCamelCase	:					Any   =		"""mps"""
   if device == "mps":
      print(
          """WARNING: MPS currently doesn't seem to work, and messes up backpropagation without any visible torch"""
          """ errors. I recommend using CUDA on a colab notebook or CPU instead if you're facing inexplicable issues"""
          """ with generations."""   )
   return device

def 				_snake_case      (   __snake_case							:      Union[str, Any]   ):




   """simple docstring"""







   _lowerCamelCase	:					int   =		plt.imshow(__snake_case   )
   fig.axes.get_xaxis().set_visible(__snake_case   )
   fig.axes.get_yaxis().set_visible(__snake_case   )
   plt.show()





def 				_snake_case      (   ):




   """simple docstring"""







   _lowerCamelCase	:					Tuple   =		datetime.now()
   _lowerCamelCase	:					Optional[Any]   =		current_time.strftime("""%H:%M:%S"""   )
   return timestamp

