



'''simple docstring'''



import functools
import operator

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


lowerCAmelCase_     :       str								=						logging.get_logger(__name__)

lowerCAmelCase_     :       Any								=						{
    'microsoft/unispeech-large-1500h-cv': (
        'https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json'
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}
class 	lowerCamelCase_							(					snake_case_			):
						_lowerCAmelCase     :   Union[str, Any]	     =				'unispeech'







						def __init__(  self   :      str				,    lowerCAmelCase__   :      Optional[Any]=32				,    lowerCAmelCase__   :      Dict=7_68				,    lowerCAmelCase__   :      List[Any]=12				,    lowerCAmelCase__   :      Tuple=12				,    lowerCAmelCase__   :      List[str]=30_72				,    lowerCAmelCase__   :      str="gelu"				,    lowerCAmelCase__   :      List[Any]=0.1				,    lowerCAmelCase__   :      Optional[int]=0.1				,    lowerCAmelCase__   :      Optional[Any]=0.1				,    lowerCAmelCase__   :      Any=0.0				,    lowerCAmelCase__   :      List[Any]=0.0				,    lowerCAmelCase__   :      int=0.1				,    lowerCAmelCase__   :      List[str]=0.1				,    lowerCAmelCase__   :      Any=0.02				,    lowerCAmelCase__   :      Tuple=1e-5				,    lowerCAmelCase__   :      str="group"				,    lowerCAmelCase__   :      Optional[int]="gelu"				,    lowerCAmelCase__   :      Optional[Any]=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)				,    lowerCAmelCase__   :      str=(5, 2, 2, 2, 2, 2, 2)				,    lowerCAmelCase__   :      Dict=(10, 3, 3, 3, 3, 2, 2)				,    lowerCAmelCase__   :      Any=False				,    lowerCAmelCase__   :      Optional[Any]=1_28				,    lowerCAmelCase__   :      List[Any]=16				,    lowerCAmelCase__   :      int=False				,    lowerCAmelCase__   :      int=True				,    lowerCAmelCase__   :      Optional[int]=0.05				,    lowerCAmelCase__   :      int=10				,    lowerCAmelCase__   :      List[str]=2				,    lowerCAmelCase__   :      str=0.0				,    lowerCAmelCase__   :      Tuple=10				,    lowerCAmelCase__   :      Union[str, Any]=0				,    lowerCAmelCase__   :      List[Any]=3_20				,    lowerCAmelCase__   :      Optional[int]=2				,    lowerCAmelCase__   :      str=0.1				,    lowerCAmelCase__   :      Dict=1_00				,    lowerCAmelCase__   :      Tuple=2_56				,    lowerCAmelCase__   :      int=2_56				,    lowerCAmelCase__   :      int=0.1				,    lowerCAmelCase__   :      List[str]="mean"				,    lowerCAmelCase__   :      List[Any]=False				,    lowerCAmelCase__   :      Dict=False				,    lowerCAmelCase__   :      int=2_56				,    lowerCAmelCase__   :      Optional[Any]=80				,    lowerCAmelCase__   :      Union[str, Any]=0				,    lowerCAmelCase__   :      List[Any]=1				,    lowerCAmelCase__   :      Any=2				,    lowerCAmelCase__   :      List[str]=0.5				,    **lowerCAmelCase__   :      List[Any]				,    ):

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

													# parameters for pretraining with codevector quantized representations
													SCREAMING_SNAKE_CASE					:      Dict     					=			num_codevectors_per_group
													SCREAMING_SNAKE_CASE					:      Union[str, Any]     					=			num_codevector_groups
													SCREAMING_SNAKE_CASE					:      str     					=			contrastive_logits_temperature
													SCREAMING_SNAKE_CASE					:      Any     					=			feat_quantizer_dropout
													SCREAMING_SNAKE_CASE					:      Tuple     					=			num_negatives
													SCREAMING_SNAKE_CASE					:      Optional[Any]     					=			codevector_dim
													SCREAMING_SNAKE_CASE					:      int     					=			proj_codevector_dim
													SCREAMING_SNAKE_CASE					:      Union[str, Any]     					=			diversity_loss_weight

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

													# pretraining loss
													SCREAMING_SNAKE_CASE					:      Union[str, Any]     					=			replace_prob







						@property
						def 					__lowercase    (  self   :      Dict				):

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









'''simple docstring'''



from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
							if not (is_transformers_available() and is_torch_available()):
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							from ...utils.dummy_torch_and_transformers_objects import (
							    ImageTextPipelineOutput,
							    UniDiffuserPipeline,
							)
else:
							from .modeling_text_decoder import UniDiffuserTextDecoder
							from .modeling_uvit import UniDiffuserModel, UTransformeraDModel
							from .pipeline_unidiffuser import ImageTextPipelineOutput, UniDiffuserPipeline




