






'''simple docstring'''







import argparse
import json
import os

import tensorstore as ts
import torch
from flax import serialization
from flax.traverse_util import flatten_dict, unflatten_dict
from tensorflow.io import gfile

from transformers.modeling_utils import dtype_byte_size
from transformers.models.switch_transformers.convert_switch_transformers_original_flax_checkpoint_to_pytorch import (
    rename_keys,
)
from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME
from transformers.utils.hub import convert_file_size_to_int





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase    ,      UpperCamelCase				)				->	Dict:
							if flax_key_tuple[-1] == "kernel" and flax_tensor.ndim == 3:
														# expert layer
														lowerCamelCase__ :     Any	  =	flax_key_tuple[:-1] + ("""weight""",)
														lowerCamelCase__ :     str	  =	torch.permute(UpperCamelCase    ,      (0, 2, 1)				)
							elif flax_key_tuple[-1] == "kernel" and ".".join(UpperCamelCase				):
														# linear layer
														lowerCamelCase__ :     Optional[int]	  =	flax_key_tuple[:-1] + ("""weight""",)
														lowerCamelCase__ :     Union[str, Any]	  =	flax_tensor.T
							elif flax_key_tuple[-1] in ["scale", "embedding"]:
														lowerCamelCase__ :     Any	  =	flax_key_tuple[:-1] + ("""weight""",)

							return flax_key_tuple, flax_tensor





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase    ,      UpperCamelCase    ,      UpperCamelCase				)				->	Tuple:
							if "metadata" in layer:
														lowerCamelCase__ :     List[Any]	  =	layer.split("""metadata"""				)
														lowerCamelCase__ :     int	  =	"""""".join(split_layer[0]				)[:-1]
														lowerCamelCase__ :     Any	  =	[tuple(("""metadata""" + split_layer[1]).split("""/"""				)				)]
							elif "kvstore" in layer:
														lowerCamelCase__ :     Tuple	  =	layer.split("""kvstore"""				)
														lowerCamelCase__ :     Tuple	  =	"""""".join(split_layer[0]				)[:-1]
														lowerCamelCase__ :     Optional[int]	  =	[tuple(("""kvstore""" + split_layer[1]).split("""/"""				)				)]

							else:
														lowerCamelCase__ :     int	  =	layer.split("""/"""				)
														lowerCamelCase__ :     str	  =	"""/""".join(split_layer[:-1]				)
														lowerCamelCase__ :     List[str]	  =	(split_layer[-1],)

							if "kvstore/path" in layer:
														lowerCamelCase__ :     Optional[Any]	  =	f'''{switch_checkpoint_path}/{checkpoint_info[layer]}'''
							elif "kvstore/driver" in layer:
														lowerCamelCase__ :     int	  =	"""file"""
							else:
														lowerCamelCase__ :     str	  =	checkpoint_info[layer]

							return curr_real_layer_name, split_layer, content





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase    ,      UpperCamelCase				)				->	Optional[int]:
							lowerCamelCase__ :     Tuple	  =	rename_keys(UpperCamelCase				)
							lowerCamelCase__ :     Union[str, Any]	  =	{}
							for k, v in current_block.items():
														lowerCamelCase__ :     Optional[int]	  =	v
							lowerCamelCase__ :     Union[str, Any]	  =	new_current_block
							torch.save(UpperCamelCase    ,      UpperCamelCase				)





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase    ,      UpperCamelCase    ,      UpperCamelCase    ,      UpperCamelCase    ,      UpperCamelCase = WEIGHTS_NAME				)				->	Optional[int]:
							lowerCamelCase__ :     Optional[Any]	  =	convert_file_size_to_int(UpperCamelCase				)
							lowerCamelCase__ :     Tuple	  =	[]
							lowerCamelCase__ :     Union[str, Any]	  =	{}
							lowerCamelCase__ :     List[Any]	  =	0
							lowerCamelCase__ :     List[str]	  =	0

							os.makedirs(UpperCamelCase    ,      exist_ok=UpperCamelCase				)
							with gfile.GFile(switch_checkpoint_path + """/checkpoint"""    ,      """rb"""				) as fp:
														lowerCamelCase__ :     str	  =	serialization.msgpack_restore(fp.read()				)["""optimizer"""]["""target"""]
														lowerCamelCase__ :     List[str]	  =	flatten_dict(UpperCamelCase    ,      sep="""/"""				)

							lowerCamelCase__ :     Dict	  =	{}
							for layer in checkpoint_info.keys():
														lowerCamelCase__  ,		lowerCamelCase__  ,		lowerCamelCase__ :     Any	  =	get_key_and_tensorstore_dict(
														    UpperCamelCase    ,      UpperCamelCase    ,      UpperCamelCase				)
														if curr_real_layer_name in all_layers:
																					lowerCamelCase__ :     Any	  =	content
														else:
																					lowerCamelCase__ :     int	  =	{split_layer[-1]: content}

							for key in all_layers.keys():
														# open tensorstore file
														lowerCamelCase__ :     str	  =	ts.open(unflatten_dict(all_layers[key]				)				).result().read().result()
														lowerCamelCase__ :     str	  =	torch.tensor(UpperCamelCase				)
														lowerCamelCase__ :     List[str]	  =	raw_weights.numel() * dtype_byte_size(raw_weights.dtype				)

														# use the renaming pattern from the small conversion scripts
														lowerCamelCase__  ,		lowerCamelCase__ :     List[Any]	  =	rename_base_flax_keys(tuple(key.split("""/"""				)				)    ,      UpperCamelCase				)
														lowerCamelCase__ :     List[str]	  =	"""/""".join(UpperCamelCase				)

														# If this weight is going to tip up over the maximal size, we split.
														if current_block_size + weight_size > max_shard_size:
																					lowerCamelCase__ :     Union[str, Any]	  =	os.path.join(
																					    UpperCamelCase    ,      weights_name.replace(""".bin"""    ,      f'''-{len(UpperCamelCase				)+1:05d}-of-???.bin'''				)				)
																					rename_and_save_block(UpperCamelCase    ,      UpperCamelCase				)
																					sharded_state_dicts.append(current_block.keys()				)
																					del current_block
																					lowerCamelCase__ :     Optional[Any]	  =	{}
																					lowerCamelCase__ :     Union[str, Any]	  =	0

														lowerCamelCase__ :     Tuple	  =	raw_weights.to(getattr(UpperCamelCase    ,      UpperCamelCase				)				)
														current_block_size += weight_size
														total_size += weight_size

							# Add the last block
							lowerCamelCase__ :     str	  =	os.path.join(UpperCamelCase    ,      weights_name.replace(""".bin"""    ,      f'''-{len(UpperCamelCase				)+1:05d}-of-???.bin'''				)				)
							rename_and_save_block(UpperCamelCase    ,      UpperCamelCase				)
							sharded_state_dicts.append(current_block.keys()				)

							# If we only have one shard, we return it
							if len(UpperCamelCase				) == 1:
														return {weights_name: sharded_state_dicts[0]}, None

							# Otherwise, let's build the index
							lowerCamelCase__ :     List[str]	  =	{}
							lowerCamelCase__ :     List[Any]	  =	{}
							for idx, shard in enumerate(UpperCamelCase				):
														lowerCamelCase__ :     Any	  =	weights_name.replace(
														    """.bin"""    ,      f'''-{idx+1:05d}-of-{len(UpperCamelCase				):05d}.bin'''				)  # len(sharded_state_dicts):05d}
														lowerCamelCase__ :     List[Any]	  =	os.path.join(UpperCamelCase    ,      weights_name.replace(""".bin"""    ,      f'''-{idx+1:05d}-of-???.bin'''				)				)
														os.rename(UpperCamelCase    ,      os.path.join(UpperCamelCase    ,      UpperCamelCase				)				)
														lowerCamelCase__ :     Any	  =	shard
														for key in shard:
																					lowerCamelCase__ :     List[str]	  =	shard_file

    # Add the metadata
							lowerCamelCase__ :     int	  =	{"""total_size""": total_size}
							lowerCamelCase__ :     Optional[int]	  =	{"""metadata""": metadata, """weight_map""": weight_map}

							with open(os.path.join(UpperCamelCase    ,      UpperCamelCase				)    ,      """w"""    ,      encoding="""utf-8"""				) as f:
														lowerCamelCase__ :     Any	  =	json.dumps(UpperCamelCase    ,      indent=2    ,      sort_keys=UpperCamelCase				) + """\n"""
														f.write(UpperCamelCase				)

							return metadata, index


