import unittest

import numpy as np
import timeout_decorator  # noqa

from transformers import MarianConfig, is_flax_available
from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow
from transformers.utils import cached_property

from ...generation.test_flax_utils import FlaxGenerationTesterMixin
from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor


if is_flax_available():
    import os

    # The slow tests are often failing with OOM error on GPU
    # This makes JAX allocate exactly what is needed on demand, and deallocate memory that is no longer needed
    # but will be slower as stated here https://jax.readthedocs.io/en/latest/gpu_memory_allocation.html
    UpperCamelCase													=		'''platform'''

    import jax
    import jax.numpy as jnp

    from transformers import MarianTokenizer
    from transformers.models.marian.modeling_flax_marian import FlaxMarianModel, FlaxMarianMTModel, shift_tokens_right

def     lowercase_       (    _lowerCamelCase							: List[Any]	,			_lowerCamelCase							: List[Any]	,			_lowerCamelCase							: List[Any]=None	,			_lowerCamelCase							: Tuple=None	,			_lowerCamelCase							: Optional[Any]=None	,			_lowerCamelCase							: Tuple=None	,			_lowerCamelCase							: str=None	,			_lowerCamelCase							: Optional[Any]=None	,			):
    if attention_mask is None:
        lowercase__				:     Optional[Any]					      =       np.where(input_ids != config.pad_token_id	,			1	,			0)
    if decoder_attention_mask is None:
        lowercase__				:     int					      =       np.where(decoder_input_ids != config.pad_token_id	,			1	,			0)
    if head_mask is None:
        lowercase__				:     Any					      =       np.ones((config.encoder_layers, config.encoder_attention_heads))
    if decoder_head_mask is None:
        lowercase__				:     Dict					      =       np.ones((config.decoder_layers, config.decoder_attention_heads))
    if cross_attn_head_mask is None:
        lowercase__				:     List[str]					      =       np.ones((config.decoder_layers, config.decoder_attention_heads))
    return {
        "input_ids": input_ids,
        "decoder_input_ids": decoder_input_ids,
        "attention_mask": attention_mask,
        "decoder_attention_mask": attention_mask,
    }



