


"""simple docstring"""







from .imports import is_tqdm_available


if is_tqdm_available():
       from tqdm.auto import tqdm as _tqdm

from ..state import PartialState
def _A						(						lowercase = True	,   *lowercase	,   **lowercase		):







    """simple docstring"""
    if not is_tqdm_available():
        raise ImportError('''Accelerate\'s `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`.'''		)
    a					=False
    if main_process_only:
        a					=PartialState().local_process_index == 0
    return _tqdm(*lowercase	,   **lowercase	,   disable=lowercase		)





"""simple docstring"""







import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING


lowerCamelCase_       :       int      						=  logging.get_logger(__name__)






class 				__A    (	_SCREAMING_SNAKE_CASE      ):






 """simple docstring"""




 __lowerCAmelCase			 =  "upernet"


 def __init__(		self			,   __A=None			,   __A=512			,   __A=0.02			,   __A=[1, 2, 3, 6]			,   __A=True			,   __A=0.4			,   __A=384			,   __A=256			,   __A=1			,   __A=False			,   __A=255			,   **__A			,   ) ->					Tuple:
     super().__init__(**__A						)

     if backbone_config is None:
         logger.info('''`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.'''						)
         a					=CONFIG_MAPPING['''resnet'''](out_features=['''stage1''', '''stage2''', '''stage3''', '''stage4''']						)
     elif isinstance(__A			,   __A						):
         a					=backbone_config.get('''model_type'''						)
         a					=CONFIG_MAPPING[backbone_model_type]
         a					=config_class.from_dict(__A						)

     a					=backbone_config
     a					=hidden_size
     a					=initializer_range
     a					=pool_scales
     a					=use_auxiliary_head
     a					=auxiliary_loss_weight
     a					=auxiliary_in_channels
     a					=auxiliary_channels
     a					=auxiliary_num_convs
     a					=auxiliary_concat_input
     a					=loss_ignore_index





 def 				SCREAMING_SNAKE_CASE							(		self						) ->					Dict:
     a					=copy.deepcopy(self.__dict__						)
     a					=self.backbone_config.to_dict()
     a					=self.__class__.model_type
     return output