



'''simple docstring'''







import functools
import operator

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


SCREAMING_SNAKE_CASE__     : str				=   logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__     : str				=   {
    """facebook/hubert-base-ls960""": """https://huggingface.co/facebook/hubert-base-ls960/resolve/main/config.json""",
    # See all Hubert models at https://huggingface.co/models?filter=hubert
}




class 				__lowerCAmelCase(							lowercase_      ):
			__snake_case  :		Union[str, Any]		=      'hubert'






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




					"""simple docstring"""







					super().__init__(**snake_case__      ,       pad_token_id=snake_case__      ,       bos_token_id=snake_case__      ,       eos_token_id=snake_case__	)
					SCREAMING_SNAKE_CASE_						:List[Any]										=      hidden_size
					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      feat_extract_norm
					SCREAMING_SNAKE_CASE_						:List[str]										=      feat_extract_activation
					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      list(snake_case__	)
					SCREAMING_SNAKE_CASE_						:Dict										=      list(snake_case__	)
					SCREAMING_SNAKE_CASE_						:int										=      list(snake_case__	)
					SCREAMING_SNAKE_CASE_						:List[Any]										=      conv_bias
					SCREAMING_SNAKE_CASE_						:List[str]										=      num_conv_pos_embeddings
					SCREAMING_SNAKE_CASE_						:List[Any]										=      num_conv_pos_embedding_groups
					SCREAMING_SNAKE_CASE_						:Tuple										=      len(self.conv_dim	)
					SCREAMING_SNAKE_CASE_						:str										=      num_hidden_layers
					SCREAMING_SNAKE_CASE_						:Optional[int]										=      intermediate_size
					SCREAMING_SNAKE_CASE_						:str										=      hidden_act
					SCREAMING_SNAKE_CASE_						:List[str]										=      num_attention_heads
					SCREAMING_SNAKE_CASE_						:Dict										=      hidden_dropout
					SCREAMING_SNAKE_CASE_						:int										=      attention_dropout
					SCREAMING_SNAKE_CASE_						:List[str]										=      activation_dropout
					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      feat_proj_layer_norm
					SCREAMING_SNAKE_CASE_						:int										=      feat_proj_dropout
					SCREAMING_SNAKE_CASE_						:Tuple										=      final_dropout
					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      layerdrop
					SCREAMING_SNAKE_CASE_						:Dict										=      layer_norm_eps
					SCREAMING_SNAKE_CASE_						:List[str]										=      initializer_range
					SCREAMING_SNAKE_CASE_						:List[Any]										=      vocab_size
					SCREAMING_SNAKE_CASE_						:List[str]										=      do_stable_layer_norm
					SCREAMING_SNAKE_CASE_						:List[str]										=      use_weighted_layer_sum
					SCREAMING_SNAKE_CASE_						:int										=      classifier_proj_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)`, 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
					SCREAMING_SNAKE_CASE_						:Any										=      apply_spec_augment
					SCREAMING_SNAKE_CASE_						:str										=      mask_time_prob
					SCREAMING_SNAKE_CASE_						:List[str]										=      mask_time_length
					SCREAMING_SNAKE_CASE_						:int										=      mask_time_min_masks
					SCREAMING_SNAKE_CASE_						:List[Any]										=      mask_feature_prob
					SCREAMING_SNAKE_CASE_						:str										=      mask_feature_length
					SCREAMING_SNAKE_CASE_						:Dict										=      mask_feature_min_masks

					# ctc loss
					SCREAMING_SNAKE_CASE_						:Dict										=      ctc_loss_reduction
					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      ctc_zero_infinity






			@property
			def 				_lowercase	(   self  :							int	):




					"""simple docstring"""







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








import json

import requests

from .fetch_github_info import AUTHENTICATED_USER_ENDPOINT, fetch_github_info
def 							UpperCAmelCase   ( _lowercase   ):


    '''simple docstring'''



    class        snake_case_				:







       """simple docstring"""



       def __init__(     self:						Tuple ,							snake_case__:						Optional[int]						)	->		None:


           """simple docstring"""



           assert isinstance(snake_case__ ,							(bytes, str)						)
           _lowercase     			=						content

       def       SCREAMING_SNAKE_CASE__					(     self:						Tuple						)	->		str:


           """simple docstring"""



           return json.loads(self.content						)

    def mock_response(*_lowercase,   **_lowercase   ):
        assert args[0] == AUTHENTICATED_USER_ENDPOINT
        assert "Authorization" in kwargs["headers"]
        assert kwargs["headers"]["Authorization"].startswith('token '   )
        assert "Accept" in kwargs["headers"]
        return FakeResponse(b'{"login":"test","id":1}'   )

    monkeypatch.setattr(_lowercase,   'get',   _lowercase   )
    _lowercase     			=						fetch_github_info('token'   )
    assert result["login"] == "test"
    assert result["id"] == 1