class 						snake_case_ :






   def __init__(   self       :  Any			,		lowercase_       :  Any			,		lowercase_       :  Union[str, Any]=13			,		lowercase_       :  List[Any]=7			,		lowercase_       :  List[str]=True			,		lowercase_       :  Optional[Any]=False			,		lowercase_       :  str=99			,		lowercase_       :  Optional[int]=16			,		lowercase_       :  List[Any]=2			,		lowercase_       :  Tuple=4			,		lowercase_       :  Optional[Any]=4			,		lowercase_       :  Dict="gelu"			,		lowercase_       :  Optional[Any]=0.1			,		lowercase_       :  str=0.1			,		lowercase_       :  Union[str, Any]=32			,		lowercase_       :  Dict=2			,		lowercase_       :  List[str]=1			,		lowercase_       :  Optional[int]=0			,		lowercase_       :  Any=0.02			,		)      ->		Dict:
       lowercase__				:     Optional[Any]					      =       parent
       lowercase__				:     List[str]					      =       batch_size
       lowercase__				:     List[str]					      =       seq_length
       lowercase__				:     Dict					      =       is_training
       lowercase__				:     Optional[int]					      =       use_labels
       lowercase__				:     Dict					      =       vocab_size
       lowercase__				:     Tuple					      =       hidden_size
       lowercase__				:     Optional[int]					      =       num_hidden_layers
       lowercase__				:     List[Any]					      =       num_attention_heads
       lowercase__				:     Union[str, Any]					      =       intermediate_size
       lowercase__				:     List[Any]					      =       hidden_act
       lowercase__				:     Optional[int]					      =       hidden_dropout_prob
       lowercase__				:     str					      =       attention_probs_dropout_prob
       lowercase__				:     List[str]					      =       max_position_embeddings
       lowercase__				:     List[str]					      =       eos_token_id
       lowercase__				:     Optional[Any]					      =       pad_token_id
       lowercase__				:     Optional[int]					      =       bos_token_id
       lowercase__				:     List[str]					      =       initializer_range






   def    __UpperCamelCase  (   self       :  Any						)      ->		str:
       lowercase__				:     Tuple					      =       np.clip(ids_tensor([self.batch_size, self.seq_length - 1]			,		self.vocab_size						)			,		3			,		self.vocab_size						)
       lowercase__				:     Any					      =       np.concatenate((input_ids, 2 * np.ones((self.batch_size, 1)			,		dtype=np.intaa						))			,		-1						)

       lowercase__				:     Optional[int]					      =       shift_tokens_right(lowercase_			,		1			,		2						)

       lowercase__				:     str					      =       MarianConfig(
           vocab_size=self.vocab_size			,		d_model=self.hidden_size			,		encoder_layers=self.num_hidden_layers			,		decoder_layers=self.num_hidden_layers			,		encoder_attention_heads=self.num_attention_heads			,		decoder_attention_heads=self.num_attention_heads			,		encoder_ffn_dim=self.intermediate_size			,		decoder_ffn_dim=self.intermediate_size			,		dropout=self.hidden_dropout_prob			,		attention_dropout=self.attention_probs_dropout_prob			,		max_position_embeddings=self.max_position_embeddings			,		eos_token_id=self.eos_token_id			,		bos_token_id=self.bos_token_id			,		pad_token_id=self.pad_token_id			,		initializer_range=self.initializer_range			,		use_cache=lowercase_			,		)
       lowercase__				:     List[Any]					      =       prepare_marian_inputs_dict(lowercase_			,		lowercase_			,		lowercase_						)
       return config, inputs_dict






   def    __UpperCamelCase  (   self       :  int						)      ->		Union[str, Any]:
       lowercase__				:     int					      =       self.prepare_config_and_inputs()
       return config, inputs_dict






   def    __UpperCamelCase  (   self       :  Any			,		lowercase_       :  Union[str, Any]			,		lowercase_       :  List[Any]			,		lowercase_       :  int						)      ->		List[Any]:
       lowercase__				:     Any					      =       20
       lowercase__				:     str					      =       model_class_name(lowercase_						)

       lowercase__				:     Union[str, Any]					      =       model.encode(inputs_dict["input_ids"]						)

       lowercase__				:     Any					      =       (
           inputs_dict["decoder_input_ids"],
           inputs_dict["decoder_attention_mask"],
       )

       lowercase__				:     str					      =       model.init_cache(decoder_input_ids.shape[0]			,		lowercase_			,		lowercase_						)
       lowercase__				:     List[Any]					      =       jnp.ones((decoder_input_ids.shape[0], max_decoder_length)			,		dtype="i4"						)

       lowercase__				:     Optional[int]					      =       jnp.broadcast_to(
           jnp.arange(decoder_input_ids.shape[-1] - 1						)[None, :]			,		(decoder_input_ids.shape[0], decoder_input_ids.shape[-1] - 1)			,		)
       lowercase__				:     Any					      =       model.decode(
           decoder_input_ids[:, :-1]			,		lowercase_			,		decoder_attention_mask=lowercase_			,		past_key_values=lowercase_			,		decoder_position_ids=lowercase_			,		)

       lowercase__				:     Optional[int]					      =       jnp.array(decoder_input_ids.shape[0] * [[decoder_input_ids.shape[-1] - 1]]			,		dtype="i4"						)
       lowercase__				:     str					      =       model.decode(
           decoder_input_ids[:, -1:]			,		lowercase_			,		decoder_attention_mask=lowercase_			,		past_key_values=outputs_cache.past_key_values			,		decoder_position_ids=lowercase_			,		)

       lowercase__				:     Dict					      =       model.decode(lowercase_			,		lowercase_						)

       lowercase__				:     List[Any]					      =       np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])						)						)
       self.parent.assertTrue(diff < 1E-3			,		msg=F'''Max diff is {diff}'''						)







   def    __UpperCamelCase  (   self       :  List[Any]			,		lowercase_       :  List[str]			,		lowercase_       :  Tuple			,		lowercase_       :  str						)      ->		List[Any]:
       lowercase__				:     str					      =       20
       lowercase__				:     List[Any]					      =       model_class_name(lowercase_						)

       lowercase__				:     Any					      =       model.encode(inputs_dict["input_ids"]						)

       lowercase__				:     Union[str, Any]					      =       (
           inputs_dict["decoder_input_ids"],
           inputs_dict["decoder_attention_mask"],
       )

       lowercase__				:     Union[str, Any]					      =       jnp.concatenate(
           [
               decoder_attention_mask,
               jnp.zeros((decoder_attention_mask.shape[0], max_decoder_length - decoder_attention_mask.shape[1])						),
           ]			,		axis=-1			,		)

       lowercase__				:     Any					      =       model.init_cache(decoder_input_ids.shape[0]			,		lowercase_			,		lowercase_						)
       lowercase__				:     List[str]					      =       jnp.broadcast_to(
           jnp.arange(decoder_input_ids.shape[-1] - 1						)[None, :]			,		(decoder_input_ids.shape[0], decoder_input_ids.shape[-1] - 1)			,		)

       lowercase__				:     int					      =       model.decode(
           decoder_input_ids[:, :-1]			,		lowercase_			,		decoder_attention_mask=lowercase_			,		past_key_values=lowercase_			,		decoder_position_ids=lowercase_			,		)
       lowercase__				:     Dict					      =       jnp.array(decoder_input_ids.shape[0] * [[decoder_input_ids.shape[-1] - 1]]			,		dtype="i4"						)
       lowercase__				:     str					      =       model.decode(
           decoder_input_ids[:, -1:]			,		lowercase_			,		past_key_values=outputs_cache.past_key_values			,		decoder_attention_mask=lowercase_			,		decoder_position_ids=lowercase_			,		)

       lowercase__				:     Any					      =       model.decode(lowercase_			,		lowercase_			,		decoder_attention_mask=lowercase_						)

       lowercase__				:     str					      =       np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])						)						)
       self.parent.assertTrue(diff < 1E-3			,		msg=F'''Max diff is {diff}'''						)



