

import functools
import operator

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


lowerCamelCase   					=  logging.get_logger(__name__)

lowerCamelCase   					=  {
    "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      snake_case_      (					_a				):


							"""simple docstring"""





							__UpperCAmelCase      ="""hubert"""




							def __init__(			self       ,    _A=3_2       ,    _A=7_6_8       ,    _A=1_2       ,    _A=1_2       ,    _A=3_0_7_2       ,    _A="gelu"       ,    _A=0.1       ,    _A=0.1       ,    _A=0.1       ,    _A=True       ,    _A=0.0       ,    _A=0.1       ,    _A=0.1       ,    _A=0.02       ,    _A=1e-5       ,    _A="group"       ,    _A="gelu"       ,    _A=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)       ,    _A=(5, 2, 2, 2, 2, 2, 2)       ,    _A=(1_0, 3, 3, 3, 3, 2, 2)       ,    _A=False       ,    _A=1_2_8       ,    _A=1_6       ,    _A=False       ,    _A=True       ,    _A=0.05       ,    _A=1_0       ,    _A=2       ,    _A=0.0       ,    _A=1_0       ,    _A=0       ,    _A="sum"       ,    _A=False       ,    _A=False       ,    _A=2_5_6       ,    _A=0       ,    _A=1       ,    _A=2       ,    **_A       ,    ):
												super().__init__(**lowerCamelCase_       ,    pad_token_id=lowerCamelCase_       ,    bos_token_id=lowerCamelCase_       ,    eos_token_id=lowerCamelCase_				)
												__lowerCAmelCase       =				hidden_size
												__lowerCAmelCase       =				feat_extract_norm
												__lowerCAmelCase       =				feat_extract_activation
												__lowerCAmelCase       =				list(lowerCamelCase_				)
												__lowerCAmelCase       =				list(lowerCamelCase_				)
												__lowerCAmelCase       =				list(lowerCamelCase_				)
												__lowerCAmelCase       =				conv_bias
												__lowerCAmelCase       =				num_conv_pos_embeddings
												__lowerCAmelCase       =				num_conv_pos_embedding_groups
												__lowerCAmelCase       =				len(self.conv_dim				)
												__lowerCAmelCase       =				num_hidden_layers
												__lowerCAmelCase       =				intermediate_size
												__lowerCAmelCase       =				hidden_act
												__lowerCAmelCase       =				num_attention_heads
												__lowerCAmelCase       =				hidden_dropout
												__lowerCAmelCase       =				attention_dropout
												__lowerCAmelCase       =				activation_dropout
												__lowerCAmelCase       =				feat_proj_layer_norm
												__lowerCAmelCase       =				feat_proj_dropout
												__lowerCAmelCase       =				final_dropout
												__lowerCAmelCase       =				layerdrop
												__lowerCAmelCase       =				layer_norm_eps
												__lowerCAmelCase       =				initializer_range
												__lowerCAmelCase       =				vocab_size
												__lowerCAmelCase       =				do_stable_layer_norm
												__lowerCAmelCase       =				use_weighted_layer_sum
												__lowerCAmelCase       =				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
												__lowerCAmelCase       =				apply_spec_augment
												__lowerCAmelCase       =				mask_time_prob
												__lowerCAmelCase       =				mask_time_length
												__lowerCAmelCase       =				mask_time_min_masks
												__lowerCAmelCase       =				mask_feature_prob
												__lowerCAmelCase       =				mask_feature_length
												__lowerCAmelCase       =				mask_feature_min_masks

												# ctc loss
												__lowerCAmelCase       =				ctc_loss_reduction
												__lowerCAmelCase       =				ctc_zero_infinity




							@property
							def 							A__	(			self				):
												return functools.reduce(operator.mul       ,    self.conv_stride       ,    1				)











from typing import Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_openai import OpenAIGPTTokenizer


_lowercase:					List[str]      =						logging.get_logger(__name__)

_lowercase:					str      =						{"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"}

_lowercase:					Union[str, Any]      =						{
    "vocab_file": {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/vocab.json"},
    "merges_file": {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/merges.txt"},
    "tokenizer_file": {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/tokenizer.json"},
}

_lowercase:					int      =						{
    "openai-gpt": 512,
}



class       _lowercase				(  lowerCAmelCase      ):





	"""simple docstring"""
	__A		      =				VOCAB_FILES_NAMES
	__A		      =				PRETRAINED_VOCAB_FILES_MAP
	__A		      =				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	__A		      =				["input_ids", "attention_mask"]
	__A		      =				OpenAIGPTTokenizer




	def __init__(self						,			lowerCamelCase_=None						,			lowerCamelCase_=None						,			lowerCamelCase_=None						,			lowerCamelCase_="<unk>"						,			**lowerCamelCase_						):
						"""simple docstring"""

						super().__init__(lowerCamelCase_						,			lowerCamelCase_						,			tokenizer_file=lowerCamelCase_						,			unk_token=lowerCamelCase_						,			**lowerCamelCase_						)




	@property
	def 	UpperCamelCase_			(self						):
						"""simple docstring"""

						return True




	def 	UpperCamelCase_			(self						,			lowerCamelCase_						,			lowerCamelCase_ = None						):
						"""simple docstring"""

						a   	=  self._tokenizer.model.save(lowerCamelCase_						,			name=lowerCamelCase_						)
						return tuple(lowerCamelCase_						)