if __name__ == "__main__":
			_A     :      Tuple   					=argparse.ArgumentParser()
			# Required parameters
			parser.add_argument(
			    '''--switch_t5x_checkpoint_path''',
			    default='''/mnt/disks/disk_switch/original_checkpoints/switch-xxl-128/checkpoint_634600''',
			    type=str,
			    required=False,
			    help='''Path to a directory containing a folder per layer. Follows the original Google format.''',
			)
			parser.add_argument('''--max_shard_size''', default='''10GB''', required=False, help='''Max shard size''')
			parser.add_argument('''--dtype''', default='''bfloat16''', type=str, required=False, help='''dtype of the saved model''')
			parser.add_argument(
			    '''--pytorch_dump_folder_path''',
			    default='''/mnt/disks/disk_switch/original_checkpoints/switch-xxl-128-converted''',
			    type=str,
			    required=False,
			    help='''Path to the output pytorch model.''',
			)
			_A     :      Optional[Any]   					=parser.parse_args()
			shard_on_the_fly(
			    args.switch_tax_checkpoint_path,
			    args.pytorch_dump_folder_path,
			    args.max_shard_size,
			    args.dtype,
			)





def 			SCREAMING_SNAKE_CASE_	()				->	Union[str, Any]:
							from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration, TaTokenizer

							lowerCamelCase__ :     Union[str, Any]	  =	SwitchTransformersConfig.from_pretrained("""google/switch-base-8"""				)
							config.save_pretrained("""/home/arthur_huggingface_co/transformers/switch_converted"""				)
							lowerCamelCase__ :     List[Any]	  =	SwitchTransformersForConditionalGeneration.from_pretrained(
							    """/home/arthur_huggingface_co/transformers/switch_converted"""    ,      device_map="""auto"""				)

							lowerCamelCase__ :     str	  =	TaTokenizer.from_pretrained("""t5-small"""				)
							lowerCamelCase__ :     Any	  =	"""A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."""

							lowerCamelCase__ :     Dict	  =	tokenizer(UpperCamelCase    ,      return_tensors="""pt"""				).input_ids
							lowerCamelCase__ :     List[str]	  =	model.generate(UpperCamelCase    ,      decoder_start_token_id=0				)
							print(tokenizer.decode(out[0]				)				)