@require_flax
class 						snake_case_ (	__A						,unittest.TestCase						,__A ):
   __A			:	List[str]        =       True
   __A			:	Optional[Any]        =       (FlaxMarianModel, FlaxMarianMTModel) if is_flax_available() else ()
   __A			:	Optional[int]        =       (FlaxMarianMTModel,) if is_flax_available() else ()






   def    __UpperCamelCase  (   self       :  Dict						)      ->		Union[str, Any]:
       lowercase__				:     Tuple					      =       FlaxMarianModelTester(self						)






   def    __UpperCamelCase  (   self       :  int						)      ->		str:
       lowercase__				:     int					      =       self.model_tester.prepare_config_and_inputs()
       for model_class in self.all_model_classes:
           self.model_tester.check_use_cache_forward(lowercase_			,		lowercase_			,		lowercase_						)






   def    __UpperCamelCase  (   self       :  Tuple						)      ->		str:
       lowercase__				:     Tuple					      =       self.model_tester.prepare_config_and_inputs()
       for model_class in self.all_model_classes:
           self.model_tester.check_use_cache_forward_with_attn_mask(lowercase_			,		lowercase_			,		lowercase_						)






   def    __UpperCamelCase  (   self       :  str						)      ->		int:
       lowercase__				:     int					      =       self.model_tester.prepare_config_and_inputs_for_common()

       for model_class in self.all_model_classes:
           with self.subTest(model_class.__name__						):
               lowercase__				:     Any					      =       self._prepare_for_class(lowercase_			,		lowercase_						)
               lowercase__				:     Any					      =       model_class(lowercase_						)

               @jax.jit
               def encode_jitted(lowercase_       :  str			,		lowercase_       :  str=None			,		**lowercase_       :  str						):
                   return model.encode(input_ids=lowercase_			,		attention_mask=lowercase_						)

               with self.subTest("JIT Enabled"						):
                   lowercase__				:     Optional[int]					      =       encode_jitted(**lowercase_						).to_tuple()

               with self.subTest("JIT Disabled"						):
                   with jax.disable_jit():
                       lowercase__				:     Any					      =       encode_jitted(**lowercase_						).to_tuple()

               self.assertEqual(len(lowercase_						)			,		len(lowercase_						)						)
               for jitted_output, output in zip(lowercase_			,		lowercase_						):
                   self.assertEqual(jitted_output.shape			,		output.shape						)






   def    __UpperCamelCase  (   self       :  Optional[int]						)      ->		Dict:
       lowercase__				:     Optional[int]					      =       self.model_tester.prepare_config_and_inputs_for_common()

       for model_class in self.all_model_classes:
           with self.subTest(model_class.__name__						):
               lowercase__				:     int					      =       model_class(lowercase_						)
               lowercase__				:     List[str]					      =       model.encode(inputs_dict["input_ids"]			,		inputs_dict["attention_mask"]						)

               lowercase__				:     Dict					      =       {
                   "decoder_input_ids": inputs_dict["decoder_input_ids"],
                   "decoder_attention_mask": inputs_dict["decoder_attention_mask"],
                   "encoder_outputs": encoder_outputs,
               }

               @jax.jit
               def decode_jitted(lowercase_       :  Union[str, Any]			,		lowercase_       :  Union[str, Any]			,		lowercase_       :  int						):
                   return model.decode(
                       decoder_input_ids=lowercase_			,		decoder_attention_mask=lowercase_			,		encoder_outputs=lowercase_			,		)

               with self.subTest("JIT Enabled"						):
                   lowercase__				:     Dict					      =       decode_jitted(**lowercase_						).to_tuple()

               with self.subTest("JIT Disabled"						):
                   with jax.disable_jit():
                       lowercase__				:     Tuple					      =       decode_jitted(**lowercase_						).to_tuple()

               self.assertEqual(len(lowercase_						)			,		len(lowercase_						)						)
               for jitted_output, output in zip(lowercase_			,		lowercase_						):
                   self.assertEqual(jitted_output.shape			,		output.shape						)







   @slow
   def    __UpperCamelCase  (   self       :  List[Any]						)      ->		Optional[int]:
       for model_class_name in self.all_model_classes:
           lowercase__				:     Tuple					      =       model_class_name.from_pretrained("Helsinki-NLP/opus-mt-en-de"						)
           # FlaxMarianForSequenceClassification expects eos token in input_ids
           lowercase__				:     Dict					      =       np.ones((1, 1)						) * model.config.eos_token_id
           lowercase__				:     Any					      =       model(lowercase_						)
           self.assertIsNotNone(lowercase_						)



