
import warnings

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


__lowerCAmelCase			:     List[Any]           =   logging.get_logger(__name__)

__lowerCAmelCase			:     Optional[int]           =   {
    'xlnet-base-cased': 'https://huggingface.co/xlnet-base-cased/resolve/main/config.json',
    'xlnet-large-cased': 'https://huggingface.co/xlnet-large-cased/resolve/main/config.json',
}




class        UpperCAmelCase_			( _A     ):


  '''simple docstring'''







  a__           =		"""xlnet"""
  a__           =		["""mems"""]
  a__           =		{
      """n_token""": """vocab_size""",  # Backward compatibility
      """hidden_size""": """d_model""",
      """num_attention_heads""": """n_head""",
      """num_hidden_layers""": """n_layer""",
  }
  def __init__( self			: int			,							UpperCamelCase__			: List[str]=3_2000			,							UpperCamelCase__			: Optional[int]=1024			,							UpperCamelCase__			: Union[str, Any]=24			,							UpperCamelCase__			: Optional[int]=16			,							UpperCamelCase__			: List[str]=4096			,							UpperCamelCase__			: Union[str, Any]="gelu"			,							UpperCamelCase__			: Tuple=True			,							UpperCamelCase__			: Tuple="bi"			,							UpperCamelCase__			: List[str]=0.02			,							UpperCamelCase__			: List[str]=1E-12			,							UpperCamelCase__			: Tuple=0.1			,							UpperCamelCase__			: Tuple=512			,							UpperCamelCase__			: str=None			,							UpperCamelCase__			: Dict=True			,							UpperCamelCase__			: Optional[int]=False			,							UpperCamelCase__			: List[str]=False			,							UpperCamelCase__			: Any=-1			,							UpperCamelCase__			: Dict=False			,							UpperCamelCase__			: int="last"			,							UpperCamelCase__			: Optional[Any]=True			,							UpperCamelCase__			: List[Any]="tanh"			,							UpperCamelCase__			: Tuple=0.1			,							UpperCamelCase__			: List[str]=5			,							UpperCamelCase__			: Tuple=5			,							UpperCamelCase__			: str=5			,							UpperCamelCase__			: Optional[int]=1			,							UpperCamelCase__			: List[str]=2			,							**UpperCamelCase__			: List[Any]			,							)			->	Any:







    """simple docstring"""






    __magic_name__				     =       vocab_size
    __magic_name__				     =       d_model
    __magic_name__				     =       n_layer
    __magic_name__				     =       n_head
    if d_model % n_head != 0:
      raise ValueError(F'''\'d_model % n_head\' ({d_model % n_head}) should be equal to 0'''    )
    if "d_head" in kwargs:
      if kwargs["d_head"] != d_model // n_head:
        raise ValueError(
            F'''`d_head` ({kwargs['d_head']}) should be equal to `d_model // n_head` ({d_model // n_head})'''    )
    __magic_name__				     =       d_model // n_head
    __magic_name__				     =       ff_activation
    __magic_name__				     =       d_inner
    __magic_name__				     =       untie_r
    __magic_name__				     =       attn_type

    __magic_name__				     =       initializer_range
    __magic_name__				     =       layer_norm_eps

    __magic_name__				     =       dropout
    __magic_name__				     =       mem_len
    __magic_name__				     =       reuse_len
    __magic_name__				     =       bi_data
    __magic_name__				     =       clamp_len
    __magic_name__				     =       same_length

    __magic_name__				     =       summary_type
    __magic_name__				     =       summary_use_proj
    __magic_name__				     =       summary_activation
    __magic_name__				     =       summary_last_dropout
    __magic_name__				     =       start_n_top
    __magic_name__				     =       end_n_top

    __magic_name__				     =       bos_token_id
    __magic_name__				     =       pad_token_id
    __magic_name__				     =       eos_token_id

    if "use_cache" in kwargs:
      warnings.warn(
          """The `use_cache` argument is deprecated and will be removed in a future version, use `use_mems_eval`"""
          """ instead."""			,							UpperCamelCase__			,							)
      __magic_name__				     =       kwargs["""use_cache"""]

    __magic_name__				     =       use_mems_eval
    __magic_name__				     =       use_mems_train
    super().__init__(pad_token_id=UpperCamelCase__			,							bos_token_id=UpperCamelCase__			,							eos_token_id=UpperCamelCase__			,							**UpperCamelCase__    )
  @property
  def 							_lowercase							( self			: int    )			->	Tuple:







    """simple docstring"""






    logger.info(F'''The model {self.model_type} is one of the few models that has no sequence length limit.'''    )
    return -1





  @max_position_embeddings.setter
  def 							_lowercase							( self			: Any			,							UpperCamelCase__			: Optional[Any]    )			->	Dict:







    """simple docstring"""






    raise NotImplementedError(
        F'''The model {self.model_type} is one of the few models that has no sequence length limit.'''    )




import argparse
import math
import traceback

import dateutil.parser as date_parser
import requests
def      a      (			A__	:   Dict     )    ->      str:





      """simple docstring"""



      _lowercase	       ={}

      _lowercase	       =job['started_at']
      _lowercase	       =job['completed_at']

      _lowercase	       =date_parser.parse(A__     )
      _lowercase	       =date_parser.parse(A__     )

      _lowercase	       =round((end_datetime - start_datetime).total_seconds() / 60.0     )

      _lowercase	       =start
      _lowercase	       =end
      _lowercase	       =duration_in_min

      return job_info
def      a      (			A__	:   Dict      ,   A__	:   str=None     )    ->      Tuple:





      """simple docstring"""



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

      _lowercase	       =F'''https://api.github.com/repos/huggingface/transformers/actions/runs/{workflow_run_id}/jobs?per_page=100'''
      _lowercase	       =requests.get(A__      ,   headers=A__     ).json()
      _lowercase	       ={}

      try:
            job_time.update({job['name']: extract_time_from_single_job(A__     ) for job in result['jobs']}     )
            _lowercase	       =math.ceil((result['total_count'] - 100) / 100     )

            for i in range(A__     ):
                  _lowercase	       =requests.get(url + F'''&page={i + 2}'''      ,   headers=A__     ).json()
                  job_time.update({job['name']: extract_time_from_single_job(A__     ) for job in result['jobs']}     )

            return job_time
      except Exception:
            print(F'''Unknown error, could not fetch links:\n{traceback.format_exc()}'''     )

      return {}


if __name__ == "__main__":
  lowercase_									=   argparse.ArgumentParser()
  # Required parameters
  parser.add_argument('--workflow_run_id', type=str, required=True, help='A GitHub Actions workflow run id.')
  lowercase_									=   parser.parse_args()

  lowercase_									=   get_job_time(args.workflow_run_id)
  lowercase_									=   dict(sorted(job_time.items(), key=lambda item: item[1]["duration"], reverse=True))

  for k, v in job_time.items():
    print(f"{k}: {v['duration']}")


