



"""simple docstring"""




import math

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


__snake_case						:Any						=					logging.get_logger(__name__)

__snake_case						:int						=					{
    '''facebook/data2vec-base-960h''': '''https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json''',
    # See all Data2VecAudio models at https://huggingface.co/models?filter=data2vec-audio
}

class    _A	(     lowercase__   ):
       UpperCamelCase__  :   List[Any]						 =						'''data2vec-audio'''



       def __init__(		self							:					str					,		__SCREAMING_SNAKE_CASE							:					Optional[Any]=32					,		__SCREAMING_SNAKE_CASE							:					Tuple=768					,		__SCREAMING_SNAKE_CASE							:					List[Any]=12					,		__SCREAMING_SNAKE_CASE							:					int=12					,		__SCREAMING_SNAKE_CASE							:					Union[str, Any]=3_072					,		__SCREAMING_SNAKE_CASE							:					Tuple="gelu"					,		__SCREAMING_SNAKE_CASE							:					Dict=0.1					,		__SCREAMING_SNAKE_CASE							:					Tuple=0.1					,		__SCREAMING_SNAKE_CASE							:					Dict=0.1					,		__SCREAMING_SNAKE_CASE							:					str=0.0					,		__SCREAMING_SNAKE_CASE							:					Union[str, Any]=0.1					,		__SCREAMING_SNAKE_CASE							:					List[Any]=0.1					,		__SCREAMING_SNAKE_CASE							:					Tuple=0.02					,		__SCREAMING_SNAKE_CASE							:					int=1E-5					,		__SCREAMING_SNAKE_CASE							:					Union[str, Any]="gelu"					,		__SCREAMING_SNAKE_CASE							:					List[Any]=(512, 512, 512, 512, 512, 512, 512)					,		__SCREAMING_SNAKE_CASE							:					Optional[int]=(5, 2, 2, 2, 2, 2, 2)					,		__SCREAMING_SNAKE_CASE							:					Union[str, Any]=(10, 3, 3, 3, 3, 2, 2)					,		__SCREAMING_SNAKE_CASE							:					int=False					,		__SCREAMING_SNAKE_CASE							:					Optional[int]=16					,		__SCREAMING_SNAKE_CASE							:					Optional[Any]=19					,		__SCREAMING_SNAKE_CASE							:					str=5					,		__SCREAMING_SNAKE_CASE							:					List[Any]=0.05					,		__SCREAMING_SNAKE_CASE							:					Dict=10					,		__SCREAMING_SNAKE_CASE							:					Optional[int]=2					,		__SCREAMING_SNAKE_CASE							:					Tuple=0.0					,		__SCREAMING_SNAKE_CASE							:					Tuple=10					,		__SCREAMING_SNAKE_CASE							:					Optional[int]=0					,		__SCREAMING_SNAKE_CASE							:					Optional[int]="sum"					,		__SCREAMING_SNAKE_CASE							:					str=False					,		__SCREAMING_SNAKE_CASE							:					Union[str, Any]=False					,		__SCREAMING_SNAKE_CASE							:					Dict=256					,		__SCREAMING_SNAKE_CASE							:					Any=(512, 512, 512, 512, 1_500)					,		__SCREAMING_SNAKE_CASE							:					Any=(5, 3, 3, 1, 1)					,		__SCREAMING_SNAKE_CASE							:					Dict=(1, 2, 3, 1, 1)					,		__SCREAMING_SNAKE_CASE							:					Tuple=512					,		__SCREAMING_SNAKE_CASE							:					Optional[int]=0					,		__SCREAMING_SNAKE_CASE							:					Tuple=1					,		__SCREAMING_SNAKE_CASE							:					int=2					,		__SCREAMING_SNAKE_CASE							:					Optional[Any]=False					,		__SCREAMING_SNAKE_CASE							:					List[str]=3					,		__SCREAMING_SNAKE_CASE							:					int=2					,		__SCREAMING_SNAKE_CASE							:					Union[str, Any]=3					,		__SCREAMING_SNAKE_CASE							:					Optional[Any]=None					,		**__SCREAMING_SNAKE_CASE							:					Tuple					,		):


           '''simple docstring'''

           super().__init__(**_a					,		pad_token_id=_a					,		bos_token_id=_a					,		eos_token_id=_a)
           __a							=    hidden_size
           __a							=    feat_extract_activation
           __a							=    list(_a)
           __a							=    list(_a)
           __a							=    list(_a)
           __a							=    conv_bias
           __a							=    num_conv_pos_embeddings
           __a							=    num_conv_pos_embedding_groups
           __a							=    conv_pos_kernel_size
           __a							=    len(self.conv_dim)
           __a							=    num_hidden_layers
           __a							=    intermediate_size
           __a							=    hidden_act
           __a							=    num_attention_heads
           __a							=    hidden_dropout
           __a							=    attention_dropout
           __a							=    activation_dropout
           __a							=    feat_proj_dropout
           __a							=    final_dropout
           __a							=    layerdrop
           __a							=    layer_norm_eps
           __a							=    initializer_range
           __a							=    vocab_size
           __a							=    use_weighted_layer_sum

           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)`, but is `len(config.conv_dim) ='''
                   F' {len(self.conv_dim)}`, `len(config.conv_stride) = {len(self.conv_stride)}`,'
                   F' `len(config.conv_kernel) = {len(self.conv_kernel)}`.')

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

           # ctc loss
           __a							=    ctc_loss_reduction
           __a							=    ctc_zero_infinity

           # adapter
           __a							=    add_adapter
           __a							=    adapter_kernel_size
           __a							=    adapter_stride
           __a							=    num_adapter_layers
           __a							=    output_hidden_size or hidden_size

           # SequenceClassification-specific parameter. Feel free to ignore for other classes.
           __a							=    classifier_proj_size

           # XVector-specific parameters. Feel free to ignore for other classes.
           __a							=    list(_a)
           __a							=    list(_a)
           __a							=    list(_a)
           __a							=    xvector_output_dim





       @property
       def 		_lowerCamelCase      (		self							:					Optional[Any]):


           '''simple docstring'''

           return math.prod(self.conv_stride)










import unittest

from transformers import DonutProcessor


__snake_case						:List[str]						=					'''naver-clova-ix/donut-base'''

class    _A	(     unittest.TestCase   ):



       def 		_lowerCamelCase      (		self							:					List[str]):


           '''simple docstring'''

           __a							=    DonutProcessor.from_pretrained(__SCREAMING_SNAKE_CASE)





       def 		_lowerCamelCase      (		self							:					Tuple):


           '''simple docstring'''

           __a							=    {
               '''name''': '''John Doe''',
               '''age''': '''99''',
               '''city''': '''Atlanta''',
               '''state''': '''GA''',
               '''zip''': '''30301''',
               '''phone''': '''123-4567''',
               '''nicknames''': [{'''nickname''': '''Johnny'''}, {'''nickname''': '''JD'''}],
           }

           __a							=    (
               '''<s_name>John Doe</s_name><s_age>99</s_age><s_city>Atlanta</s_city>'''
               '''<s_state>GA</s_state><s_zip>30301</s_zip><s_phone>123-4567</s_phone>'''
               '''<s_nicknames><s_nickname>Johnny</s_nickname>'''
               '''<sep/><s_nickname>JD</s_nickname></s_nicknames>'''
           )
           __a							=    self.processor.tokenajson(__SCREAMING_SNAKE_CASE)

           self.assertDictEqual(__SCREAMING_SNAKE_CASE					,		__SCREAMING_SNAKE_CASE)