'''simple docstring'''







import collections
import json
import math
import os
import re
import time
from fnmatch import fnmatch
from typing import Dict

import requests
from slack_sdk import WebClient


_A     :      str   					=WebClient(token=os.environ['''CI_SLACK_BOT_TOKEN'''])





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase				)				->	Tuple:
							lowerCamelCase__ :     int	  =	test_results.split(""" """				)

							lowerCamelCase__ :     Optional[int]	  =	0
							lowerCamelCase__ :     Any	  =	0

							# When the output is short enough, the output is surrounded by = signs: "== OUTPUT =="
							# When it is too long, those signs are not present.
							lowerCamelCase__ :     Union[str, Any]	  =	expressions[-2] if """=""" in expressions[-1] else expressions[-1]

							for i, expression in enumerate(UpperCamelCase				):
														if "failed" in expression:
																					failed += int(expressions[i - 1]				)
														if "passed" in expression:
																					success += int(expressions[i - 1]				)

							return failed, success, time_spent





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase				)				->	Tuple:
							lowerCamelCase__ :     Optional[Any]	  =	{}
							lowerCamelCase__ :     int	  =	None
							lowerCamelCase__ :     Optional[int]	  =	False
							for line in failures_short_lines.split("""\n"""				):
														if re.search(r"""_ \[doctest\]"""    ,      UpperCamelCase				):
																					lowerCamelCase__ :     Dict	  =	True
																					lowerCamelCase__ :     Optional[int]	  =	line.split(""" """				)[2]
														elif in_error and not line.split(""" """				)[0].isdigit():
																					lowerCamelCase__ :     List[str]	  =	line
																					lowerCamelCase__ :     int	  =	False

							return failures

