
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging


A__   :		str 		=logging.get_logger(__name__)

A__   :		Optional[Any] 		={
    'funnel-transformer/small': 'https://huggingface.co/funnel-transformer/small/resolve/main/config.json',
    'funnel-transformer/small-base': 'https://huggingface.co/funnel-transformer/small-base/resolve/main/config.json',
    'funnel-transformer/medium': 'https://huggingface.co/funnel-transformer/medium/resolve/main/config.json',
    'funnel-transformer/medium-base': 'https://huggingface.co/funnel-transformer/medium-base/resolve/main/config.json',
    'funnel-transformer/intermediate': (
        'https://huggingface.co/funnel-transformer/intermediate/resolve/main/config.json'
    ),
    'funnel-transformer/intermediate-base': (
        'https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/config.json'
    ),
    'funnel-transformer/large': 'https://huggingface.co/funnel-transformer/large/resolve/main/config.json',
    'funnel-transformer/large-base': 'https://huggingface.co/funnel-transformer/large-base/resolve/main/config.json',
    'funnel-transformer/xlarge': 'https://huggingface.co/funnel-transformer/xlarge/resolve/main/config.json',
    'funnel-transformer/xlarge-base': 'https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/config.json',
}







class  __A				( _SCREAMING_SNAKE_CASE			):
 lowerCamelCase				       ='''funnel'''
 lowerCamelCase				       ={
     '''hidden_size''': '''d_model''',
     '''num_attention_heads''': '''n_head''',
 }
 def __init__(   self			:    int				,   lowerCamelCase			:    Tuple=3_05_22				,   lowerCamelCase			:    str=[4, 4, 4]				,   lowerCamelCase			:    Any=None				,   lowerCamelCase			:    Tuple=2				,   lowerCamelCase			:    int=7_68				,   lowerCamelCase			:    Union[str, Any]=12				,   lowerCamelCase			:    Optional[Any]=64				,   lowerCamelCase			:    List[str]=30_72				,   lowerCamelCase			:    int="gelu_new"				,   lowerCamelCase			:    List[str]=0.1				,   lowerCamelCase			:    List[Any]=0.1				,   lowerCamelCase			:    Optional[Any]=0.0				,   lowerCamelCase			:    int=0.1				,   lowerCamelCase			:    Dict=None				,   lowerCamelCase			:    str=1e-9				,   lowerCamelCase			:    Tuple="mean"				,   lowerCamelCase			:    Optional[int]="relative_shift"				,   lowerCamelCase			:    Dict=True				,   lowerCamelCase			:    List[str]=True				,   lowerCamelCase			:    List[str]=True				,   **lowerCamelCase			:    int				,   ):



   """simple docstring"""





   __A		:     Union[str, Any]												=		vocab_size
   __A		:     str												=		block_sizes
   __A		:     Optional[Any]												=		[1] * len(lowerCamelCase       ) if block_repeats is None else block_repeats
   assert len(lowerCamelCase       ) == len(
       self.block_repeats       ), "`block_sizes` and `block_repeats` should have the same length."
   __A		:     Optional[int]												=		num_decoder_layers
   __A		:     Optional[int]												=		d_model
   __A		:     int												=		n_head
   __A		:     Union[str, Any]												=		d_head
   __A		:     Any												=		d_inner
   __A		:     Optional[Any]												=		hidden_act
   __A		:     List[Any]												=		hidden_dropout
   __A		:     List[str]												=		attention_dropout
   __A		:     Optional[int]												=		activation_dropout
   __A		:     List[str]												=		initializer_range
   __A		:     Any												=		initializer_std
   __A		:     List[str]												=		layer_norm_eps
   assert pooling_type in [
       "mean",
       "max",
   ], f"Got {pooling_type} for `pooling_type` but only 'mean' and 'max' are supported."
   __A		:     Dict												=		pooling_type
   assert attention_type in [
       "relative_shift",
       "factorized",
   ], f"Got {attention_type} for `attention_type` but only 'relative_shift' and 'factorized' are supported."
   __A		:     Tuple												=		attention_type
   __A		:     Optional[int]												=		separate_cls
   __A		:     Any												=		truncate_seq
   __A		:     Union[str, Any]												=		pool_q_only

   super().__init__(**lowerCamelCase       )
 @property
 def 		lowercase_(   self			:    str       ):



   """simple docstring"""





   return sum(self.block_sizes       )
 @num_hidden_layers.setter
 def 		lowercase_(   self			:    Dict				,   lowerCamelCase			:    int       ):



   """simple docstring"""





   raise NotImplementedError(
       """This model does not support the setting of `num_hidden_layers`. Please set `block_sizes`."""       )
 @property
 def 		lowercase_(   self			:    str       ):



   """simple docstring"""





   return len(self.block_sizes       )






 @num_blocks.setter
 def 		lowercase_(   self			:    Union[str, Any]				,   lowerCamelCase			:    Any       ):



   """simple docstring"""





   raise NotImplementedError("""This model does not support the setting of `num_blocks`. Please set `block_sizes`."""       )





