


from collections import OrderedDict
from typing import Mapping

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


A      = logging.get_logger(__name__)

A      = {
    "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased/resolve/main/config.json",
    "distilbert-base-uncased-distilled-squad": (
        "https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/config.json"
    ),
    "distilbert-base-cased": "https://huggingface.co/distilbert-base-cased/resolve/main/config.json",
    "distilbert-base-cased-distilled-squad": (
        "https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/config.json"
    ),
    "distilbert-base-german-cased": "https://huggingface.co/distilbert-base-german-cased/resolve/main/config.json",
    "distilbert-base-multilingual-cased": (
        "https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/config.json"
    ),
    "distilbert-base-uncased-finetuned-sst-2-english": (
        "https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json"
    ),
}


class     lowercase__  (					__SCREAMING_SNAKE_CASE		):
  A__=  'distilbert'
  A__=  {
      'hidden_size': 'dim',
      'num_attention_heads': 'n_heads',
      'num_hidden_layers': 'n_layers',
  }






  def __init__(					self      :					List[str]		,						_lowercase      :					List[Any]=3_05_22		,						_lowercase      :					str=5_12		,						_lowercase      :					Union[str, Any]=False		,						_lowercase      :					List[Any]=6		,						_lowercase      :					Union[str, Any]=12		,						_lowercase      :					List[Any]=7_68		,						_lowercase      :					str=4 * 7_68		,						_lowercase      :					Union[str, Any]=0.1		,						_lowercase      :					Union[str, Any]=0.1		,						_lowercase      :					List[str]="gelu"		,						_lowercase      :					str=0.0_2		,						_lowercase      :					Dict=0.1		,						_lowercase      :					Any=0.2		,						_lowercase      :					Any=0		,						**_lowercase      :					Dict		,						):




         """simple docstring"""







         UpperCAmelCase__										=     vocab_size
         UpperCAmelCase__										=     max_position_embeddings
         UpperCAmelCase__										=     sinusoidal_pos_embds
         UpperCAmelCase__										=     n_layers
         UpperCAmelCase__										=     n_heads
         UpperCAmelCase__										=     dim
         UpperCAmelCase__										=     hidden_dim
         UpperCAmelCase__										=     dropout
         UpperCAmelCase__										=     attention_dropout
         UpperCAmelCase__										=     activation
         UpperCAmelCase__										=     initializer_range
         UpperCAmelCase__										=     qa_dropout
         UpperCAmelCase__										=     seq_classif_dropout
         super().__init__(**_lowercase		,						pad_token_id=_lowercase )




class     lowercase__  (					__SCREAMING_SNAKE_CASE		):






  @property
  def 			_UpperCAmelCase  (					self      :					List[str] ):




         """simple docstring"""







         if self.task == "multiple-choice":
                UpperCAmelCase__										=     {0: "batch", 1: "choice", 2: "sequence"}
         else:
                UpperCAmelCase__										=     {0: "batch", 1: "sequence"}
         return OrderedDict(
             [
                 ("input_ids", dynamic_axis),
                 ("attention_mask", dynamic_axis),
             ] )









from .imports import is_tqdm_available


if is_tqdm_available():
    from tqdm.auto import tqdm as _tqdm

from ..state import PartialState





def __UpperCAmelCase       (		__A = True ,						*__A ,						**__A			)						->					Any:



       '''simple docstring'''





       if not is_tqdm_available():
              raise ImportError("Accelerate's `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`."			)
       UpperCAmelCase__										=     False
       if main_process_only:
              UpperCAmelCase__										=     PartialState().local_process_index == 0
       return _tqdm(*__A ,						**__A ,						disable=__A			)





