
import os
import unittest

from transformers import MobileBertTokenizer, MobileBertTokenizerFast
from transformers.models.bert.tokenization_bert import (
    VOCAB_FILES_NAMES,
    BasicTokenizer,
    WordpieceTokenizer,
    _is_control,
    _is_punctuation,
    _is_whitespace,
)
from transformers.testing_utils import require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin, filter_non_english



@require_tokenizers
class 			lowerCAmelCase_		(_lowerCamelCase				,      unittest.TestCase						):


				"""simple docstring"""



				__UpperCamelCase   :		Any       =     MobileBertTokenizer
				__UpperCamelCase   :		Optional[int]       =     MobileBertTokenizerFast
				__UpperCamelCase   :		Dict       =     True
				__UpperCamelCase   :		Optional[int]       =     True
				__UpperCamelCase   :		Tuple       =     filter_non_english
				__UpperCamelCase   :		Tuple       =     '''google/mobilebert-uncased'''



				def 			__magic_name__					(self					)      ->	Any:



											"""simple docstring"""




											super().setUp()

											SCREAMING_SNAKE_CASE__		: List[str]     =     [
											    """[UNK]""",
											    """[CLS]""",
											    """[SEP]""",
											    """[PAD]""",
											    """[MASK]""",
											    """want""",
											    """##want""",
											    """##ed""",
											    """wa""",
											    """un""",
											    """runn""",
											    """##ing""",
											    """,""",
											    """low""",
											    """lowest""",
											]
											SCREAMING_SNAKE_CASE__		: Tuple     =     os.path.join(self.tmpdirname     , VOCAB_FILES_NAMES["""vocab_file"""]					)
											with open(self.vocab_file     , """w"""     , encoding="""utf-8"""					) as vocab_writer:
																		vocab_writer.write("""""".join([x + """\n""" for x in vocab_tokens]					)					)

											SCREAMING_SNAKE_CASE__		: Tuple     =     [
											    (tokenizer_def[0], self.pre_trained_model_path, tokenizer_def[2])  # else the 'google/' prefix is stripped
											    for tokenizer_def in self.tokenizers_list
											]



				def 			__magic_name__					(self     , SCREAMING_SNAKE_CASE__					)      ->	List[str]:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Tuple     =     """UNwant\u00E9d,running"""
											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     """unwanted, running"""
											return input_text, output_text



				def 			__magic_name__					(self					)      ->	Any:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     self.tokenizer_class(self.vocab_file					)

											SCREAMING_SNAKE_CASE__		: str     =     tokenizer.tokenize("""UNwant\u00E9d,running"""					)
											self.assertListEqual(A__     , ["""un""", """##want""", """##ed""", """,""", """runn""", """##ing"""]					)
											self.assertListEqual(tokenizer.convert_tokens_to_ids(A__					)     , [9, 6, 7, 12, 10, 11]					)



				def 			__magic_name__					(self					)      ->	Optional[int]:



											"""simple docstring"""




											if not self.test_rust_tokenizer:
																		return

											SCREAMING_SNAKE_CASE__		: Optional[Any]     =     self.get_tokenizer()
											SCREAMING_SNAKE_CASE__		: Dict     =     self.get_rust_tokenizer()

											SCREAMING_SNAKE_CASE__		: int     =     """UNwant\u00E9d,running"""

											SCREAMING_SNAKE_CASE__		: Tuple     =     tokenizer.tokenize(A__					)
											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     rust_tokenizer.tokenize(A__					)
											self.assertListEqual(A__     , A__					)

											SCREAMING_SNAKE_CASE__		: Any     =     tokenizer.encode(A__     , add_special_tokens=A__					)
											SCREAMING_SNAKE_CASE__		: List[str]     =     rust_tokenizer.encode(A__     , add_special_tokens=A__					)
											self.assertListEqual(A__     , A__					)

											SCREAMING_SNAKE_CASE__		: List[Any]     =     self.get_rust_tokenizer()
											SCREAMING_SNAKE_CASE__		: str     =     tokenizer.encode(A__					)
											SCREAMING_SNAKE_CASE__		: str     =     rust_tokenizer.encode(A__					)
											self.assertListEqual(A__     , A__					)

											# With lower casing
											SCREAMING_SNAKE_CASE__		: List[Any]     =     self.get_tokenizer(do_lower_case=A__					)
											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     self.get_rust_tokenizer(do_lower_case=A__					)

											SCREAMING_SNAKE_CASE__		: List[Any]     =     """UNwant\u00E9d,running"""

											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     tokenizer.tokenize(A__					)
											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     rust_tokenizer.tokenize(A__					)
											self.assertListEqual(A__     , A__					)

											SCREAMING_SNAKE_CASE__		: Any     =     tokenizer.encode(A__     , add_special_tokens=A__					)
											SCREAMING_SNAKE_CASE__		: List[str]     =     rust_tokenizer.encode(A__     , add_special_tokens=A__					)
											self.assertListEqual(A__     , A__					)

											SCREAMING_SNAKE_CASE__		: str     =     self.get_rust_tokenizer()
											SCREAMING_SNAKE_CASE__		: List[Any]     =     tokenizer.encode(A__					)
											SCREAMING_SNAKE_CASE__		: Optional[int]     =     rust_tokenizer.encode(A__					)
											self.assertListEqual(A__     , A__					)



				def 			__magic_name__					(self					)      ->	Tuple:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: List[Any]     =     BasicTokenizer()

											self.assertListEqual(tokenizer.tokenize("""ah\u535A\u63A8zz"""					)     , ["""ah""", """\u535A""", """\u63A8""", """zz"""]					)



				def 			__magic_name__					(self					)      ->	List[Any]:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Tuple     =     BasicTokenizer(do_lower_case=A__					)

											self.assertListEqual(
											    tokenizer.tokenize(""" \tHeLLo!how  \n Are yoU?  """					)     , ["""hello""", """!""", """how""", """are""", """you""", """?"""]					)
											self.assertListEqual(tokenizer.tokenize("""H\u00E9llo"""					)     , ["""hello"""]					)



				def 			__magic_name__					(self					)      ->	Optional[Any]:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: List[Any]     =     BasicTokenizer(do_lower_case=A__     , strip_accents=A__					)

											self.assertListEqual(
											    tokenizer.tokenize(""" \tHäLLo!how  \n Are yoU?  """					)     , ["""hällo""", """!""", """how""", """are""", """you""", """?"""]					)
											self.assertListEqual(tokenizer.tokenize("""H\u00E9llo"""					)     , ["""h\u00E9llo"""]					)



				def 			__magic_name__					(self					)      ->	Any:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Tuple     =     BasicTokenizer(do_lower_case=A__     , strip_accents=A__					)

											self.assertListEqual(
											    tokenizer.tokenize(""" \tHäLLo!how  \n Are yoU?  """					)     , ["""hallo""", """!""", """how""", """are""", """you""", """?"""]					)
											self.assertListEqual(tokenizer.tokenize("""H\u00E9llo"""					)     , ["""hello"""]					)



				def 			__magic_name__					(self					)      ->	Any:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: int     =     BasicTokenizer(do_lower_case=A__					)

											self.assertListEqual(
											    tokenizer.tokenize(""" \tHäLLo!how  \n Are yoU?  """					)     , ["""hallo""", """!""", """how""", """are""", """you""", """?"""]					)
											self.assertListEqual(tokenizer.tokenize("""H\u00E9llo"""					)     , ["""hello"""]					)



				def 			__magic_name__					(self					)      ->	str:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: List[str]     =     BasicTokenizer(do_lower_case=A__					)

											self.assertListEqual(
											    tokenizer.tokenize(""" \tHeLLo!how  \n Are yoU?  """					)     , ["""HeLLo""", """!""", """how""", """Are""", """yoU""", """?"""]					)



				def 			__magic_name__					(self					)      ->	Dict:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: str     =     BasicTokenizer(do_lower_case=A__     , strip_accents=A__					)

											self.assertListEqual(
											    tokenizer.tokenize(""" \tHäLLo!how  \n Are yoU?  """					)     , ["""HäLLo""", """!""", """how""", """Are""", """yoU""", """?"""]					)



				def 			__magic_name__					(self					)      ->	Union[str, Any]:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Optional[int]     =     BasicTokenizer(do_lower_case=A__     , strip_accents=A__					)

											self.assertListEqual(
											    tokenizer.tokenize(""" \tHäLLo!how  \n Are yoU?  """					)     , ["""HaLLo""", """!""", """how""", """Are""", """yoU""", """?"""]					)



				def 			__magic_name__					(self					)      ->	str:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     BasicTokenizer(do_lower_case=A__     , never_split=["""[UNK]"""]					)

											self.assertListEqual(
											    tokenizer.tokenize(""" \tHeLLo!how  \n Are yoU? [UNK]"""					)     , ["""HeLLo""", """!""", """how""", """Are""", """yoU""", """?""", """[UNK]"""]					)



				def 			__magic_name__					(self					)      ->	Tuple:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Tuple     =     ["""[UNK]""", """[CLS]""", """[SEP]""", """want""", """##want""", """##ed""", """wa""", """un""", """runn""", """##ing"""]

											SCREAMING_SNAKE_CASE__		: List[Any]     =     {}
											for i, token in enumerate(A__					):
																		SCREAMING_SNAKE_CASE__		: Optional[Any]     =     i
											SCREAMING_SNAKE_CASE__		: Tuple     =     WordpieceTokenizer(vocab=A__     , unk_token="""[UNK]"""					)

											self.assertListEqual(tokenizer.tokenize(""""""					)     , []					)

											self.assertListEqual(tokenizer.tokenize("""unwanted running"""					)     , ["""un""", """##want""", """##ed""", """runn""", """##ing"""]					)

											self.assertListEqual(tokenizer.tokenize("""unwantedX running"""					)     , ["""[UNK]""", """runn""", """##ing"""]					)



				def 			__magic_name__					(self					)      ->	str:



											"""simple docstring"""




											self.assertTrue(_is_whitespace(""" """					)					)
											self.assertTrue(_is_whitespace("""\t"""					)					)
											self.assertTrue(_is_whitespace("""\r"""					)					)
											self.assertTrue(_is_whitespace("""\n"""					)					)
											self.assertTrue(_is_whitespace("""\u00A0"""					)					)

											self.assertFalse(_is_whitespace("""A"""					)					)
											self.assertFalse(_is_whitespace("""-"""					)					)



				def 			__magic_name__					(self					)      ->	Union[str, Any]:



											"""simple docstring"""




											self.assertTrue(_is_control("""\u0005"""					)					)

											self.assertFalse(_is_control("""A"""					)					)
											self.assertFalse(_is_control(""" """					)					)
											self.assertFalse(_is_control("""\t"""					)					)
											self.assertFalse(_is_control("""\r"""					)					)



				def 			__magic_name__					(self					)      ->	Dict:



											"""simple docstring"""




											self.assertTrue(_is_punctuation("""-"""					)					)
											self.assertTrue(_is_punctuation("""$"""					)					)
											self.assertTrue(_is_punctuation("""`"""					)					)
											self.assertTrue(_is_punctuation("""."""					)					)

											self.assertFalse(_is_punctuation("""A"""					)					)
											self.assertFalse(_is_punctuation(""" """					)					)



				def 			__magic_name__					(self					)      ->	str:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Optional[Any]     =     self.get_tokenizer()
											SCREAMING_SNAKE_CASE__		: List[Any]     =     self.get_rust_tokenizer()

											# Example taken from the issue https://github.com/huggingface/tokenizers/issues/340
											self.assertListEqual([tokenizer.tokenize(A__					) for t in ["""Test""", """\xad""", """test"""]]     , [["""[UNK]"""], [], ["""[UNK]"""]]					)

											self.assertListEqual(
											    [rust_tokenizer.tokenize(A__					) for t in ["""Test""", """\xad""", """test"""]]     , [["""[UNK]"""], [], ["""[UNK]"""]]					)



				@slow
				def 			__magic_name__					(self					)      ->	Any:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Tuple     =     self.tokenizer_class.from_pretrained("""google/mobilebert-uncased"""					)

											SCREAMING_SNAKE_CASE__		: str     =     tokenizer.encode("""sequence builders"""     , add_special_tokens=A__					)
											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     tokenizer.encode("""multi-sequence build"""     , add_special_tokens=A__					)

											SCREAMING_SNAKE_CASE__		: List[Any]     =     tokenizer.build_inputs_with_special_tokens(A__					)
											SCREAMING_SNAKE_CASE__		: Optional[Any]     =     tokenizer.build_inputs_with_special_tokens(A__     , A__					)

											assert encoded_sentence == [1_01] + text + [1_02]
											assert encoded_pair == [1_01] + text + [1_02] + text_a + [1_02]



				def 			__magic_name__					(self					)      ->	List[str]:



											"""simple docstring"""




											for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
																		with self.subTest(F'''{tokenizer.__class__.__name__} ({pretrained_name})'''					):
																									SCREAMING_SNAKE_CASE__		: Dict     =     self.rust_tokenizer_class.from_pretrained(A__     , **A__					)

																									SCREAMING_SNAKE_CASE__		: str     =     F'''A, naïve {tokenizer_r.mask_token} AllenNLP sentence.'''
																									SCREAMING_SNAKE_CASE__		: str     =     tokenizer_r.encode_plus(
																									    A__     , return_attention_mask=A__     , return_token_type_ids=A__     , return_offsets_mapping=A__     , add_special_tokens=A__     , )

																									SCREAMING_SNAKE_CASE__		: List[Any]     =     tokenizer_r.do_lower_case if hasattr(A__     , """do_lower_case"""					) else False
																									SCREAMING_SNAKE_CASE__		: List[Any]     =     (
																									    [
																									        ((0, 0), tokenizer_r.cls_token),
																									        ((0, 1), """A"""),
																									        ((1, 2), ""","""),
																									        ((3, 5), """na"""),
																									        ((5, 6), """##ï"""),
																									        ((6, 8), """##ve"""),
																									        ((9, 15), tokenizer_r.mask_token),
																									        ((16, 21), """Allen"""),
																									        ((21, 23), """##NL"""),
																									        ((23, 24), """##P"""),
																									        ((25, 33), """sentence"""),
																									        ((33, 34), """."""),
																									        ((0, 0), tokenizer_r.sep_token),
																									    ]
																									    if not do_lower_case
																									    else [
																									        ((0, 0), tokenizer_r.cls_token),
																									        ((0, 1), """a"""),
																									        ((1, 2), ""","""),
																									        ((3, 8), """naive"""),
																									        ((9, 15), tokenizer_r.mask_token),
																									        ((16, 21), """allen"""),
																									        ((21, 23), """##nl"""),
																									        ((23, 24), """##p"""),
																									        ((25, 33), """sentence"""),
																									        ((33, 34), """."""),
																									        ((0, 0), tokenizer_r.sep_token),
																									    ]
																									)

																									self.assertEqual(
																									    [e[1] for e in expected_results]     , tokenizer_r.convert_ids_to_tokens(tokens["""input_ids"""]					)					)
																									self.assertEqual([e[0] for e in expected_results]     , tokens["""offset_mapping"""]					)



				def 			__magic_name__					(self					)      ->	Any:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: str     =     ["""的""", """人""", """有"""]
											SCREAMING_SNAKE_CASE__		: Optional[int]     =     """""".join(A__					)
											for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
																		with self.subTest(F'''{tokenizer.__class__.__name__} ({pretrained_name})'''					):
																									SCREAMING_SNAKE_CASE__		: Optional[int]     =     True
																									SCREAMING_SNAKE_CASE__		: Any     =     self.tokenizer_class.from_pretrained(A__     , **A__					)
																									SCREAMING_SNAKE_CASE__		: List[str]     =     self.rust_tokenizer_class.from_pretrained(A__     , **A__					)

																									SCREAMING_SNAKE_CASE__		: int     =     tokenizer_p.encode(A__     , add_special_tokens=A__					)
																									SCREAMING_SNAKE_CASE__		: Optional[Any]     =     tokenizer_r.encode(A__     , add_special_tokens=A__					)

																									SCREAMING_SNAKE_CASE__		: Tuple     =     tokenizer_r.convert_ids_to_tokens(A__					)
																									SCREAMING_SNAKE_CASE__		: str     =     tokenizer_p.convert_ids_to_tokens(A__					)

																									# it is expected that each Chinese character is not preceded by "##"
																									self.assertListEqual(A__     , A__					)
																									self.assertListEqual(A__     , A__					)

																									SCREAMING_SNAKE_CASE__		: str     =     False
																									SCREAMING_SNAKE_CASE__		: Any     =     self.rust_tokenizer_class.from_pretrained(A__     , **A__					)
																									SCREAMING_SNAKE_CASE__		: List[Any]     =     self.tokenizer_class.from_pretrained(A__     , **A__					)

																									SCREAMING_SNAKE_CASE__		: int     =     tokenizer_r.encode(A__     , add_special_tokens=A__					)
																									SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     tokenizer_p.encode(A__     , add_special_tokens=A__					)

																									SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     tokenizer_r.convert_ids_to_tokens(A__					)
																									SCREAMING_SNAKE_CASE__		: str     =     tokenizer_p.convert_ids_to_tokens(A__					)

																									# it is expected that only the first Chinese character is not preceded by "##".
																									SCREAMING_SNAKE_CASE__		: Any     =     [
																									    F'''##{token}''' if idx != 0 else token for idx, token in enumerate(A__					)
																									]
																									self.assertListEqual(A__     , A__					)
																									self.assertListEqual(A__     , A__					)