class _lowercase     :




							def __init__(							self:    Tuple      ,							UpperCamelCase__:    str      ,							UpperCamelCase__:    Dict					):
														lowerCamelCase__ :     Union[str, Any]	  =	title

														lowerCamelCase__ :     Tuple	  =	doc_test_results["""time_spent"""].split(""","""					)[0]
														lowerCamelCase__ :     Union[str, Any]	  =	doc_test_results["""success"""]
														lowerCamelCase__ :     List[Any]	  =	doc_test_results["""failures"""]
														lowerCamelCase__ :     List[str]	  =	self.n_success + self.n_failures

														# Failures and success of the modeling tests
														lowerCamelCase__ :     str	  =	doc_test_results




							@property
							def 		lowerCamelCase_    (							self:    Dict					):
														lowerCamelCase__ :     Union[str, Any]	  =	[self._time_spent]
														lowerCamelCase__ :     Tuple	  =	0

														for time in time_spent:
																					lowerCamelCase__ :     Tuple	  =	time.split(""":"""					)

																					# Time can be formatted as xx:xx:xx, as .xx, or as x.xx if the time spent was less than a minute.
																					if len(UpperCamelCase__					) == 1:
																												lowerCamelCase__ :     Tuple	  =	[0, 0, time_parts[0]]

																					lowerCamelCase__  ,		lowerCamelCase__  ,		lowerCamelCase__ :     List[Any]	  =	int(time_parts[0]					), int(time_parts[1]					), float(time_parts[2]					)
																					total_secs += hours * 3_600 + minutes * 60 + seconds

														lowerCamelCase__  ,		lowerCamelCase__  ,		lowerCamelCase__ :     List[Any]	  =	total_secs // 3_600, (total_secs % 3_600) // 60, total_secs % 60
														return F'''{int(UpperCamelCase__					)}h{int(UpperCamelCase__					)}m{int(UpperCamelCase__					)}s'''




							@property
							def 		lowerCamelCase_    (							self:    Dict					):
														return {"type": "header", "text": {"type": "plain_text", "text": self.title}}




							@property
							def 		lowerCamelCase_    (							self:    Any					):
														return {
														    "type": "section",
														    "text": {
														        "type": "plain_text",
														        "text": F'''🌞 There were no failures: all {self.n_tests} tests passed. The suite ran in {self.time}.''',
														        "emoji": True,
														    },
														    "accessory": {
														        "type": "button",
														        "text": {"type": "plain_text", "text": "Check Action results", "emoji": True},
														        "url": F'''https://github.com/huggingface/transformers/actions/runs/{os.environ['GITHUB_RUN_ID']}''',
														    },
														}




							@property
							def 		lowerCamelCase_    (							self:    Any					):
														return {
														    "type": "section",
														    "text": {
														        "type": "plain_text",
														        "text": (
														            F'''There were {self.n_failures} failures, out of {self.n_tests} tests.\nThe suite ran in'''
														            F''' {self.time}.'''
														        ),
														        "emoji": True,
														    },
														    "accessory": {
														        "type": "button",
														        "text": {"type": "plain_text", "text": "Check Action results", "emoji": True},
														        "url": F'''https://github.com/huggingface/transformers/actions/runs/{os.environ['GITHUB_RUN_ID']}''',
														    },
														}




							@property
							def 		lowerCamelCase_    (							self:    Optional[Any]					):
														lowerCamelCase__ :     Any	  =	40
														lowerCamelCase__ :     List[str]	  =	{k: v["""failed"""] for k, v in doc_test_results.items() if isinstance(UpperCamelCase__      ,							UpperCamelCase__					)}

														lowerCamelCase__ :     List[Any]	  =	""""""
														for category, failures in category_failures.items():
																					if len(UpperCamelCase__					) == 0:
																												continue

																					if report != "":
																												report += "\n\n"

																					report += F'''*{category} failures*:'''.ljust(line_length // 2					).rjust(line_length // 2					) + "\n"
																					report += "`"
																					report += "`\n`".join(UpperCamelCase__					)
																					report += "`"

														return {
														    "type": "section",
														    "text": {
														        "type": "mrkdwn",
														        "text": F'''The following examples had failures:\n\n\n{report}\n''',
														    },
														}




							@property
							def 		lowerCamelCase_    (							self:    Any					):
														lowerCamelCase__ :     Union[str, Any]	  =	[self.header]

														if self.n_failures > 0:
																					blocks.append(self.failures					)

														if self.n_failures > 0:
																					blocks.extend([self.category_failures]					)

														if self.n_failures == 0:
																					blocks.append(self.no_failures					)

														return json.dumps(UpperCamelCase__					)




							@staticmethod
							def 		lowerCamelCase_    (							):
														lowerCamelCase__ :     List[Any]	  =	[
														    {
														        """type""": """section""",
														        """text""": {
														            """type""": """plain_text""",
														            """text""": """There was an issue running the tests.""",
														        },
														        """accessory""": {
														            """type""": """button""",
														            """text""": {"""type""": """plain_text""", """text""": """Check Action results""", """emoji""": True},
														            """url""": F'''https://github.com/huggingface/transformers/actions/runs/{os.environ['GITHUB_RUN_ID']}''',
														        },
														    }
														]

														print("""Sending the following payload"""					)
														print(json.dumps({"""blocks""": json.loads(UpperCamelCase__					)}					)					)

														client.chat_postMessage(
														    channel=os.environ["""CI_SLACK_CHANNEL_ID_DAILY"""]      ,							text="""There was an issue running the tests."""      ,							blocks=UpperCamelCase__      ,							)




							def 		lowerCamelCase_    (							self:    Any					):
														print("""Sending the following payload"""					)
														print(json.dumps({"""blocks""": json.loads(self.payload					)}					)					)

														lowerCamelCase__ :     Any	  =	F'''{self.n_failures} failures out of {self.n_tests} tests,''' if self.n_failures else """All tests passed."""

														lowerCamelCase__ :     List[str]	  =	client.chat_postMessage(
														    channel=os.environ["""CI_SLACK_CHANNEL_ID_DAILY"""]      ,							blocks=self.payload      ,							text=UpperCamelCase__      ,							)




							def 		lowerCamelCase_    (							self:    Any      ,							UpperCamelCase__:    str      ,							UpperCamelCase__:    Dict      ,							UpperCamelCase__:    List[Any]      ,							UpperCamelCase__:    Union[str, Any]					):
														lowerCamelCase__ :     Optional[Any]	  =	""""""
														for key, value in failures.items():
																					lowerCamelCase__ :     int	  =	value[:200] + """ [Truncated]""" if len(UpperCamelCase__					) > 250 else value
																					failures_text += F'''*{key}*\n_{value}_\n\n'''

														lowerCamelCase__ :     Tuple	  =	job_name
														lowerCamelCase__ :     Union[str, Any]	  =	{"""type""": """section""", """text""": {"""type""": """mrkdwn""", """text""": text}}

														if job_link is not None:
																					lowerCamelCase__ :     Union[str, Any]	  =	{
																					    """type""": """button""",
																					    """text""": {"""type""": """plain_text""", """text""": """GitHub Action job""", """emoji""": True},
																					    """url""": job_link,
																					}

														return [
														    {"type": "header", "text": {"type": "plain_text", "text": title.upper(), "emoji": True}},
														    content,
														    {"type": "section", "text": {"type": "mrkdwn", "text": failures_text}},
														]




							def 		lowerCamelCase_    (							self:    Tuple					):
														if self.thread_ts is None:
																					raise ValueError("""Can only post reply if a post has been made."""					)

														lowerCamelCase__ :     int	  =	self.doc_test_results.pop("""job_link"""					)
														self.doc_test_results.pop("""failures"""					)
														self.doc_test_results.pop("""success"""					)
														self.doc_test_results.pop("""time_spent"""					)

														lowerCamelCase__ :     List[Any]	  =	sorted(self.doc_test_results.items()      ,							key=lambda UpperCamelCase__					: t[0]					)
														for job, job_result in sorted_dict:
																					if len(job_result["""failures"""]					):
																												lowerCamelCase__ :     Union[str, Any]	  =	F'''*Num failures* :{len(job_result['failed']					)} \n'''
																												lowerCamelCase__ :     Union[str, Any]	  =	job_result["""failures"""]
																												lowerCamelCase__ :     int	  =	self.get_reply_blocks(UpperCamelCase__      ,							UpperCamelCase__      ,							UpperCamelCase__      ,							text=UpperCamelCase__					)

																												print("""Sending the following reply"""					)
																												print(json.dumps({"""blocks""": blocks}					)					)

																												client.chat_postMessage(
																												    channel=os.environ["""CI_SLACK_CHANNEL_ID_DAILY"""]      ,							text=F'''Results for {job}'''      ,							blocks=UpperCamelCase__      ,							thread_ts=self.thread_ts["""ts"""]      ,							)

																												time.sleep(1					)





def 			SCREAMING_SNAKE_CASE_	()				->	Tuple:
							lowerCamelCase__ :     Any	  =	os.environ["""GITHUB_RUN_ID"""]
							lowerCamelCase__ :     List[Any]	  =	f'''https://api.github.com/repos/huggingface/transformers/actions/runs/{run_id}/jobs?per_page=100'''
							lowerCamelCase__ :     Optional[int]	  =	requests.get(UpperCamelCase				).json()
							lowerCamelCase__ :     List[Any]	  =	{}

							try:
														jobs.update({job["""name"""]: job["""html_url"""] for job in result["""jobs"""]}				)
														lowerCamelCase__ :     Any	  =	math.ceil((result["""total_count"""] - 100) / 100				)

														for i in range(UpperCamelCase				):
																					lowerCamelCase__ :     List[Any]	  =	requests.get(url + f'''&page={i + 2}'''				).json()
																					jobs.update({job["""name"""]: job["""html_url"""] for job in result["""jobs"""]}				)

														return jobs
							except Exception as e:
														print("""Unknown error, could not fetch links."""    ,      UpperCamelCase				)

							return {}





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase				)				->	Any:
							lowerCamelCase__ :     int	  =	{}

							if os.path.exists(UpperCamelCase				):
														lowerCamelCase__ :     List[str]	  =	os.listdir(UpperCamelCase				)
														for file in files:
																					try:
																												with open(os.path.join(UpperCamelCase    ,      UpperCamelCase				)    ,      encoding="""utf-8"""				) as f:
																																			lowerCamelCase__ :     List[Any]	  =	f.read()
																					except UnicodeDecodeError as e:
																												raise ValueError(f'''Could not open {os.path.join(UpperCamelCase    ,      UpperCamelCase				)}.'''				) from e

							return _artifact