@require_flax
@require_sentencepiece
@require_tokenizers
class 						snake_case_ (	unittest.TestCase ):
   __A			:	str        =       None
   __A			:	str        =       None






   @classmethod
   def    __UpperCamelCase  (   cls       :  int						)      ->		None:
       lowercase__				:     int					      =       F'''Helsinki-NLP/opus-mt-{cls.src}-{cls.tgt}'''
       return cls






   @cached_property
   def    __UpperCamelCase  (   self       :  Union[str, Any]						)      ->		Union[str, Any]:
       return MarianTokenizer.from_pretrained(self.model_name						)






   @property
   def    __UpperCamelCase  (   self       :  Tuple						)      ->		int:
       return self.tokenizer.eos_token_id






   @cached_property
   def    __UpperCamelCase  (   self       :  int						)      ->		int:
       lowercase__				:     FlaxMarianMTModel					      =       FlaxMarianMTModel.from_pretrained(self.model_name						)
       self.assertEqual(model.config.decoder_start_token_id			,		model.config.pad_token_id						)
       return model






   def    __UpperCamelCase  (   self       :  int			,		**lowercase_       :  int						)      ->		List[str]:
       lowercase__				:     Union[str, Any]					      =       self.translate_src_text(**lowercase_						)
       self.assertListEqual(self.expected_text			,		lowercase_						)







   def    __UpperCamelCase  (   self       :  Tuple			,		**lowercase_       :  Optional[Any]						)      ->		Optional[Any]:
       lowercase__				:     Optional[int]					      =       self.tokenizer(self.src_text			,		padding=lowercase_			,		return_tensors="np"			,		**lowercase_						)
       lowercase__				:     List[Any]					      =       self.model.generate(
           model_inputs.input_ids			,		attention_mask=model_inputs.attention_mask			,		num_beams=2			,		max_length=1_28			,		).sequences
       lowercase__				:     Tuple					      =       self.tokenizer.batch_decode(lowercase_			,		skip_special_tokens=lowercase_						)
       return generated_words



@require_flax
@require_sentencepiece
@require_tokenizers
class 						snake_case_ (	__A ):
   __A			:	Optional[Any]        =       "en"
   __A			:	Optional[int]        =       "fr"
   __A			:	int        =       [
       "I am a small frog.",
       "Now I can forget the 100 words of german that I know.",
   ]
   __A			:	Tuple        =       [
       "Je suis une petite grenouille.",
       "Maintenant, je peux oublier les 100 mots d'allemand que je connais.",
   ]






   @slow
   def    __UpperCamelCase  (   self       :  List[str]						)      ->		List[str]:
       self._assert_generated_batch_equal_expected()



