





"""simple docstring"""


from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast
from ...utils import logging


if TYPE_CHECKING:
  from ...feature_extraction_utils import FeatureExtractionMixin
  from ...tokenization_utils_base import PreTrainedTokenizerBase
  from ...utils import TensorType

lowerCamelCase__				  =   logging.get_logger(__name__)

lowerCamelCase__				  =   {
    "openai/whisper-base": "https://huggingface.co/openai/whisper-base/resolve/main/config.json",
}

# fmt: off
lowerCamelCase__				  =   [
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 357, 366, 438, 532, 685,
    705, 796, 930, 1058, 1220, 1267, 1279, 1303, 1343, 1377,
    1391, 1635, 1782, 1875, 2162, 2361, 2488, 3467, 4008, 4211,
    4600, 4808, 5299, 5855, 6329, 7203, 9609, 9959, 1_0563, 1_0786,
    1_1420, 1_1709, 1_1907, 1_3163, 1_3697, 1_3700, 1_4808, 1_5306, 1_6410, 1_6791,
    1_7992, 1_9203, 1_9510, 2_0724, 2_2305, 2_2935, 2_7007, 3_0109, 3_0420, 3_3409,
    3_4949, 4_0283, 4_0493, 4_0549, 4_7282, 4_9146, 5_0257, 5_0359, 5_0360, 5_0361
]
lowerCamelCase__				  =   [
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 359, 503, 522, 542, 873,
    893, 902, 918, 922, 931, 1350, 1853, 1982, 2460, 2627,
    3246, 3253, 3268, 3536, 3846, 3961, 4183, 4667, 6585, 6647,
    7273, 9061, 9383, 1_0428, 1_0929, 1_1938, 1_2033, 1_2331, 1_2562, 1_3793,
    1_4157, 1_4635, 1_5265, 1_5618, 1_6553, 1_6604, 1_8362, 1_8956, 2_0075, 2_1675,
    2_2520, 2_6130, 2_6161, 2_6435, 2_8279, 2_9464, 3_1650, 3_2302, 3_2470, 3_6865,
    4_2863, 4_7425, 4_9870, 5_0254, 5_0258, 5_0360, 5_0361, 5_0362
]



class      __SCREAMING_SNAKE_CASE    (						_UpperCamelCase   ):







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:List[Any]	     =					"whisper"
  SCREAMING_SNAKE_CASE__							:Dict	     =					["past_key_values"]
  SCREAMING_SNAKE_CASE__							:List[Any]	     =					{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}

  def __init__(		self   :       Optional[Any]					,   __a   :       Dict=5_1865					,   __a   :       Tuple=80					,   __a   :       Optional[Any]=6					,   __a   :       List[Any]=4					,   __a   :       Any=6					,   __a   :       Tuple=4					,   __a   :       List[str]=1536					,   __a   :       str=1536					,   __a   :       Any=0.0					,   __a   :       List[str]=0.0					,   __a   :       Dict=5_0257					,   __a   :       str=True					,   __a   :       Optional[Any]=True					,   __a   :       Optional[Any]="gelu"					,   __a   :       Optional[int]=256					,   __a   :       List[Any]=0.0					,   __a   :       Dict=0.0					,   __a   :       List[Any]=0.0					,   __a   :       int=0.02					,   __a   :       Optional[Any]=False					,   __a   :       Optional[Any]=1500					,   __a   :       List[str]=448					,   __a   :       Union[str, Any]=5_0256					,   __a   :       List[str]=5_0256					,   __a   :       Any=5_0256					,   __a   :       str=None					,   __a   :       List[Any]=[220, 5_0256]					,   __a   :       int=False					,   __a   :       str=256					,   __a   :       Any=False					,   __a   :       Optional[Any]=0.05					,   __a   :       Union[str, Any]=10					,   __a   :       int=2					,   __a   :       int=0.0					,   __a   :       Optional[int]=10					,   __a   :       str=0					,   __a   :       Any=7					,   **__a   :       Tuple					,   )		->				Tuple:
        _UpperCamelCase      :	Tuple						=       vocab_size
        _UpperCamelCase      :	List[Any]						=       num_mel_bins
        _UpperCamelCase      :	Union[str, Any]						=       d_model
        _UpperCamelCase      :	Tuple						=       encoder_layers
        _UpperCamelCase      :	Any						=       encoder_attention_heads
        _UpperCamelCase      :	List[Any]						=       decoder_layers
        _UpperCamelCase      :	int						=       decoder_attention_heads
        _UpperCamelCase      :	Dict						=       decoder_ffn_dim
        _UpperCamelCase      :	Tuple						=       encoder_ffn_dim
        _UpperCamelCase      :	Tuple						=       dropout
        _UpperCamelCase      :	Union[str, Any]						=       attention_dropout
        _UpperCamelCase      :	int						=       activation_dropout
        _UpperCamelCase      :	int						=       activation_function
        _UpperCamelCase      :	str						=       init_std
        _UpperCamelCase      :	List[Any]						=       encoder_layerdrop
        _UpperCamelCase      :	Tuple						=       decoder_layerdrop
        _UpperCamelCase      :	List[Any]						=       use_cache
        _UpperCamelCase      :	List[str]						=       encoder_layers
        _UpperCamelCase      :	Union[str, Any]						=       scale_embedding  # scale factor will be sqrt(d_model) if True
        _UpperCamelCase      :	Dict						=       max_source_positions
        _UpperCamelCase      :	Dict						=       max_target_positions

        # Audio Classification-specific parameters. Feel free to ignore for other classes.
        _UpperCamelCase      :	Union[str, Any]						=       classifier_proj_size
        _UpperCamelCase      :	List[str]						=       use_weighted_layer_sum

        # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
        _UpperCamelCase      :	Tuple						=       apply_spec_augment
        _UpperCamelCase      :	List[Any]						=       mask_time_prob
        _UpperCamelCase      :	List[Any]						=       mask_time_length
        _UpperCamelCase      :	Tuple						=       mask_time_min_masks
        _UpperCamelCase      :	List[Any]						=       mask_feature_prob
        _UpperCamelCase      :	str						=       mask_feature_length
        _UpperCamelCase      :	int						=       mask_feature_min_masks

        _UpperCamelCase      :	Union[str, Any]						=       median_filter_width

        super().__init__(
            pad_token_id=__a					,   bos_token_id=__a					,   eos_token_id=__a					,   is_encoder_decoder=__a					,   decoder_start_token_id=__a					,   suppress_tokens=__a					,   begin_suppress_tokens=__a					,   **__a					,   )





