






import math

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


__magic_name__:					str							=     logging.get_logger(__name__)

__magic_name__:					List[Any]							=     {
    "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 	snake_case__ (							_lowerCAmelCase				):
	lowercase__						:					int											=   '''data2vec-audio'''
	def __init__(    self      ,       lowerCAmelCase__=32      ,       lowerCAmelCase__=7_68      ,       lowerCAmelCase__=12      ,       lowerCAmelCase__=12      ,       lowerCAmelCase__=30_72      ,       lowerCAmelCase__="gelu"      ,       lowerCAmelCase__=0.1      ,       lowerCAmelCase__=0.1      ,       lowerCAmelCase__=0.1      ,       lowerCAmelCase__=0.0      ,       lowerCAmelCase__=0.1      ,       lowerCAmelCase__=0.1      ,       lowerCAmelCase__=0.0_2      ,       lowerCAmelCase__=1e-5      ,       lowerCAmelCase__="gelu"      ,       lowerCAmelCase__=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)      ,       lowerCAmelCase__=(5, 2, 2, 2, 2, 2, 2)      ,       lowerCAmelCase__=(10, 3, 3, 3, 3, 2, 2)      ,       lowerCAmelCase__=False      ,       lowerCAmelCase__=16      ,       lowerCAmelCase__=19      ,       lowerCAmelCase__=5      ,       lowerCAmelCase__=0.0_5      ,       lowerCAmelCase__=10      ,       lowerCAmelCase__=2      ,       lowerCAmelCase__=0.0      ,       lowerCAmelCase__=10      ,       lowerCAmelCase__=0      ,       lowerCAmelCase__="sum"      ,       lowerCAmelCase__=False      ,       lowerCAmelCase__=False      ,       lowerCAmelCase__=2_56      ,       lowerCAmelCase__=(5_12, 5_12, 5_12, 5_12, 15_00)      ,       lowerCAmelCase__=(5, 3, 3, 1, 1)      ,       lowerCAmelCase__=(1, 2, 3, 1, 1)      ,       lowerCAmelCase__=5_12      ,       lowerCAmelCase__=0      ,       lowerCAmelCase__=1      ,       lowerCAmelCase__=2      ,       lowerCAmelCase__=False      ,       lowerCAmelCase__=3      ,       lowerCAmelCase__=2      ,       lowerCAmelCase__=3      ,       lowerCAmelCase__=None      ,       **lowerCAmelCase__      ,       )							->				int:
							super().__init__(**lowerCAmelCase__      ,       pad_token_id=lowerCAmelCase__      ,       bos_token_id=lowerCAmelCase__      ,       eos_token_id=lowerCAmelCase__			)
							__magic_name__      :       Optional[Any]       						= hidden_size
							__magic_name__      :       List[str]       						= feat_extract_activation
							__magic_name__      :       List[str]       						= list(lowerCAmelCase__			)
							__magic_name__      :       List[Any]       						= list(lowerCAmelCase__			)
							__magic_name__      :       Optional[int]       						= list(lowerCAmelCase__			)
							__magic_name__      :       Dict       						= conv_bias
							__magic_name__      :       str       						= num_conv_pos_embeddings
							__magic_name__      :       List[Any]       						= num_conv_pos_embedding_groups
							__magic_name__      :       str       						= conv_pos_kernel_size
							__magic_name__      :       Dict       						= len(self.conv_dim			)
							__magic_name__      :       Optional[Any]       						= num_hidden_layers
							__magic_name__      :       Dict       						= intermediate_size
							__magic_name__      :       Tuple       						= hidden_act
							__magic_name__      :       Optional[int]       						= num_attention_heads
							__magic_name__      :       Tuple       						= hidden_dropout
							__magic_name__      :       List[str]       						= attention_dropout
							__magic_name__      :       List[str]       						= activation_dropout
							__magic_name__      :       List[str]       						= feat_proj_dropout
							__magic_name__      :       Dict       						= final_dropout
							__magic_name__      :       Optional[Any]       						= layerdrop
							__magic_name__      :       Optional[Any]       						= layer_norm_eps
							__magic_name__      :       int       						= initializer_range
							__magic_name__      :       Optional[Any]       						= vocab_size
							__magic_name__      :       Tuple       						= 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
							__magic_name__      :       Any       						= mask_time_prob
							__magic_name__      :       Dict       						= mask_time_length
							__magic_name__      :       List[Any]       						= mask_time_min_masks
							__magic_name__      :       int       						= mask_feature_prob
							__magic_name__      :       str       						= mask_feature_length
							__magic_name__      :       int       						= mask_feature_min_masks

							# ctc loss
							__magic_name__      :       Union[str, Any]       						= ctc_loss_reduction
							__magic_name__      :       Optional[int]       						= ctc_zero_infinity

							# adapter
							__magic_name__      :       int       						= add_adapter
							__magic_name__      :       Union[str, Any]       						= adapter_kernel_size
							__magic_name__      :       List[str]       						= adapter_stride
							__magic_name__      :       Tuple       						= num_adapter_layers
							__magic_name__      :       Dict       						= output_hidden_size or hidden_size

							# SequenceClassification-specific parameter. Feel free to ignore for other classes.
							__magic_name__      :       Any       						= classifier_proj_size

							# XVector-specific parameters. Feel free to ignore for other classes.
							__magic_name__      :       str       						= list(lowerCAmelCase__			)
							__magic_name__      :       Dict       						= list(lowerCAmelCase__			)
							__magic_name__      :       List[Any]       						= list(lowerCAmelCase__			)
							__magic_name__      :       List[str]       						= xvector_output_dim







	@property
	def       __magic_name__    (    self			)							->				List[Any]:
							return math.prod(self.conv_stride			)