"""simple docstring"""




from manim import *



class 			lowerCAmelCase_		(a__						):


				"""simple docstring"""



				def 			__magic_name__					(self					)      ->	Any:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Dict     =     Rectangle(height=0.5     , width=0.5					)
											SCREAMING_SNAKE_CASE__		: Dict     =     Rectangle(height=0.46     , width=0.46					).set_stroke(width=0					)

											SCREAMING_SNAKE_CASE__		: Optional[Any]     =     Rectangle(height=0.25     , width=0.25					)

											SCREAMING_SNAKE_CASE__		: Any     =     [mem.copy() for i in range(6					)]
											SCREAMING_SNAKE_CASE__		: int     =     [mem.copy() for i in range(6					)]
											SCREAMING_SNAKE_CASE__		: Any     =     VGroup(*SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0					)
											SCREAMING_SNAKE_CASE__		: Any     =     VGroup(*SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0					)
											SCREAMING_SNAKE_CASE__		: Optional[int]     =     VGroup(SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0					)
											SCREAMING_SNAKE_CASE__		: List[str]     =     Text("""CPU"""     , font_size=24					)
											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     Group(SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0.5     , aligned_edge=SCREAMING_SNAKE_CASE__					)
											cpu.move_to([-2.5, -0.5, 0]					)
											self.add(SCREAMING_SNAKE_CASE__					)

											SCREAMING_SNAKE_CASE__		: List[Any]     =     [mem.copy() for i in range(4					)]
											SCREAMING_SNAKE_CASE__		: List[Any]     =     VGroup(*SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0					)
											SCREAMING_SNAKE_CASE__		: Any     =     Text("""GPU"""     , font_size=24					)
											SCREAMING_SNAKE_CASE__		: int     =     Group(SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0.5     , aligned_edge=SCREAMING_SNAKE_CASE__					)
											gpu.move_to([-1, -1, 0]					)
											self.add(SCREAMING_SNAKE_CASE__					)

											SCREAMING_SNAKE_CASE__		: List[Any]     =     [mem.copy() for i in range(6					)]
											SCREAMING_SNAKE_CASE__		: Optional[Any]     =     VGroup(*SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0					)

											SCREAMING_SNAKE_CASE__		: Tuple     =     Text("""Model"""     , font_size=24					)
											SCREAMING_SNAKE_CASE__		: Dict     =     Group(SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0.5     , aligned_edge=SCREAMING_SNAKE_CASE__					)
											model.move_to([3, -1.0, 0]					)
											self.add(SCREAMING_SNAKE_CASE__					)

											SCREAMING_SNAKE_CASE__		: Optional[Any]     =     []
											SCREAMING_SNAKE_CASE__		: Any     =     []

											for i, rect in enumerate(SCREAMING_SNAKE_CASE__					):
																		SCREAMING_SNAKE_CASE__		: List[str]     =     fill.copy().set_fill(SCREAMING_SNAKE_CASE__     , opacity=0.8					)
																		target.move_to(SCREAMING_SNAKE_CASE__					)
																		model_arr.append(SCREAMING_SNAKE_CASE__					)

																		SCREAMING_SNAKE_CASE__		: List[str]     =     Rectangle(height=0.46     , width=0.46					).set_stroke(width=0.0					).set_fill(SCREAMING_SNAKE_CASE__     , opacity=0.8					)
																		cpu_target.move_to(cpu_left_col_base[i]					)
																		model_cpu_arr.append(SCREAMING_SNAKE_CASE__					)

											self.add(*SCREAMING_SNAKE_CASE__     , *SCREAMING_SNAKE_CASE__					)

											SCREAMING_SNAKE_CASE__		: Tuple     =     [meta_mem.copy() for i in range(6					)]
											SCREAMING_SNAKE_CASE__		: List[str]     =     [meta_mem.copy() for i in range(6					)]
											SCREAMING_SNAKE_CASE__		: Any     =     VGroup(*SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0					)
											SCREAMING_SNAKE_CASE__		: int     =     VGroup(*SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0					)
											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     VGroup(SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0					)
											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     Text("""Disk"""     , font_size=24					)
											SCREAMING_SNAKE_CASE__		: Any     =     Group(SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__					).arrange(SCREAMING_SNAKE_CASE__     , buff=0.5     , aligned_edge=SCREAMING_SNAKE_CASE__					)
											disk.move_to([-4, -1.25, 0]					)
											self.add(SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__					)

											SCREAMING_SNAKE_CASE__		: Any     =     Square(side_length=2.2					)
											key.move_to([-5, 2, 0]					)

											SCREAMING_SNAKE_CASE__		: List[str]     =     MarkupText(
											    F'''<b>Key:</b>\n\n<span fgcolor=\'{YELLOW}\'>●</span> Empty Model'''     , font_size=18     , )

											key_text.move_to([-5, 2.4, 0]					)

											self.add(SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__					)

											SCREAMING_SNAKE_CASE__		: Any     =     MarkupText(
											    F'''<span fgcolor=\'{BLUE}\'>●</span> Checkpoint'''     , font_size=18     , )

											blue_text.next_to(SCREAMING_SNAKE_CASE__     , DOWN * 2.4     , aligned_edge=key_text.get_left()					)
											self.add(SCREAMING_SNAKE_CASE__					)

											SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     MarkupText(
											    F'''Now watch as an input is passed through the model\nand how the memory is utilized and handled.'''     , font_size=24     , )
											step_a.move_to([2, 2, 0]					)

											self.play(Write(SCREAMING_SNAKE_CASE__					)					)

											SCREAMING_SNAKE_CASE__		: Dict     =     Square(0.3					)
											input.set_fill(SCREAMING_SNAKE_CASE__     , opacity=1.0					)
											input.set_stroke(width=0.0					)
											input.next_to(model_base[0]     , SCREAMING_SNAKE_CASE__     , buff=0.5					)

											self.play(Write(SCREAMING_SNAKE_CASE__					)					)

											input.generate_target()
											input.target.next_to(model_arr[0]     , direction=SCREAMING_SNAKE_CASE__     , buff=0.02					)
											self.play(MoveToTarget(SCREAMING_SNAKE_CASE__					)					)

											self.play(FadeOut(SCREAMING_SNAKE_CASE__					)					)

											SCREAMING_SNAKE_CASE__		: Optional[Any]     =     Arrow(start=SCREAMING_SNAKE_CASE__     , end=SCREAMING_SNAKE_CASE__     , color=SCREAMING_SNAKE_CASE__     , buff=0.5					)
											a.next_to(model_arr[0].get_left()     , SCREAMING_SNAKE_CASE__     , buff=0.2					)

											model_cpu_arr[0].generate_target()
											model_cpu_arr[0].target.move_to(gpu_rect[0]					)

											SCREAMING_SNAKE_CASE__		: Tuple     =     MarkupText(
											    F'''As the input reaches a layer, the hook triggers\nand weights are moved from the CPU\nto the GPU and back.'''     , font_size=24     , )
											step_a.move_to([2, 2, 0]					)

											self.play(Write(SCREAMING_SNAKE_CASE__     , run_time=3					)					)

											SCREAMING_SNAKE_CASE__		: Tuple     =     {"""run_time""": 1, """fade_in""": True, """fade_out""": True, """buff""": 0.02}

											self.play(
											    Write(SCREAMING_SNAKE_CASE__					)     , Circumscribe(model_arr[0]     , color=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__					)     , Circumscribe(model_cpu_arr[0]     , color=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__					)     , Circumscribe(gpu_rect[0]     , color=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__					)     , )
											self.play(MoveToTarget(model_cpu_arr[0]					)					)

											SCREAMING_SNAKE_CASE__		: Optional[Any]     =     a.copy()
											for i in range(6					):
																		a_c.next_to(model_arr[i].get_right() + 0.02     , SCREAMING_SNAKE_CASE__     , buff=0.2					)

																		input.generate_target()
																		input.target.move_to(model_arr[i].get_right() + 0.02					)

																		SCREAMING_SNAKE_CASE__		: Optional[Any]     =     AnimationGroup(
																		    FadeOut(SCREAMING_SNAKE_CASE__     , run_time=0.5					)     , MoveToTarget(SCREAMING_SNAKE_CASE__     , run_time=0.5					)     , FadeIn(SCREAMING_SNAKE_CASE__     , run_time=0.5					)     , lag_ratio=0.2					)

																		self.play(SCREAMING_SNAKE_CASE__					)

																		model_cpu_arr[i].generate_target()
																		model_cpu_arr[i].target.move_to(cpu_left_col_base[i]					)

																		if i < 5:
																									model_cpu_arr[i + 1].generate_target()
																									model_cpu_arr[i + 1].target.move_to(gpu_rect[0]					)
																									if i >= 1:
																																SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     0.7

																									self.play(
																									    Circumscribe(model_arr[i]     , **SCREAMING_SNAKE_CASE__					)     , Circumscribe(cpu_left_col_base[i]     , **SCREAMING_SNAKE_CASE__					)     , Circumscribe(cpu_left_col_base[i + 1]     , color=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__					)     , Circumscribe(gpu_rect[0]     , color=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__					)     , Circumscribe(model_arr[i + 1]     , color=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__					)     , )
																									if i < 1:
																																self.play(
																																    MoveToTarget(model_cpu_arr[i]					)     , MoveToTarget(model_cpu_arr[i + 1]					)     , )
																									else:
																																self.play(
																																    MoveToTarget(model_cpu_arr[i]     , run_time=0.7					)     , MoveToTarget(model_cpu_arr[i + 1]     , run_time=0.7					)     , )
																		else:
																									model_cpu_arr[i].generate_target()
																									model_cpu_arr[i].target.move_to(cpu_left_col_base[-1]					)
																									input.generate_target()
																									input.target.next_to(model_arr[-1].get_right()     , RIGHT + 0.02     , buff=0.2					)

																									self.play(
																									    Circumscribe(model_arr[-1]     , color=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__					)     , Circumscribe(cpu_left_col_base[-1]     , color=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__					)     , Circumscribe(gpu_rect[0]     , color=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__					)     , )

																									self.play(MoveToTarget(model_cpu_arr[i]					)					)

																		SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     a_c
																		SCREAMING_SNAKE_CASE__		: Optional[Any]     =     a_c.copy()

											input.generate_target()
											input.target.next_to(model_base[-1]     , RIGHT + 0.02     , buff=0.5					)
											self.play(
											    FadeOut(SCREAMING_SNAKE_CASE__					)     , FadeOut(SCREAMING_SNAKE_CASE__     , run_time=0.5					)     , )

											SCREAMING_SNAKE_CASE__		: Dict     =     MarkupText(F'''Inference on a model too large for GPU memory\nis successfully completed.'''     , font_size=24					)
											step_a.move_to([2, 2, 0]					)

											self.play(Write(SCREAMING_SNAKE_CASE__     , run_time=3					)     , MoveToTarget(SCREAMING_SNAKE_CASE__					)					)

											self.wait()




