


'''simple docstring'''




import functools
import operator

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


__lowercase	:   str   		=					logging.get_logger(__name__)

__lowercase	:   Any   		=					{
    "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 (			_SCREAMING_SNAKE_CASE ):
							"""simple docstring"""





							__a				       =  "hubert"







							def __init__( self      ,					__A=32      ,					__A=768      ,					__A=12      ,					__A=12      ,					__A=3072      ,					__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=(512, 512, 512, 512, 512, 512, 512)      ,					__A=(5, 2, 2, 2, 2, 2, 2)      ,					__A=(10, 3, 3, 3, 3, 2, 2)      ,					__A=False      ,					__A=128      ,					__A=16      ,					__A=False      ,					__A=True      ,					__A=0.05      ,					__A=10      ,					__A=2      ,					__A=0.0      ,					__A=10      ,					__A=0      ,					__A="sum"      ,					__A=False      ,					__A=False      ,					__A=256      ,					__A=0      ,					__A=1      ,					__A=2      ,					**__A      ,					)  ->Optional[Any]:



											"""simple docstring"""







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

											# ctc loss
											__lowerCamelCase		:   Tuple           =       ctc_loss_reduction
											__lowerCamelCase		:   Tuple           =       ctc_zero_infinity







							@property
							def 		__SCREAMING_SNAKE_CASE( self						)  ->int:



											"""simple docstring"""







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







def  A			(   lowercase					)  ->    int:
		'''simple docstring'''

		barcode //= 10  # exclude the last digit
		UpperCamelCase            =	False
		UpperCamelCase            =	0

		# extract and check each digit
		while barcode != 0:
				UpperCamelCase            =	1 if checker else 3
				s += mult * (barcode % 10)
				barcode //= 10
				UpperCamelCase            =	not checker

		return (10 - (s % 10)) % 10


def  A			(   lowercase					)  ->    bool:
		'''simple docstring'''

		return len(str(lowercase					)					) == 13 and get_check_digit(lowercase					) == barcode % 10


def  A			(   lowercase					)  ->    int:
		'''simple docstring'''

		if str(lowercase					).isalpha():
				UpperCamelCase            =	f'''Barcode \'{barcode}\' has alphabetic characters.'''
				raise ValueError(lowercase					)
		elif int(lowercase					) < 0:
				raise ValueError('The entered barcode has a negative value. Try again.'					)
		else:
				return int(lowercase					)


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					_UpperCAmelCase   :					List[str]    =			get_barcode(input("Barcode: ").strip())

					if is_valid(barcode):
										print(F'''\'{barcode}\' is a valid barcode.''')
					else:
										print(F'''\'{barcode}\' is NOT a valid barcode.''')
