

"""simple docstring"""



from ...configuration_utils import PretrainedConfig
from ...utils import logging


SCREAMING_SNAKE_CASE_       :						Optional[Any]					=    logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_       :						str					=    {
    'ZinengTang/tvlt-base': 'https://huggingface.co/ZinengTang/tvlt-base/blob/main/config.json',
}



class        a    (							_lowerCamelCase					):



    """simple docstring"""



    UpperCAmelCase    			=       "tvlt"

    def __init__(  self:			str     ,    UpperCamelCase:			Tuple=2_24     ,    UpperCamelCase:			Union[str, Any]=20_48     ,    UpperCamelCase:			str=1_28     ,    UpperCamelCase:			Any=[16, 16]     ,    UpperCamelCase:			Optional[int]=[16, 16]     ,    UpperCamelCase:			str=3     ,    UpperCamelCase:			int=1     ,    UpperCamelCase:			int=8     ,    UpperCamelCase:			List[Any]=7_68     ,    UpperCamelCase:			Optional[int]=12     ,    UpperCamelCase:			Union[str, Any]=12     ,    UpperCamelCase:			Optional[int]=30_72     ,    UpperCamelCase:			Tuple="gelu"     ,    UpperCamelCase:			Any=0.0     ,    UpperCamelCase:			int=0.0     ,    UpperCamelCase:			List[str]=0.02     ,    UpperCamelCase:			str=1e-6     ,    UpperCamelCase:			Union[str, Any]=True     ,    UpperCamelCase:			Any=False     ,    UpperCamelCase:			str=16     ,    UpperCamelCase:			Dict=5_12     ,    UpperCamelCase:			str=8     ,    UpperCamelCase:			Dict=20_48     ,    UpperCamelCase:			List[Any]=0.75     ,    UpperCamelCase:			str=0.15     ,    UpperCamelCase:			Union[str, Any]="frame-level"     ,    UpperCamelCase:			Any=True     ,    UpperCamelCase:			int=True     ,    UpperCamelCase:			List[str]="classification"     ,    **UpperCamelCase:			Optional[int]     ,    ):






         """simple docstring"""


         super().__init__(**UpperCamelCase							)

         if audio_mask_type not in ("frame-level", "patch_level"):
              raise ValueError(
                  """audio_mask_type must be one of two acceptable strategies - {'frame_level', 'patch-level') """
                  f"""got {audio_mask_type}"""							)

         A__				      =	image_size
         A__				      =	spectrogram_length
         A__				      =	frequency_length
         A__				      =	image_patch_size
         A__				      =	audio_patch_size
         A__				      =	num_image_channels
         A__				      =	num_audio_channels
         A__				      =	num_frames

         A__				      =	hidden_size
         A__				      =	num_hidden_layers
         A__				      =	num_attention_heads
         A__				      =	intermediate_size
         A__				      =	hidden_act
         A__				      =	hidden_dropout_prob
         A__				      =	attention_probs_dropout_prob
         A__				      =	initializer_range
         A__				      =	layer_norm_eps
         A__				      =	qkv_bias
         A__				      =	use_mean_pooling

         A__				      =	decoder_num_attention_heads
         A__				      =	decoder_hidden_size
         A__				      =	decoder_num_hidden_layers
         A__				      =	decoder_intermediate_size
         A__				      =	pixel_mask_ratio
         A__				      =	audio_mask_ratio
         A__				      =	audio_mask_type

         A__				      =	task_matching
         A__				      =	task_mae
         A__				      =	loss_type









"""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,
}