import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
		from .tokenization_xlnet import XLNetTokenizer
else:
		__magic_name__:					Any							=     None


__magic_name__:					Dict							=     logging.get_logger(__name__)

__magic_name__:					Any							=     {"vocab_file": "spiece.model", "tokenizer_file": "tokenizer.json"}

__magic_name__:					str							=     {
    "vocab_file": {
        "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/spiece.model",
        "xlnet-large-cased": "https://huggingface.co/xlnet-large-cased/resolve/main/spiece.model",
    },
    "tokenizer_file": {
        "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/tokenizer.json",
        "xlnet-large-cased": "https://huggingface.co/xlnet-large-cased/resolve/main/tokenizer.json",
    },
}

__magic_name__:					Optional[Any]							=     {
    "xlnet-base-cased": None,
    "xlnet-large-cased": None,
}

__magic_name__:					Optional[Any]							=     "▁"

# Segments (not really needed)
__magic_name__:					List[Any]							=     0
__magic_name__:					Dict							=     1
__magic_name__:					List[str]							=     2
__magic_name__:					List[Any]							=     3
__magic_name__:					Optional[int]							=     4





class 	snake_case__ (							_lowerCAmelCase				):
	lowercase__						:					Dict											=   VOCAB_FILES_NAMES
	lowercase__						:					Union[str, Any]											=   PRETRAINED_VOCAB_FILES_MAP
	lowercase__						:					Tuple											=   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	lowercase__						:					List[str]											=   '''left'''
	lowercase__						:					List[str]											=   XLNetTokenizer
	def __init__(    self      ,       lowerCAmelCase__=None      ,       lowerCAmelCase__=None      ,       lowerCAmelCase__=False      ,       lowerCAmelCase__=True      ,       lowerCAmelCase__=False      ,       lowerCAmelCase__="<s>"      ,       lowerCAmelCase__="</s>"      ,       lowerCAmelCase__="<unk>"      ,       lowerCAmelCase__="<sep>"      ,       lowerCAmelCase__="<pad>"      ,       lowerCAmelCase__="<cls>"      ,       lowerCAmelCase__="<mask>"      ,       lowerCAmelCase__=["<eop>", "<eod>"]      ,       **lowerCAmelCase__      ,       )							->				Tuple:
							# Mask token behave like a normal word, i.e. include the space before it
							__magic_name__      :       Optional[int]       						= AddedToken(lowerCAmelCase__      ,       lstrip=lowerCAmelCase__      ,       rstrip=lowerCAmelCase__			) if isinstance(lowerCAmelCase__      ,       lowerCAmelCase__			) else mask_token

							super().__init__(
							    vocab_file=lowerCAmelCase__      ,       tokenizer_file=lowerCAmelCase__      ,       do_lower_case=lowerCAmelCase__      ,       remove_space=lowerCAmelCase__      ,       keep_accents=lowerCAmelCase__      ,       bos_token=lowerCAmelCase__      ,       eos_token=lowerCAmelCase__      ,       unk_token=lowerCAmelCase__      ,       sep_token=lowerCAmelCase__      ,       pad_token=lowerCAmelCase__      ,       cls_token=lowerCAmelCase__      ,       mask_token=lowerCAmelCase__      ,       additional_special_tokens=lowerCAmelCase__      ,       **lowerCAmelCase__      ,       )

							__magic_name__      :       List[str]       						= 3
							__magic_name__      :       str       						= do_lower_case
							__magic_name__      :       Union[str, Any]       						= remove_space
							__magic_name__      :       str       						= keep_accents
							__magic_name__      :       Tuple       						= vocab_file
							__magic_name__      :       List[Any]       						= False if not self.vocab_file else True
	def       __magic_name__    (    self      ,       lowerCAmelCase__      ,       lowerCAmelCase__ = None			)							->				List[int]:
							__magic_name__      :       Any       						= [self.sep_token_id]
							__magic_name__      :       Any       						= [self.cls_token_id]
							if token_ids_a is None:
													return token_ids_a + sep + cls
							return token_ids_a + sep + token_ids_a + sep + cls
	def       __magic_name__    (    self      ,       lowerCAmelCase__      ,       lowerCAmelCase__ = None			)							->				List[int]:
							__magic_name__      :       List[str]       						= [self.sep_token_id]
							__magic_name__      :       Optional[Any]       						= [2]

							if token_ids_a is None:
													return len(token_ids_a + sep			) * [0] + cls_segment_id
							return len(token_ids_a + sep			) * [0] + len(token_ids_a + sep			) * [1] + cls_segment_id







	def       __magic_name__    (    self      ,       lowerCAmelCase__      ,       lowerCAmelCase__ = None			)							->				Tuple[str]:
							if not self.can_save_slow_tokenizer:
													raise ValueError(
													    """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
													    """tokenizer."""			)

							if not os.path.isdir(lowerCAmelCase__			):
													logger.error(F'Vocabulary path ({save_directory}) should be a directory'			)
													return
							__magic_name__      :       List[str]       						= os.path.join(
							    lowerCAmelCase__      ,       (filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]			)

							if os.path.abspath(self.vocab_file			) != os.path.abspath(lowerCAmelCase__			):
													copyfile(self.vocab_file      ,       lowerCAmelCase__			)

							return (out_vocab_file,)