class      __SCREAMING_SNAKE_CASE    (						_UpperCamelCase   ):







  '''simple docstring'''


  @property
  def    __SCREAMING_SNAKE_CASE				(		self   :       Optional[int]	)		->				Mapping[str, Mapping[int, str]]:
        _UpperCamelCase      :	int						=       OrderedDict(
            [
                ("input_features", {0: "batch", 1: "feature_size", 2: "encoder_sequence"}),
            ]	)
        if self.use_past:
              _UpperCamelCase      :	Union[str, Any]						=       {0: "batch"}
        else:
              _UpperCamelCase      :	Optional[int]						=       {0: "batch", 1: "decoder_sequence"}

        if self.use_past:
              self.fill_with_past_key_values_(__a					,   direction="inputs"	)

        return common_inputs

  def    __SCREAMING_SNAKE_CASE				(		self   :       Dict					,   __a   :       Union["PreTrainedTokenizerBase", "FeatureExtractionMixin"]					,   __a   :       int = -1					,   __a   :       int = -1					,   __a   :       bool = False					,   __a   :       Optional["TensorType"] = None					,   __a   :       int = 2_2050					,   __a   :       float = 5.0					,   __a   :       int = 220					,   )		->				Mapping[str, Any]:
        _UpperCamelCase      :	str						=       OrderedDict()
        _UpperCamelCase      :	str						=       OnnxConfig.generate_dummy_inputs(
            self					,   preprocessor=preprocessor.feature_extractor					,   batch_size=__a					,   framework=__a					,   sampling_rate=__a					,   time_duration=__a					,   frequency=__a					,   )
        _UpperCamelCase      :	List[str]						=       encoder_inputs["input_features"].shape[2]
        _UpperCamelCase      :	Union[str, Any]						=       encoder_sequence_length // 2 if self.use_past else seq_length

        _UpperCamelCase      :	Dict						=       super().generate_dummy_inputs(
            preprocessor.tokenizer					,   __a					,   __a					,   __a					,   __a	)

        _UpperCamelCase      :	int						=       encoder_inputs.pop("input_features"	)
        _UpperCamelCase      :	List[Any]						=       decoder_inputs.pop("decoder_input_ids"	)

        if "past_key_values" in decoder_inputs:
              _UpperCamelCase      :	Optional[int]						=       decoder_inputs.pop("past_key_values"	)

        return dummy_inputs


  @property
  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				float:
        return 1e-3












"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


lowerCamelCase__				  =   {
    "configuration_owlvit": [
        "OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "OwlViTConfig",
        "OwlViTOnnxConfig",
        "OwlViTTextConfig",
        "OwlViTVisionConfig",
    ],
    "processing_owlvit": ["OwlViTProcessor"],
}


try:
  if not is_vision_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowerCamelCase__				  =   ["OwlViTFeatureExtractor"]
  lowerCamelCase__				  =   ["OwlViTImageProcessor"]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowerCamelCase__				  =   [
      "OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST",
      "OwlViTModel",
      "OwlViTPreTrainedModel",
      "OwlViTTextModel",
      "OwlViTVisionModel",
      "OwlViTForObjectDetection",
  ]

if TYPE_CHECKING:
  from .configuration_owlvit import (
      OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP,
      OwlViTConfig,
      OwlViTOnnxConfig,
      OwlViTTextConfig,
      OwlViTVisionConfig,
  )
  from .processing_owlvit import OwlViTProcessor

  try:
    if not is_vision_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .feature_extraction_owlvit import OwlViTFeatureExtractor
    from .image_processing_owlvit import OwlViTImageProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_owlvit import (
        OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
        OwlViTForObjectDetection,
        OwlViTModel,
        OwlViTPreTrainedModel,
        OwlViTTextModel,
        OwlViTVisionModel,
    )

else:
  import sys

  lowerCamelCase__				  =   _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