@require_flax
@require_sentencepiece
@require_tokenizers
class 						snake_case_ (	__A ):
   __A			:	int        =       "fr"
   __A			:	str        =       "en"
   __A			:	int        =       [
       "Donnez moi le micro.",
       "Tom et Mary étaient assis à une table.",  # Accents
   ]
   __A			:	Any        =       [
       "Give me the microphone.",
       "Tom and Mary were sitting at a table.",
   ]






   @slow
   def    __UpperCamelCase  (   self       :  int						)      ->		Optional[Any]:
       self._assert_generated_batch_equal_expected()



@require_flax
@require_sentencepiece
@require_tokenizers
class 						snake_case_ (	__A ):
   __A			:	Optional[Any]        =       "mt"
   __A			:	str        =       "en"
   __A			:	Optional[Any]        =       ["Billi messu b'mod ġentili, Ġesù fejjaq raġel li kien milqut bil - marda kerha tal - ġdiem."]
   __A			:	str        =       ["Touching gently, Jesus healed a man who was affected by the sad disease of leprosy."]






   @slow
   def    __UpperCamelCase  (   self       :  Any						)      ->		Optional[Any]:
       self._assert_generated_batch_equal_expected()



@require_flax
@require_sentencepiece
@require_tokenizers
class 						snake_case_ (	__A ):
   __A			:	Dict        =       "en"
   __A			:	str        =       "de"
   __A			:	Tuple        =       [
       "I am a small frog.",
       "Now I can forget the 100 words of german that I know.",
       "Tom asked his teacher for advice.",
       "That's how I would do it.",
       "Tom really admired Mary's courage.",
       "Turn around and close your eyes.",
   ]
   __A			:	Optional[int]        =       [
       "Ich bin ein kleiner Frosch.",
       "Jetzt kann ich die 100 Wörter des Deutschen vergessen, die ich kenne.",
       "Tom bat seinen Lehrer um Rat.",
       "So würde ich das machen.",
       "Tom bewunderte Marias Mut wirklich.",
       "Drehen Sie sich um und schließen Sie die Augen.",
   ]






   @slow
   def    __UpperCamelCase  (   self       :  Tuple						)      ->		Any:
       self._assert_generated_batch_equal_expected()



@require_flax
@require_sentencepiece
@require_tokenizers
class 						snake_case_ (	__A ):
   __A			:	Optional[Any]        =       "en"
   __A			:	str        =       "zh"
   __A			:	Dict        =       ["My name is Wolfgang and I live in Berlin"]
   __A			:	int        =       ["我叫沃尔夫冈 我住在柏林"]






   @slow
   def    __UpperCamelCase  (   self       :  List[str]						)      ->		Union[str, Any]:
       self._assert_generated_batch_equal_expected()



@require_flax
@require_sentencepiece
@require_tokenizers
class 						snake_case_ (	__A ):
   __A			:	Optional[int]        =       "ru"
   __A			:	Any        =       "fr"
   __A			:	List[str]        =       ["Он показал мне рукопись своей новой пьесы."]
   __A			:	Optional[int]        =       ["Il m'a montré le manuscrit de sa nouvelle pièce."]






   @slow
   def    __UpperCamelCase  (   self       :  str						)      ->		List[Any]:
       self._assert_generated_batch_equal_expected()



@require_flax
@require_sentencepiece
@require_tokenizers
class 						snake_case_ (	__A ):
   __A			:	int        =       "en"
   __A			:	Optional[Any]        =       "ROMANCE"
   __A			:	str        =       [
       ">>fr<< Don't spend so much time watching TV.",
       ">>pt<< Your message has been sent.",
       ">>es<< He's two years older than me.",
   ]
   __A			:	Any        =       [
       "Ne passez pas autant de temps à regarder la télé.",
       "A sua mensagem foi enviada.",
       "Es dos años más viejo que yo.",
   ]






   @slow
   def    __UpperCamelCase  (   self       :  Tuple						)      ->		Union[str, Any]:
       self._assert_generated_batch_equal_expected()




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


UpperCamelCase													=		logging.get_logger(__name__)

