




import copy

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


snake_case__			:    List[str]			     =      logging.get_logger(__name__)





class      snake_case	(						_snake_case				):


   '''simple docstring'''







   UpperCamelCase__						:							Optional[Any] 	=   "upernet"




   def __init__(       self  :						str    ,     lowerCamelCase_  :						List[str]=None    ,     lowerCamelCase_  :						Dict=512    ,     lowerCamelCase_  :						List[str]=0.02    ,     lowerCamelCase_  :						int=[1, 2, 3, 6]    ,     lowerCamelCase_  :						Optional[Any]=True    ,     lowerCamelCase_  :						Tuple=0.4    ,     lowerCamelCase_  :						Union[str, Any]=384    ,     lowerCamelCase_  :						Dict=256    ,     lowerCamelCase_  :						List[Any]=1    ,     lowerCamelCase_  :						Any=False    ,     lowerCamelCase_  :						Any=255    ,     **lowerCamelCase_  :						Optional[int]    ,     )       ->Tuple:
     '''simple docstring'''







     super().__init__(**lowerCamelCase_      )

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

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







   def 						UpperCAmelCase							(       self  :						int      )       ->List[Any]:
     '''simple docstring'''







     UpperCAmelCase__         = copy.deepcopy(self.__dict__      )
     UpperCAmelCase__         = self.backbone_config.to_dict()
     UpperCAmelCase__         = self.__class__.model_type
     return output












import os
import sys

__a:     Union[str, Any]   					=					os.path.join(os.path.dirname(__file__), '''src''')
sys.path.append(SRC_DIR)


from transformers import (
    AutoConfig,
    AutoModel,
    AutoModelForCausalLM,
    AutoModelForMaskedLM,
    AutoModelForQuestionAnswering,
    AutoModelForSequenceClassification,
    AutoTokenizer,
    add_start_docstrings,
)


__a:     Union[str, Any]   					=					[
    '''torch''',
    '''numpy''',
    '''tokenizers''',
    '''filelock''',
    '''requests''',
    '''tqdm''',
    '''regex''',
    '''sentencepiece''',
    '''sacremoses''',
    '''importlib_metadata''',
    '''huggingface_hub''',
]




@add_start_docstrings(AutoConfig.__doc__ )
def       _SCREAMING_SNAKE_CASE (							*__snake_case   ,      **__snake_case )				->						Union[str, Any]:
       return AutoConfig.from_pretrained(*__snake_case   ,      **__snake_case )




@add_start_docstrings(AutoTokenizer.__doc__ )
def       _SCREAMING_SNAKE_CASE (							*__snake_case   ,      **__snake_case )				->						Any:
       return AutoTokenizer.from_pretrained(*__snake_case   ,      **__snake_case )




@add_start_docstrings(AutoModel.__doc__ )
def       _SCREAMING_SNAKE_CASE (							*__snake_case   ,      **__snake_case )				->						Tuple:
       return AutoModel.from_pretrained(*__snake_case   ,      **__snake_case )




@add_start_docstrings(AutoModelForCausalLM.__doc__ )
def       _SCREAMING_SNAKE_CASE (							*__snake_case   ,      **__snake_case )				->						Tuple:
       return AutoModelForCausalLM.from_pretrained(*__snake_case   ,      **__snake_case )




@add_start_docstrings(AutoModelForMaskedLM.__doc__ )
def       _SCREAMING_SNAKE_CASE (							*__snake_case   ,      **__snake_case )				->						Optional[Any]:
       return AutoModelForMaskedLM.from_pretrained(*__snake_case   ,      **__snake_case )




@add_start_docstrings(AutoModelForSequenceClassification.__doc__ )
def       _SCREAMING_SNAKE_CASE (							*__snake_case   ,      **__snake_case )				->						List[str]:
       return AutoModelForSequenceClassification.from_pretrained(*__snake_case   ,      **__snake_case )





@add_start_docstrings(AutoModelForQuestionAnswering.__doc__ )
def       _SCREAMING_SNAKE_CASE (							*__snake_case   ,      **__snake_case )				->						List[Any]:
       return AutoModelForQuestionAnswering.from_pretrained(*__snake_case   ,      **__snake_case )