def 			SCREAMING_SNAKE_CASE_	()				->	Optional[Any]:

							class _lowercase     :




														def __init__(							self:    Tuple      ,							UpperCamelCase__:    str					):
																					lowerCamelCase__ :     Any	  =	name
																					lowerCamelCase__ :     Union[str, Any]	  =	[]




														def __str__(							self:    int					):
																					return self.name




														def 		lowerCamelCase_    (							self:    Tuple      ,							UpperCamelCase__:    str					):
																					self.paths.append({"""name""": self.name, """path""": path}					)



							lowerCamelCase__ :     Dict[str, Artifact]	  =	{}

							lowerCamelCase__ :     List[str]	  =	filter(os.path.isdir    ,      os.listdir()				)
							for directory in directories:
														lowerCamelCase__ :     Union[str, Any]	  =	directory
														if artifact_name not in _available_artifacts:
																					lowerCamelCase__ :     Optional[int]	  =	Artifact(UpperCamelCase				)

																					_available_artifacts[artifact_name].add_path(UpperCamelCase				)

							return _available_artifacts


if __name__ == "__main__":
			_A     :      Any   					=get_job_links()
			_A     :      str   					=retrieve_available_artifacts()

			_A     :      int   					=collections.OrderedDict(
			    [
			        ('''*.py''', '''API Examples'''),
			        ('''*.md''', '''MD Examples'''),
			    ]
			)

			# This dict will contain all the information relative to each doc test category:
			# - failed: list of failed tests
			# - failures: dict in the format 'test': 'error_message'
			_A     :      Union[str, Any]   					={
			    v: {
			        '''failed''': [],
			        '''failures''': {},
			    }
			    for v in docs.values()
			}

			# Link to the GitHub Action job
			_A     :      Union[str, Any]   					=github_actions_job_links.get('''run_doctests''')

			_A     :      Any   					=available_artifacts['''doc_tests_gpu_test_reports'''].paths[0]
			_A     :      Dict   					=retrieve_artifact(artifact_path['''name'''])
			if "stats" in artifact:
						_A					,				_A					,				_A     :      Optional[int]   					=handle_test_results(artifact['''stats'''])
						_A     :      Union[str, Any]   					=failed
						_A     :      int   					=success
						_A     :      Optional[int]   					=time_spent[1:-1] + ''', '''

						_A     :      Any   					=extract_first_line_failure(artifact['''failures_short'''])
						for line in artifact["summary_short"].split('''\n'''):
									if re.search('''FAILED''', line):
												_A     :      List[Any]   					=line.replace('''FAILED ''', '''''')
												_A     :      Any   					=line.split()[0].replace('''\n''', '''''')

												if "::" in line:
															_A					,				_A     :      Any   					=line.split('''::''')
												else:
															_A					,				_A     :      Tuple   					=line, line

												for file_regex in docs.keys():
															if fnmatch(file_path, file_regex):
																		_A     :      str   					=docs[file_regex]
																		doc_test_results[category]["failed"].append(test)

																		_A     :      str   					=all_failures[test] if test in all_failures else '''N/A'''
																		_A     :      Tuple   					=failure
																		break

			_A     :      Union[str, Any]   					=Message('''🤗 Results of the doc tests.''', doc_test_results)
			message.post()
			message.post_reply()