'''simple docstring'''
import os
import zipfile

import requests
from get_ci_error_statistics import download_artifact, get_artifacts_links







def        A_     (						__SCREAMING_SNAKE_CASE						:  List[str]			,     __SCREAMING_SNAKE_CASE						:  Optional[int]=7 )				->       List[Any]:





  """simple docstring"""

  __A		:     Optional[int]												=		None
  if token is not None:
    __A		:     str												=		{"""Accept""": """application/vnd.github+json""", """Authorization""": F"Bearer {token}"}

  # The id of a workflow (not of a workflow run)
  __A		:     Union[str, Any]												=		"""636036"""

  __A		:     Optional[int]												=		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}"

  __A		:     int												=		requests.get(__SCREAMING_SNAKE_CASE			,     headers=__SCREAMING_SNAKE_CASE ).json()

  return result["workflow_runs"]







def        A_     (						__SCREAMING_SNAKE_CASE						:  Union[str, Any] )				->       Tuple:





  """simple docstring"""

  __A		:     str												=		get_daily_ci_runs(__SCREAMING_SNAKE_CASE )
  __A		:     List[Any]												=		None
  for workflow_run in workflow_runs:
    if workflow_run["status"] == "completed":
      __A		:     Dict												=		workflow_run["""id"""]
      break

  return workflow_run_id







def        A_     (						__SCREAMING_SNAKE_CASE						:  List[Any]			,     __SCREAMING_SNAKE_CASE						:  Any			,     __SCREAMING_SNAKE_CASE						:  Tuple )				->       Tuple:





  """simple docstring"""

  __A		:     Dict												=		get_last_daily_ci_runs(__SCREAMING_SNAKE_CASE )
  if workflow_run_id is not None:
    __A		:     str												=		get_artifacts_links(worflow_run_id=__SCREAMING_SNAKE_CASE			,     token=__SCREAMING_SNAKE_CASE )
    for artifact_name in artifact_names:
      if artifact_name in artifacts_links:
        __A		:     List[Any]												=		artifacts_links[artifact_name]
        download_artifact(
            artifact_name=__SCREAMING_SNAKE_CASE			,     artifact_url=__SCREAMING_SNAKE_CASE			,     output_dir=__SCREAMING_SNAKE_CASE			,     token=__SCREAMING_SNAKE_CASE )







def        A_     (						__SCREAMING_SNAKE_CASE						:  List[Any]			,     __SCREAMING_SNAKE_CASE						:  Optional[int]			,     __SCREAMING_SNAKE_CASE						:  Optional[Any] )				->       Union[str, Any]:





  """simple docstring"""

  get_last_daily_ci_artifacts(__SCREAMING_SNAKE_CASE			,     __SCREAMING_SNAKE_CASE			,     __SCREAMING_SNAKE_CASE )

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

  return results