UpperCamelCase													=		{
    '''apple/mobilevit-small''': '''https://huggingface.co/apple/mobilevit-small/resolve/main/config.json''',
    '''apple/mobilevit-x-small''': '''https://huggingface.co/apple/mobilevit-x-small/resolve/main/config.json''',
    '''apple/mobilevit-xx-small''': '''https://huggingface.co/apple/mobilevit-xx-small/resolve/main/config.json''',
    '''apple/deeplabv3-mobilevit-small''': (
        '''https://huggingface.co/apple/deeplabv3-mobilevit-small/resolve/main/config.json'''
    ),
    '''apple/deeplabv3-mobilevit-x-small''': (
        '''https://huggingface.co/apple/deeplabv3-mobilevit-x-small/resolve/main/config.json'''
    ),
    '''apple/deeplabv3-mobilevit-xx-small''': (
        '''https://huggingface.co/apple/deeplabv3-mobilevit-xx-small/resolve/main/config.json'''
    ),
    # See all MobileViT models at https://huggingface.co/models?filter=mobilevit
}



class 						snake_case_ (	__A ):
   __A			:	Any        =       "mobilevit"






   def __init__(   self       :  Union[str, Any]			,		lowercase_       :  List[Any]=3			,		lowercase_       :  List[Any]=2_56			,		lowercase_       :  Union[str, Any]=2			,		lowercase_       :  int=[1_44, 1_92, 2_40]			,		lowercase_       :  List[str]=[16, 32, 64, 96, 1_28, 1_60, 6_40]			,		lowercase_       :  Tuple=4			,		lowercase_       :  Optional[int]=2.0			,		lowercase_       :  int=4.0			,		lowercase_       :  str="silu"			,		lowercase_       :  Optional[Any]=3			,		lowercase_       :  Dict=32			,		lowercase_       :  Union[str, Any]=0.1			,		lowercase_       :  str=0.0			,		lowercase_       :  str=0.1			,		lowercase_       :  List[str]=0.02			,		lowercase_       :  Union[str, Any]=1E-5			,		lowercase_       :  Tuple=True			,		lowercase_       :  Optional[Any]=2_56			,		lowercase_       :  List[str]=[6, 12, 18]			,		lowercase_       :  Any=0.1			,		lowercase_       :  List[str]=2_55			,		**lowercase_       :  Tuple			,		)      ->		Optional[Any]:
       super().__init__(**lowercase_						)

       lowercase__				:     List[str]					      =       num_channels
       lowercase__				:     Optional[int]					      =       image_size
       lowercase__				:     Any					      =       patch_size
       lowercase__				:     int					      =       hidden_sizes
       lowercase__				:     str					      =       neck_hidden_sizes
       lowercase__				:     Optional[int]					      =       num_attention_heads
       lowercase__				:     Tuple					      =       mlp_ratio
       lowercase__				:     Tuple					      =       expand_ratio
       lowercase__				:     List[str]					      =       hidden_act
       lowercase__				:     Optional[int]					      =       conv_kernel_size
       lowercase__				:     Union[str, Any]					      =       output_stride
       lowercase__				:     Optional[int]					      =       hidden_dropout_prob
       lowercase__				:     List[str]					      =       attention_probs_dropout_prob
       lowercase__				:     Union[str, Any]					      =       classifier_dropout_prob
       lowercase__				:     Union[str, Any]					      =       initializer_range
       lowercase__				:     List[str]					      =       layer_norm_eps
       lowercase__				:     Dict					      =       qkv_bias

       # decode head attributes for semantic segmentation
       lowercase__				:     List[Any]					      =       aspp_out_channels
       lowercase__				:     List[Any]					      =       atrous_rates
       lowercase__				:     str					      =       aspp_dropout_prob
       lowercase__				:     int					      =       semantic_loss_ignore_index



class 						snake_case_ (	__A ):
   __A			:	int        =       version.parse("1.11" )






   @property
   def    __UpperCamelCase  (   self       :  Union[str, Any]						)      ->		Mapping[str, Mapping[int, str]]:
       return OrderedDict([("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"})]						)






   @property
   def    __UpperCamelCase  (   self       :  str						)      ->		Mapping[str, Mapping[int, str]]:
       if self.task == "image-classification":
           return OrderedDict([("logits", {0: "batch"})]						)
       else:
           return OrderedDict([("last_hidden_state", {0: "batch"}), ("pooler_output", {0: "batch"})]						)







   @property
   def    __UpperCamelCase  (   self       :  Union[str, Any]						)      ->		float:
       return 1E-4



