



"""simple docstring"""
import logging
import os

from .state import PartialState
class 				lowerCamelCase  (			logging.LoggerAdapter				):






					'''simple docstring'''





					@staticmethod
					def    lowerCAmelCase_				(       snake_case:							Union[str, Any]						)   ->	Any:
											snake_case_ :int						=			PartialState()
											return not main_process_only or (main_process_only and state.is_main_process)






					def    lowerCAmelCase_				(       self:							Optional[int]						,     snake_case:							List[Any]						,     snake_case:							List[Any]						,     *snake_case:							Dict						,     **snake_case:							List[str]						)   ->	Any:
											if PartialState._shared_state == {}:
																	raise RuntimeError(
																	    """You must initialize the accelerate state by calling either `PartialState()` or `Accelerator()` before using the logging utility."""						)
											snake_case_ :Any						=			kwargs.pop("""main_process_only"""						,     snake_case						)
											snake_case_ :List[Any]						=			kwargs.pop("""in_order"""						,     snake_case						)

											if self.isEnabledFor(snake_case						):
																	if self._should_log(snake_case						):
																							snake_case_,       snake_case_ :int						=			self.process(snake_case						,     snake_case						)
																							self.logger.log(snake_case						,     snake_case						,     *snake_case						,     **snake_case						)

																	elif in_order:
																							snake_case_ :Optional[Any]						=			PartialState()
																							for i in range(state.num_processes						):
																													if i == state.process_index:
																																			snake_case_,       snake_case_ :List[Any]						=			self.process(snake_case						,     snake_case						)
																																			self.logger.log(snake_case						,     snake_case						,     *snake_case						,     **snake_case						)
																													state.wait_for_everyone()

def    A_  (			_lowercase,					_lowercase = None	):







						'''simple docstring'''


						if log_level is None:
												snake_case_ :Any						=			os.environ.get("""ACCELERATE_LOG_LEVEL""",					_lowercase	)
						snake_case_ :int						=			logging.getLogger(_lowercase	)
						if log_level is not None:
												logger.setLevel(log_level.upper()	)
												logger.root.setLevel(log_level.upper()	)
						return MultiProcessAdapter(_lowercase,					{}	)





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

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


__a      =				{
    "configuration_altclip": [
        "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "AltCLIPConfig",
        "AltCLIPTextConfig",
        "AltCLIPVisionConfig",
    ],
    "processing_altclip": ["AltCLIPProcessor"],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						__a      =				[
						    "ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "AltCLIPPreTrainedModel",
						    "AltCLIPModel",
						    "AltCLIPTextModel",
						    "AltCLIPVisionModel",
						]


if TYPE_CHECKING:
						from .configuration_altclip import (
						    ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    AltCLIPConfig,
						    AltCLIPTextConfig,
						    AltCLIPVisionConfig,
						)
						from .processing_altclip import AltCLIPProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_altclip import (
												    ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
												    AltCLIPModel,
												    AltCLIPPreTrainedModel,
												    AltCLIPTextModel,
												    AltCLIPVisionModel,
												)


else:
						import sys

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