


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 A						(     a_  ):
						UpperCamelCase__							:						str   ='hubert'






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




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

													# ctc loss
													_lowerCamelCase :	Any						=ctc_loss_reduction
													_lowerCamelCase :	Any						=ctc_zero_infinity






						@property
						def  lowerCamelCase (      self		:  Optional[Any]				)      ->		Tuple:
													"""simple docstring"""




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






from dataclasses import dataclass
from typing import List, Optional, Union

import numpy as np
import PIL
from PIL import Image

from ...utils import is_torch_available, is_transformers_available


if is_transformers_available() and is_torch_available():
 from .image_encoder import PaintByExampleImageEncoder
 from .pipeline_paint_by_example import PaintByExamplePipeline


