



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


a__			=		logging.get_logger(__name__)

a__			=		{
    """facebook/s2t-wav2vec2-large-en-de""": (
        """https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json"""
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech2text2
}







class 						snake_case  (		__a     ):



   '''simple docstring'''






   snake_case_    :       Any								=						"""speech_to_text_2"""
   snake_case_    :       Any								=						["""past_key_values"""]
   snake_case_    :       Tuple								=						{"""num_attention_heads""": """decoder_attention_heads""", """hidden_size""": """d_model"""}

   def __init__(    self							:	List[str] ,						lowerCAmelCase							:	str=1_0000 ,						lowerCAmelCase							:	str=6 ,						lowerCAmelCase							:	List[Any]=2048 ,						lowerCAmelCase							:	Optional[int]=4 ,						lowerCAmelCase							:	List[str]=0.0 ,						lowerCAmelCase							:	Optional[int]=True ,						lowerCAmelCase							:	List[str]="relu" ,						lowerCAmelCase							:	Optional[Any]=256 ,						lowerCAmelCase							:	Any=0.1 ,						lowerCAmelCase							:	List[str]=0.0 ,						lowerCAmelCase							:	Optional[int]=0.0 ,						lowerCAmelCase							:	Optional[Any]=0.02 ,						lowerCAmelCase							:	Union[str, Any]=2 ,						lowerCAmelCase							:	List[str]=True ,						lowerCAmelCase							:	Optional[Any]=1 ,						lowerCAmelCase							:	Dict=0 ,						lowerCAmelCase							:	Dict=2 ,						lowerCAmelCase							:	Optional[int]=1024 ,						**lowerCAmelCase							:	Any ,						) -> List[str]:

    """simple docstring"""







    _snake_case			:     Union[str, Any] 		=    vocab_size
    _snake_case			:     str 		=    d_model
    _snake_case			:     Tuple 		=    decoder_ffn_dim
    _snake_case			:     Optional[int] 		=    decoder_layers
    _snake_case			:     Optional[Any] 		=    decoder_attention_heads
    _snake_case			:     Union[str, Any] 		=    dropout
    _snake_case			:     List[str] 		=    attention_dropout
    _snake_case			:     str 		=    activation_dropout
    _snake_case			:     Union[str, Any] 		=    activation_function
    _snake_case			:     List[str] 		=    init_std
    _snake_case			:     int 		=    decoder_layerdrop
    _snake_case			:     int 		=    use_cache
    _snake_case			:     str 		=    decoder_layers
    _snake_case			:     Tuple 		=    scale_embedding  # scale factor will be sqrt(d_model) if True
    _snake_case			:     int 		=    max_target_positions

    super().__init__(
        pad_token_id=a_ ,						bos_token_id=a_ ,						eos_token_id=a_ ,						decoder_start_token_id=a_ ,						**a_ ,						)






"""simple docstring"""


import os
import zipfile

import requests
from get_ci_error_statistics import download_artifact, get_artifacts_links


def 					UpperCAmelCase__       (snake_case__							:					Optional[int]		,   snake_case__							:					Any=7    ):
  """simple docstring"""

  _snake_case							:		Any								=  None
  if token is not None:
    _snake_case							:		Any								=  {"""Accept""": """application/vnd.github+json""", """Authorization""": F"Bearer {token}"}

  # The id of a workflow (not of a workflow run)
  _snake_case							:		List[str]								=  """636036"""

  _snake_case							:		Union[str, Any]								=  F"https://api.github.com/repos/huggingface/transformers/actions/workflows/{workflow_id}/runs"
  # On `main` branch + event being `schedule` + not returning PRs + only `num_runs` results
  url += F"?branch=main&event=schedule&exclude_pull_requests=true&per_page={num_runs}"

  _snake_case							:		str								=  requests.get(snake_case__		,   headers=snake_case__    ).json()

  return result["workflow_runs"]


def 					UpperCAmelCase__       (snake_case__							:					Optional[Any]    ):
  """simple docstring"""

  _snake_case							:		str								=  get_daily_ci_runs(snake_case__    )
  _snake_case							:		str								=  None
  for workflow_run in workflow_runs:
    if workflow_run["status"] == "completed":
      _snake_case							:		List[str]								=  workflow_run["""id"""]
      break

  return workflow_run_id


def 					UpperCAmelCase__       (snake_case__							:					str		,   snake_case__							:					Union[str, Any]		,   snake_case__							:					Optional[int]    ):
  """simple docstring"""

  _snake_case							:		Optional[Any]								=  get_last_daily_ci_runs(snake_case__    )
  if workflow_run_id is not None:
    _snake_case							:		Optional[Any]								=  get_artifacts_links(worflow_run_id=snake_case__		,   token=snake_case__    )
    for artifact_name in artifact_names:
      if artifact_name in artifacts_links:
        _snake_case							:		Optional[int]								=  artifacts_links[artifact_name]
        download_artifact(
            artifact_name=snake_case__		,   artifact_url=snake_case__		,   output_dir=snake_case__		,   token=snake_case__    )






def 					UpperCAmelCase__       (snake_case__							:					Union[str, Any]		,   snake_case__							:					List[str]		,   snake_case__							:					int    ):
  """simple docstring"""

  get_last_daily_ci_artifacts(snake_case__		,   snake_case__		,   snake_case__    )

  _snake_case							:		int								=  {}
  for artifact_name in artifact_names:
    _snake_case							:		int								=  os.path.join(snake_case__		,   F"{artifact_name}.zip"    )
    if os.path.isfile(snake_case__    ):
      _snake_case							:		Tuple								=  {}
      with zipfile.ZipFile(snake_case__    ) as z:
        for filename in z.namelist():
          if not os.path.isdir(snake_case__    ):
            # read the file
            with z.open(snake_case__    ) as f:
              _snake_case							:		Any								=  f.read().decode("""UTF-8"""    )

  return results


