






"""simple docstring"""
import functools
import operator

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


snake_case : str     		=		logging.get_logger(__name__)

snake_case : int     		=		{
    """asapp/sew-d-tiny-100k""": """https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json""",
    # See all SEW-D models at https://huggingface.co/models?filter=sew-d
}



class        UpperCamelCase__ (				a_):







    """simple docstring"""
    __UpperCAmelCase           = """sew-d"""







    def __init__(		self :	Optional[int]				,    UpperCamelCase_ :	List[Any]=3_2				,    UpperCamelCase_ :	Dict=7_6_8				,    UpperCamelCase_ :	List[str]=1_2				,    UpperCamelCase_ :	int=1_2				,    UpperCamelCase_ :	int=3_0_7_2				,    UpperCamelCase_ :	List[Any]=2				,    UpperCamelCase_ :	Any=5_1_2				,    UpperCamelCase_ :	Optional[Any]=2_5_6				,    UpperCamelCase_ :	Optional[Any]=True				,    UpperCamelCase_ :	Optional[Any]=True				,    UpperCamelCase_ :	int=("p2c", "c2p")				,    UpperCamelCase_ :	List[Any]="layer_norm"				,    UpperCamelCase_ :	Optional[Any]="gelu_python"				,    UpperCamelCase_ :	Tuple=0.1				,    UpperCamelCase_ :	List[Any]=0.1				,    UpperCamelCase_ :	Union[str, Any]=0.1				,    UpperCamelCase_ :	Dict=0.0				,    UpperCamelCase_ :	int=0.1				,    UpperCamelCase_ :	Dict=0.02				,    UpperCamelCase_ :	int=1e-7				,    UpperCamelCase_ :	Tuple=1e-5				,    UpperCamelCase_ :	Dict="group"				,    UpperCamelCase_ :	Tuple="gelu"				,    UpperCamelCase_ :	Any=(6_4, 1_2_8, 1_2_8, 1_2_8, 1_2_8, 2_5_6, 2_5_6, 2_5_6, 2_5_6, 5_1_2, 5_1_2, 5_1_2, 5_1_2)				,    UpperCamelCase_ :	int=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)				,    UpperCamelCase_ :	Dict=(1_0, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)				,    UpperCamelCase_ :	Optional[int]=False				,    UpperCamelCase_ :	List[Any]=1_2_8				,    UpperCamelCase_ :	Any=1_6				,    UpperCamelCase_ :	Optional[Any]=True				,    UpperCamelCase_ :	Tuple=0.05				,    UpperCamelCase_ :	List[str]=1_0				,    UpperCamelCase_ :	List[Any]=2				,    UpperCamelCase_ :	Optional[int]=0.0				,    UpperCamelCase_ :	Any=1_0				,    UpperCamelCase_ :	Optional[Any]=0				,    UpperCamelCase_ :	Optional[Any]="mean"				,    UpperCamelCase_ :	Any=False				,    UpperCamelCase_ :	List[str]=False				,    UpperCamelCase_ :	List[Any]=2_5_6				,    UpperCamelCase_ :	Optional[Any]=0				,    UpperCamelCase_ :	Tuple=1				,    UpperCamelCase_ :	List[str]=2				,    **UpperCamelCase_ :	Optional[Any]				,    ):





           '''simple docstring'''

           super().__init__(**UpperCamelCase_				,    pad_token_id=UpperCamelCase_				,    bos_token_id=UpperCamelCase_				,    eos_token_id=UpperCamelCase_ )
           __magic_name__      				=    hidden_size
           __magic_name__      				=    feat_extract_norm
           __magic_name__      				=    feat_extract_activation
           __magic_name__      				=    list(UpperCamelCase_ )
           __magic_name__      				=    list(UpperCamelCase_ )
           __magic_name__      				=    list(UpperCamelCase_ )
           __magic_name__      				=    conv_bias
           __magic_name__      				=    num_conv_pos_embeddings
           __magic_name__      				=    num_conv_pos_embedding_groups
           __magic_name__      				=    len(self.conv_dim )
           __magic_name__      				=    num_hidden_layers
           __magic_name__      				=    intermediate_size
           __magic_name__      				=    squeeze_factor
           __magic_name__      				=    max_position_embeddings
           __magic_name__      				=    position_buckets
           __magic_name__      				=    share_att_key
           __magic_name__      				=    relative_attention
           __magic_name__      				=    norm_rel_ebd
           __magic_name__      				=    list(UpperCamelCase_ )
           __magic_name__      				=    hidden_act
           __magic_name__      				=    num_attention_heads
           __magic_name__      				=    hidden_dropout
           __magic_name__      				=    attention_dropout
           __magic_name__      				=    activation_dropout
           __magic_name__      				=    feat_proj_dropout
           __magic_name__      				=    final_dropout
           __magic_name__      				=    layer_norm_eps
           __magic_name__      				=    feature_layer_norm_eps
           __magic_name__      				=    initializer_range
           __magic_name__      				=    vocab_size

           if (
               (len(self.conv_stride ) != self.num_feat_extract_layers)
               or (len(self.conv_kernel ) != self.num_feat_extract_layers)
               or (len(self.conv_dim ) != self.num_feat_extract_layers)
           ):
                  raise ValueError(
                      'Configuration for convolutional layers is incorrect.'
                      'It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`,'
                      f"""but is `len(config.conv_dim) = {len(self.conv_dim )}`, `len(config.conv_stride)"""
                      f"""= {len(self.conv_stride )}`, `len(config.conv_kernel) = {len(self.conv_kernel )}`.""" )

           # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
           __magic_name__      				=    apply_spec_augment
           __magic_name__      				=    mask_time_prob
           __magic_name__      				=    mask_time_length
           __magic_name__      				=    mask_time_min_masks
           __magic_name__      				=    mask_feature_prob
           __magic_name__      				=    mask_feature_length
           __magic_name__      				=    mask_feature_min_masks

           # ctc loss
           __magic_name__      				=    ctc_loss_reduction
           __magic_name__      				=    ctc_zero_infinity

           # sequence classification
           __magic_name__      				=    use_weighted_layer_sum
           __magic_name__      				=    classifier_proj_size







    @property
    def 				a__			(		self :	Union[str, Any] ):





           '''simple docstring'''

           return functools.reduce(operator.mul				,    self.conv_stride				,    1 )







"""simple docstring"""
import os
import tempfile
import unittest

from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter
from transformers.testing_utils import slow
from transformers.utils import cached_property



@unittest.skipUnless(os.path.exists(a_)							,	"""Tatoeba directory does not exist.""")
class        UpperCamelCase__ (				unittest.TestCase):







    """simple docstring"""







    @cached_property
    def 				a__			(		self :	int ):





           '''simple docstring'''

           __magic_name__      				=    tempfile.mkdtemp()
           return TatoebaConverter(save_dir=UpperCamelCase_ )







    @slow
    def 				a__			(		self :	List[str] ):





           '''simple docstring'''

           self.resolver.convert_models(['heb-eng'] )







    @slow
    def 				a__			(		self :	Tuple ):





           '''simple docstring'''

           __magic_name__				,  __magic_name__      				=    self.resolver.write_model_card('opus-mt-he-en'				,    dry_run=UpperCamelCase_ )
           assert mmeta["long_pair"] == "heb-eng"