


'''simple docstring'''







import logging
import os

from .state import PartialState







class A__       (						logging.LoggerAdapter      ):






      @staticmethod
      def __UpperCAmelCase       ( SCREAMING_SNAKE_CASE			:Union[str, Any]	)       ->					Tuple:




             '''simple docstring'''
             _a    : List[Any]     					=PartialState()
             return not main_process_only or (main_process_only and state.is_main_process)






      def __UpperCAmelCase       ( self			:Tuple     ,						SCREAMING_SNAKE_CASE			:Optional[int]     ,						SCREAMING_SNAKE_CASE			:Optional[int]     ,						*SCREAMING_SNAKE_CASE			:str     ,						**SCREAMING_SNAKE_CASE			:Any	)       ->					List[Any]:




             '''simple docstring'''
             if PartialState._shared_state == {}:
                    raise RuntimeError(
                        """You must initialize the accelerate state by calling either `PartialState()` or `Accelerator()` before using the logging utility."""	)
             _a    : List[str]     					=kwargs.pop("""main_process_only"""     ,						SCREAMING_SNAKE_CASE	)
             _a    : List[str]     					=kwargs.pop("""in_order"""     ,						SCREAMING_SNAKE_CASE	)

             if self.isEnabledFor(SCREAMING_SNAKE_CASE	):
                    if self._should_log(SCREAMING_SNAKE_CASE	):
                           _a					,    _a    : Any     					=self.process(SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE	)
                           self.logger.log(SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE     ,						*SCREAMING_SNAKE_CASE     ,						**SCREAMING_SNAKE_CASE	)

                    elif in_order:
                           _a    : Union[str, Any]     					=PartialState()
                           for i in range(state.num_processes	):
                                  if i == state.process_index:
                                         _a					,    _a    : Optional[Any]     					=self.process(SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE	)
                                         self.logger.log(SCREAMING_SNAKE_CASE     ,						SCREAMING_SNAKE_CASE     ,						*SCREAMING_SNAKE_CASE     ,						**SCREAMING_SNAKE_CASE	)
                                  state.wait_for_everyone()


def 	SCREAMING_SNAKE_CASE_					(  _UpperCAmelCase	:	str    ,_UpperCAmelCase	:	str = None  )  ->			Optional[int]:
       if log_level is None:
              _a    : Union[str, Any]     					=os.environ.get("""ACCELERATE_LOG_LEVEL"""    ,_UpperCAmelCase  )
       _a    : Union[str, Any]     					=logging.getLogger(_UpperCAmelCase  )
       if log_level is not None:
              logger.setLevel(log_level.upper()  )
              logger.root.setLevel(log_level.upper()  )
       return MultiProcessAdapter(_UpperCAmelCase    ,{}  )






'''simple docstring'''







from typing import TYPE_CHECKING

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


A__:    List[str]					    =       {
    '''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:
   A__:    Optional[int]					    =       ['''ChineseCLIPFeatureExtractor''']
   A__:    Any					    =       ['''ChineseCLIPImageProcessor''']

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

   A__:    str					    =       _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)


