

"""simple docstring"""



from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


SCREAMING_SNAKE_CASE_       :						Dict					=    logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_       :						Optional[int]					=    {
    'facebook/convnext-tiny-224': 'https://huggingface.co/facebook/convnext-tiny-224/resolve/main/config.json',
    # See all ConvNeXT models at https://huggingface.co/models?filter=convnext
}



class        a    (							_lowerCamelCase,						_lowerCamelCase					):



    """simple docstring"""



    UpperCAmelCase    			=       "convnext"

    def __init__(  self:			Union[str, Any]     ,    UpperCamelCase:			List[Any]=3     ,    UpperCamelCase:			str=4     ,    UpperCamelCase:			int=4     ,    UpperCamelCase:			List[Any]=None     ,    UpperCamelCase:			Union[str, Any]=None     ,    UpperCamelCase:			Tuple="gelu"     ,    UpperCamelCase:			Union[str, Any]=0.02     ,    UpperCamelCase:			str=1e-1_2     ,    UpperCamelCase:			Optional[Any]=1e-6     ,    UpperCamelCase:			Optional[Any]=0.0     ,    UpperCamelCase:			Any=2_24     ,    UpperCamelCase:			Any=None     ,    UpperCamelCase:			Optional[Any]=None     ,    **UpperCamelCase:			Union[str, Any]     ,    ):






         """simple docstring"""


         super().__init__(**UpperCamelCase							)

         A__				      =	num_channels
         A__				      =	patch_size
         A__				      =	num_stages
         A__				      =	[96, 1_92, 3_84, 7_68] if hidden_sizes is None else hidden_sizes
         A__				      =	[3, 3, 9, 3] if depths is None else depths
         A__				      =	hidden_act
         A__				      =	initializer_range
         A__				      =	layer_norm_eps
         A__				      =	layer_scale_init_value
         A__				      =	drop_path_rate
         A__				      =	image_size
         A__				      =	["""stem"""] + [f"""stage{idx}""" for idx in range(1     ,    len(self.depths							) + 1							)]
         A__      ,					A__				      =	get_aligned_output_features_output_indices(
             out_features=UpperCamelCase     ,    out_indices=UpperCamelCase     ,    stage_names=self.stage_names							)



class        a    (							_lowerCamelCase					):



    """simple docstring"""



    UpperCAmelCase    			=       version.parse("1.11"					)

    @property
    def 					UpperCamelCase						(  self:			Tuple							):






         """simple docstring"""


         return OrderedDict(
             [
                 ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
             ]							)





    @property
    def 					UpperCamelCase						(  self:			str							):






         """simple docstring"""


         return 1e-5









"""simple docstring"""



import os

from ...utils import logging
from .utils import DataProcessor, InputExample


SCREAMING_SNAKE_CASE_       :						Dict					=    logging.get_logger(__name__)



class        a    (							_lowerCamelCase					):



    """simple docstring"""



    def __init__(  self:			Tuple     ,    UpperCamelCase:			Optional[Any]     ,    UpperCamelCase:			Optional[int]=None							):






         """simple docstring"""


         A__				      =	language
         A__				      =	train_language

    def 					UpperCamelCase						(  self:			Union[str, Any]     ,    UpperCamelCase:			str							):






         """simple docstring"""


         A__				      =	self.language if self.train_language is None else self.train_language
         A__				      =	self._read_tsv(os.path.join(UpperCamelCase     ,    f"""XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv"""							)							)
         A__				      =	[]
         for i, line in enumerate(UpperCamelCase							):
              if i == 0:
                   continue
              A__				      =	f"""train-{i}"""
              A__				      =	line[0]
              A__				      =	line[1]
              A__				      =	"""contradiction""" if line[2] == """contradictory""" else line[2]
              if not isinstance(UpperCamelCase     ,    UpperCamelCase							):
                   raise ValueError(f"""Training input {text_a} is not a string"""							)
              if not isinstance(UpperCamelCase     ,    UpperCamelCase							):
                   raise ValueError(f"""Training input {text_b} is not a string"""							)
              if not isinstance(UpperCamelCase     ,    UpperCamelCase							):
                   raise ValueError(f"""Training label {label} is not a string"""							)
              examples.append(InputExample(guid=UpperCamelCase     ,    text_a=UpperCamelCase     ,    text_b=UpperCamelCase     ,    label=UpperCamelCase							)							)
         return examples

    def 					UpperCamelCase						(  self:			Dict     ,    UpperCamelCase:			Union[str, Any]							):






         """simple docstring"""


         A__				      =	self._read_tsv(os.path.join(UpperCamelCase     ,    """XNLI-1.0/xnli.test.tsv"""							)							)
         A__				      =	[]
         for i, line in enumerate(UpperCamelCase							):
              if i == 0:
                   continue
              A__				      =	line[0]
              if language != self.language:
                   continue
              A__				      =	f"""test-{i}"""
              A__				      =	line[6]
              A__				      =	line[7]
              A__				      =	line[1]
              if not isinstance(UpperCamelCase     ,    UpperCamelCase							):
                   raise ValueError(f"""Training input {text_a} is not a string"""							)
              if not isinstance(UpperCamelCase     ,    UpperCamelCase							):
                   raise ValueError(f"""Training input {text_b} is not a string"""							)
              if not isinstance(UpperCamelCase     ,    UpperCamelCase							):
                   raise ValueError(f"""Training label {label} is not a string"""							)
              examples.append(InputExample(guid=UpperCamelCase     ,    text_a=UpperCamelCase     ,    text_b=UpperCamelCase     ,    label=UpperCamelCase							)							)
         return examples





    def 					UpperCamelCase						(  self:			Tuple							):






         """simple docstring"""


         return ["contradiction", "entailment", "neutral"]

SCREAMING_SNAKE_CASE_       :						int					=    {
    'xnli': XnliProcessor,
}

SCREAMING_SNAKE_CASE_       :						List[Any]					=    {
    'xnli': 'classification',
}

SCREAMING_SNAKE_CASE_       :						str					=    {
    'xnli': 3,
}






