




'''simple docstring'''







import unittest

import numpy as np
import timeout_decorator  # noqa

from transformers import BlenderbotSmallConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...generation.test_flax_utils import FlaxGenerationTesterMixin
from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor


if is_flax_available():
   import os

   # The slow tests are often failing with OOM error on GPU
   # This makes JAX allocate exactly what is needed on demand, and deallocate memory that is no longer needed
   # but will be slower as stated here https://jax.readthedocs.io/en/latest/gpu_memory_allocation.html
   A     ="""platform"""

   import jax
   import jax.numpy as jnp

   from transformers.models.blenderbot_small.modeling_flax_blenderbot_small import (
       FlaxBlenderbotSmallForConditionalGeneration,
       FlaxBlenderbotSmallModel,
       shift_tokens_right,
   )





def 						snake_case_							(_a	:							Any    ,   _a	:							Dict    ,   _a	:							List[str]=None    ,   _a	:							List[str]=None    ,   _a	:							Any=None    ,   _a	:							Tuple=None    ,   _a	:							Optional[Any]=None    ,   _a	:							Optional[int]=None    ,   ):






    if attention_mask is None:
        UpperCAmelCase			       =		np.where(input_ids != config.pad_token_id    ,   1    ,   0     )
    if decoder_attention_mask is None:
        UpperCAmelCase			       =		np.where(decoder_input_ids != config.pad_token_id    ,   1    ,   0     )
    if head_mask is None:
        UpperCAmelCase			       =		np.ones((config.encoder_layers, config.encoder_attention_heads)     )
    if decoder_head_mask is None:
        UpperCAmelCase			       =		np.ones((config.decoder_layers, config.decoder_attention_heads)     )
    if cross_attn_head_mask is None:
        UpperCAmelCase			       =		np.ones((config.decoder_layers, config.decoder_attention_heads)     )
    return {
        "input_ids": input_ids,
        "decoder_input_ids": decoder_input_ids,
        "attention_mask": attention_mask,
        "decoder_attention_mask": attention_mask,
    }


class 			_a  :
       def __init__(	self						:	Union[str, Any]   ,				lowercase						:	Optional[int]   ,				lowercase						:	Optional[int]=13   ,				lowercase						:	Dict=7   ,				lowercase						:	Optional[Any]=True   ,				lowercase						:	List[Any]=False   ,				lowercase						:	List[str]=99   ,				lowercase						:	List[str]=16   ,				lowercase						:	Tuple=2   ,				lowercase						:	Any=4   ,				lowercase						:	Tuple=4   ,				lowercase						:	Tuple="gelu"   ,				lowercase						:	Tuple=0.1   ,				lowercase						:	int=0.1   ,				lowercase						:	Union[str, Any]=32   ,				lowercase						:	List[str]=2   ,				lowercase						:	Any=1   ,				lowercase						:	str=0   ,				lowercase						:	Tuple=0.02   ,				):



           '''simple docstring'''

           UpperCAmelCase			       =		parent
           UpperCAmelCase			       =		batch_size
           UpperCAmelCase			       =		seq_length
           UpperCAmelCase			       =		is_training
           UpperCAmelCase			       =		use_labels
           UpperCAmelCase			       =		vocab_size
           UpperCAmelCase			       =		hidden_size
           UpperCAmelCase			       =		num_hidden_layers
           UpperCAmelCase			       =		num_attention_heads
           UpperCAmelCase			       =		intermediate_size
           UpperCAmelCase			       =		hidden_act
           UpperCAmelCase			       =		hidden_dropout_prob
           UpperCAmelCase			       =		attention_probs_dropout_prob
           UpperCAmelCase			       =		max_position_embeddings
           UpperCAmelCase			       =		eos_token_id
           UpperCAmelCase			       =		pad_token_id
           UpperCAmelCase			       =		bos_token_id
           UpperCAmelCase			       =		initializer_range
       def     A      (	self						:	str				):



           '''simple docstring'''

           UpperCAmelCase			       =		np.clip(ids_tensor([self.batch_size, self.seq_length - 1]   ,				self.vocab_size				)   ,				3   ,				self.vocab_size				)
           UpperCAmelCase			       =		np.concatenate((input_ids, 2 * np.ones((self.batch_size, 1)   ,				dtype=np.intaa				))   ,				-1				)

           UpperCAmelCase			       =		shift_tokens_right(lowerCamelCase__   ,				1   ,				2				)

           UpperCAmelCase			       =		BlenderbotSmallConfig(
               vocab_size=self.vocab_size   ,				d_model=self.hidden_size   ,				encoder_layers=self.num_hidden_layers   ,				decoder_layers=self.num_hidden_layers   ,				encoder_attention_heads=self.num_attention_heads   ,				decoder_attention_heads=self.num_attention_heads   ,				encoder_ffn_dim=self.intermediate_size   ,				decoder_ffn_dim=self.intermediate_size   ,				dropout=self.hidden_dropout_prob   ,				attention_dropout=self.attention_probs_dropout_prob   ,				max_position_embeddings=self.max_position_embeddings   ,				eos_token_id=self.eos_token_id   ,				bos_token_id=self.bos_token_id   ,				pad_token_id=self.pad_token_id   ,				initializer_range=self.initializer_range   ,				use_cache=lowerCamelCase__   ,				)
           UpperCAmelCase			       =		prepare_blenderbot_inputs_dict(lowerCamelCase__   ,				lowerCamelCase__   ,				lowerCamelCase__				)
           return config, inputs_dict
       def     A      (	self						:	List[Any]				):



           '''simple docstring'''

           UpperCAmelCase			       =		self.prepare_config_and_inputs()
           return config, inputs_dict
       def     A      (	self						:	Union[str, Any]   ,				lowercase						:	List[str]   ,				lowercase						:	List[Any]   ,				lowercase						:	Dict				):



           '''simple docstring'''

           UpperCAmelCase			       =		20
           UpperCAmelCase			       =		model_class_name(lowerCamelCase__				)

           UpperCAmelCase			       =		model.encode(inputs_dict['''input_ids''']				)

           UpperCAmelCase			       =		(
               inputs_dict["""decoder_input_ids"""],
               inputs_dict["""decoder_attention_mask"""],
           )

           UpperCAmelCase			       =		model.init_cache(decoder_input_ids.shape[0]   ,				lowerCamelCase__   ,				lowerCamelCase__				)
           UpperCAmelCase			       =		jnp.ones((decoder_input_ids.shape[0], max_decoder_length)   ,				dtype='''i4'''				)

           UpperCAmelCase			       =		jnp.broadcast_to(
               jnp.arange(decoder_input_ids.shape[-1] - 1				)[None, :]   ,				(decoder_input_ids.shape[0], decoder_input_ids.shape[-1] - 1)   ,				)
           UpperCAmelCase			       =		model.decode(
               decoder_input_ids[:, :-1]   ,				lowerCamelCase__   ,				decoder_attention_mask=lowerCamelCase__   ,				past_key_values=lowerCamelCase__   ,				decoder_position_ids=lowerCamelCase__   ,				)

           UpperCAmelCase			       =		jnp.array(decoder_input_ids.shape[0] * [[decoder_input_ids.shape[-1] - 1]]   ,				dtype='''i4'''				)
           UpperCAmelCase			       =		model.decode(
               decoder_input_ids[:, -1:]   ,				lowerCamelCase__   ,				decoder_attention_mask=lowerCamelCase__   ,				past_key_values=outputs_cache.past_key_values   ,				decoder_position_ids=lowerCamelCase__   ,				)

           UpperCAmelCase			       =		model.decode(lowerCamelCase__   ,				lowerCamelCase__				)

           UpperCAmelCase			       =		np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])				)				)
           self.parent.assertTrue(diff < 1E-3   ,				msg=f"Max diff is {diff}"				)







       def     A      (	self						:	Optional[Any]   ,				lowercase						:	Optional[int]   ,				lowercase						:	Optional[int]   ,				lowercase						:	str				):



           '''simple docstring'''

           UpperCAmelCase			       =		20
           UpperCAmelCase			       =		model_class_name(lowerCamelCase__				)

           UpperCAmelCase			       =		model.encode(inputs_dict['''input_ids''']				)

           UpperCAmelCase			       =		(
               inputs_dict["""decoder_input_ids"""],
               inputs_dict["""decoder_attention_mask"""],
           )

           UpperCAmelCase			       =		jnp.concatenate(
               [
                   decoder_attention_mask,
                   jnp.zeros((decoder_attention_mask.shape[0], max_decoder_length - decoder_attention_mask.shape[1])				),
               ]   ,				axis=-1   ,				)

           UpperCAmelCase			       =		model.init_cache(decoder_input_ids.shape[0]   ,				lowerCamelCase__   ,				lowerCamelCase__				)
           UpperCAmelCase			       =		jnp.broadcast_to(
               jnp.arange(decoder_input_ids.shape[-1] - 1				)[None, :]   ,				(decoder_input_ids.shape[0], decoder_input_ids.shape[-1] - 1)   ,				)

           UpperCAmelCase			       =		model.decode(
               decoder_input_ids[:, :-1]   ,				lowerCamelCase__   ,				decoder_attention_mask=lowerCamelCase__   ,				past_key_values=lowerCamelCase__   ,				decoder_position_ids=lowerCamelCase__   ,				)
           UpperCAmelCase			       =		jnp.array(decoder_input_ids.shape[0] * [[decoder_input_ids.shape[-1] - 1]]   ,				dtype='''i4'''				)
           UpperCAmelCase			       =		model.decode(
               decoder_input_ids[:, -1:]   ,				lowerCamelCase__   ,				past_key_values=outputs_cache.past_key_values   ,				decoder_attention_mask=lowerCamelCase__   ,				decoder_position_ids=lowerCamelCase__   ,				)

           UpperCAmelCase			       =		model.decode(lowerCamelCase__   ,				lowerCamelCase__   ,				decoder_attention_mask=lowerCamelCase__				)

           UpperCAmelCase			       =		np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])				)				)
           self.parent.assertTrue(diff < 1E-3   ,				msg=f"Max diff is {diff}"				)






@require_flax
class 			_a  (	unittest.TestCase ):
       __a				:     List[str]   				=					99
       def     A      (	self						:	List[str]				):



           '''simple docstring'''

           UpperCAmelCase			       =		np.array(
               [
                   [71, 82, 18, 33, 46, 91, 2],
                   [68, 34, 26, 58, 30, 82, 2],
                   [5, 97, 17, 39, 94, 40, 2],
                   [76, 83, 94, 25, 70, 78, 2],
                   [87, 59, 41, 35, 48, 66, 2],
                   [55, 13, 16, 58, 5, 2, 1],  # note padding
                   [64, 27, 31, 51, 12, 75, 2],
                   [52, 64, 86, 17, 83, 39, 2],
                   [48, 61, 9, 24, 71, 82, 2],
                   [26, 1, 60, 48, 22, 13, 2],
                   [21, 5, 62, 28, 14, 76, 2],
                   [45, 98, 37, 86, 59, 48, 2],
                   [70, 70, 50, 9, 28, 0, 2],
               ]   ,				dtype=np.intaa   ,				)

           UpperCAmelCase			       =		input_ids.shape[0]
           UpperCAmelCase			       =		BlenderbotSmallConfig(
               vocab_size=self.vocab_size   ,				d_model=24   ,				encoder_layers=2   ,				decoder_layers=2   ,				encoder_attention_heads=2   ,				decoder_attention_heads=2   ,				encoder_ffn_dim=32   ,				decoder_ffn_dim=32   ,				max_position_embeddings=48   ,				eos_token_id=2   ,				pad_token_id=1   ,				bos_token_id=0   ,				)
           return config, input_ids, batch_size
       def     A      (	self						:	Optional[int]				):



           '''simple docstring'''

           UpperCAmelCase			       =		self._get_config_and_data()
           UpperCAmelCase			       =		FlaxBlenderbotSmallForConditionalGeneration(lowerCamelCase__				)
           UpperCAmelCase			       =		lm_model(input_ids=lowerCamelCase__				)
           UpperCAmelCase			       =		(batch_size, input_ids.shape[1], config.vocab_size)
           self.assertEqual(outputs['''logits'''].shape   ,				lowerCamelCase__				)
       def     A      (	self						:	str				):



           '''simple docstring'''

           UpperCAmelCase			       =		BlenderbotSmallConfig(
               vocab_size=self.vocab_size   ,				d_model=14   ,				encoder_layers=2   ,				decoder_layers=2   ,				encoder_attention_heads=2   ,				decoder_attention_heads=2   ,				encoder_ffn_dim=8   ,				decoder_ffn_dim=8   ,				max_position_embeddings=48   ,				)
           UpperCAmelCase			       =		FlaxBlenderbotSmallForConditionalGeneration(lowerCamelCase__				)
           UpperCAmelCase			       =		np.array([[71, 82, 18, 33, 46, 91, 2], [68, 34, 26, 58, 30, 2, 1]]   ,				dtype=np.intaa				)
           UpperCAmelCase			       =		np.array([[82, 71, 82, 18, 2], [58, 68, 2, 1, 1]]   ,				dtype=np.intaa				)
           UpperCAmelCase			       =		lm_model(input_ids=lowerCamelCase__   ,				decoder_input_ids=lowerCamelCase__				)
           UpperCAmelCase			       =		(*summary.shape, config.vocab_size)
           self.assertEqual(outputs['''logits'''].shape   ,				lowerCamelCase__				)







       def     A      (	self						:	List[str]				):



           '''simple docstring'''

           UpperCAmelCase			       =		np.array([[71, 82, 18, 33, 2, 1, 1], [68, 34, 26, 58, 30, 82, 2]]   ,				dtype=np.intaa				)
           UpperCAmelCase			       =		shift_tokens_right(lowerCamelCase__   ,				1   ,				2				)
           UpperCAmelCase			       =		np.equal(lowerCamelCase__   ,				1				).astype(np.floataa				).sum()
           UpperCAmelCase			       =		np.equal(lowerCamelCase__   ,				1				).astype(np.floataa				).sum()
           self.assertEqual(shifted.shape   ,				input_ids.shape				)
           self.assertEqual(lowerCamelCase__   ,				n_pad_before - 1				)
           self.assertTrue(np.equal(shifted[:, 0]   ,				2				).all()				)






@require_flax
class 			_a  (	SCREAMING_SNAKE_CASE__							,							unittest.TestCase							,							SCREAMING_SNAKE_CASE__ ):
       __a				:     Optional[int]   				=					True
       __a				:     List[Any]   				=					(
           (
               FlaxBlenderbotSmallModel,
               FlaxBlenderbotSmallForConditionalGeneration,
           )
           if is_flax_available()
           else ()
       )
       __a				:     List[Any]   				=					(FlaxBlenderbotSmallForConditionalGeneration,) if is_flax_available() else ()
       def     A      (	self						:	Any				):



           '''simple docstring'''

           UpperCAmelCase			       =		FlaxBlenderbotSmallModelTester(self				)
       def     A      (	self						:	Union[str, Any]				):



           '''simple docstring'''

           UpperCAmelCase			       =		self.model_tester.prepare_config_and_inputs()
           for model_class in self.all_model_classes:
               self.model_tester.check_use_cache_forward(lowerCamelCase__   ,				lowerCamelCase__   ,				lowerCamelCase__				)
       def     A      (	self						:	Any				):



           '''simple docstring'''

           UpperCAmelCase			       =		self.model_tester.prepare_config_and_inputs()
           for model_class in self.all_model_classes:
               self.model_tester.check_use_cache_forward_with_attn_mask(lowerCamelCase__   ,				lowerCamelCase__   ,				lowerCamelCase__				)
       def     A      (	self						:	str				):



           '''simple docstring'''

           UpperCAmelCase			       =		self.model_tester.prepare_config_and_inputs_for_common()

           for model_class in self.all_model_classes:
               with self.subTest(model_class.__name__				):
                   UpperCAmelCase			       =		self._prepare_for_class(lowerCamelCase__   ,				lowerCamelCase__				)
                   UpperCAmelCase			       =		model_class(lowerCamelCase__				)

                   @jax.jit
                   def encode_jitted(lowercase						:	int   ,				lowercase						:	Tuple=None   ,				**lowercase						:	Any				):
                       return model.encode(input_ids=lowerCamelCase__   ,				attention_mask=lowerCamelCase__				)

                   with self.subTest('''JIT Enabled'''				):
                       UpperCAmelCase			       =		encode_jitted(**lowerCamelCase__				).to_tuple()

                   with self.subTest('''JIT Disabled'''				):
                       with jax.disable_jit():
                           UpperCAmelCase			       =		encode_jitted(**lowerCamelCase__				).to_tuple()

                   self.assertEqual(len(lowerCamelCase__				)   ,				len(lowerCamelCase__				)				)
                   for jitted_output, output in zip(lowerCamelCase__   ,				lowerCamelCase__				):
                       self.assertEqual(jitted_output.shape   ,				output.shape				)
       def     A      (	self						:	str				):



           '''simple docstring'''

           UpperCAmelCase			       =		self.model_tester.prepare_config_and_inputs_for_common()

           for model_class in self.all_model_classes:
               with self.subTest(model_class.__name__				):
                   UpperCAmelCase			       =		model_class(lowerCamelCase__				)
                   UpperCAmelCase			       =		model.encode(inputs_dict['''input_ids''']   ,				inputs_dict['''attention_mask''']				)

                   UpperCAmelCase			       =		{
                       """decoder_input_ids""": inputs_dict["""decoder_input_ids"""],
                       """decoder_attention_mask""": inputs_dict["""decoder_attention_mask"""],
                       """encoder_outputs""": encoder_outputs,
                   }

                   @jax.jit
                   def decode_jitted(lowercase						:	Union[str, Any]   ,				lowercase						:	int   ,				lowercase						:	Optional[Any]				):
                       return model.decode(
                           decoder_input_ids=lowerCamelCase__   ,				decoder_attention_mask=lowerCamelCase__   ,				encoder_outputs=lowerCamelCase__   ,				)

                   with self.subTest('''JIT Enabled'''				):
                       UpperCAmelCase			       =		decode_jitted(**lowerCamelCase__				).to_tuple()

                   with self.subTest('''JIT Disabled'''				):
                       with jax.disable_jit():
                           UpperCAmelCase			       =		decode_jitted(**lowerCamelCase__				).to_tuple()

                   self.assertEqual(len(lowerCamelCase__				)   ,				len(lowerCamelCase__				)				)
                   for jitted_output, output in zip(lowerCamelCase__   ,				lowerCamelCase__				):
                       self.assertEqual(jitted_output.shape   ,				output.shape				)







       @slow
       def     A      (	self						:	Tuple				):



           '''simple docstring'''

           for model_class_name in self.all_model_classes:
               UpperCAmelCase			       =		model_class_name.from_pretrained('''facebook/blenderbot_small-90M'''				)
               # FlaxBlenderbotForSequenceClassification expects eos token in input_ids
               UpperCAmelCase			       =		np.ones((1, 1)				) * model.config.eos_token_id
               UpperCAmelCase			       =		model(lowerCamelCase__				)
               self.assertIsNotNone(lowerCamelCase__				)









from manim import *






class SCREAMING_SNAKE_CASE__     (		SCREAMING_SNAKE_CASE__    ):




    '''simple docstring'''






    def 			_lowerCAmelCase					(       self		):
        A :       Union[str, Any]          =   Rectangle(height=0.5,		width=0.5		)
        A :       Optional[int]          =   Rectangle(height=0.25,		width=0.25		)
        A :       Optional[Any]          =   Rectangle(height=0.46,		width=0.46		).set_stroke(width=0		)

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

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

        A :       Optional[int]          =   [mem.copy() for i in range(6		)]
        A :       List[str]          =   VGroup(*lowerCamelCase__		).arrange(lowerCamelCase__,		buff=0		)

        A :       Optional[int]          =   Text("""Model""",		font_size=24		)
        A :       List[Any]          =   Group(lowerCamelCase__,		lowerCamelCase__		).arrange(lowerCamelCase__,		buff=0.5,		aligned_edge=lowerCamelCase__		)
        model.move_to([3, -1.0, 0]		)
        self.add(lowerCamelCase__		)

        A :       Tuple          =   []
        A :       Tuple          =   []
        A :       Any          =   []

        for i, rect in enumerate(lowerCamelCase__		):
            rect.set_stroke(lowerCamelCase__		)

            A :       Any          =   Rectangle(height=0.46 / 4,		width=0.46 / 3		).set_stroke(width=0.0		).set_fill(lowerCamelCase__,		opacity=0.7		)

            if i == 0:
                cpu_target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT		),		buff=0.02,		direction=lowerCamelCase__		)
                cpu_target.set_x(cpu_target.get_x() + 0.1		)
            elif i == 3:
                cpu_target.next_to(model_cpu_arr[0],		direction=lowerCamelCase__,		buff=0.0		)
            else:
                cpu_target.next_to(model_cpu_arr[i - 1],		direction=lowerCamelCase__,		buff=0.0		)
            self.add(lowerCamelCase__		)
            model_cpu_arr.append(lowerCamelCase__		)

        self.add(*lowerCamelCase__,		*lowerCamelCase__,		*lowerCamelCase__		)

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

        A :       str          =   Text("""Loaded Checkpoint""",		font_size=24		)
        A :       List[str]          =   Group(lowerCamelCase__,		lowerCamelCase__		).arrange(lowerCamelCase__,		buff=0.5,		aligned_edge=lowerCamelCase__		)
        checkpoint.move_to([3, 0.5, 0]		)

        self.add(lowerCamelCase__		)

        A :       Optional[int]          =   []
        A :       List[Any]          =   []

        for i, rect in enumerate(lowerCamelCase__		):
            A :       int          =   fill.copy().set_fill(lowerCamelCase__,		opacity=0.7		)
            target.move_to(lowerCamelCase__		)
            ckpt_arr.append(lowerCamelCase__		)

            A :       List[Any]          =   target.copy()
            if i < 5:
                cpu_target.move_to(cpu_left_col_base[i + 1]		)
            else:
                cpu_target.move_to(cpu_right_col_base[i - 5]		)
            ckpt_cpu_arr.append(lowerCamelCase__		)
        self.add(*lowerCamelCase__,		*lowerCamelCase__		)

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

        A :       List[Any]          =   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(lowerCamelCase__,		lowerCamelCase__		)

        A :       Union[str, Any]          =   MarkupText(
            f'''<span fgcolor=\'{BLUE}\'>●</span> Checkpoint''',		font_size=18,		)

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

        A :       List[str]          =   MarkupText(
            f'''Based on the passed in configuration, weights are stored in\na variety of np.memmaps on disk or to a particular device.''',		font_size=24,		)
        step_a.move_to([2, 2, 0]		)

        A :       List[str]          =   [meta_mem.copy() for i in range(6		)]
        A :       List[Any]          =   [meta_mem.copy() for i in range(6		)]
        A :       List[Any]          =   VGroup(*lowerCamelCase__		).arrange(lowerCamelCase__,		buff=0		)
        A :       List[str]          =   VGroup(*lowerCamelCase__		).arrange(lowerCamelCase__,		buff=0		)
        A :       Dict          =   VGroup(lowerCamelCase__,		lowerCamelCase__		).arrange(lowerCamelCase__,		buff=0		)
        A :       Optional[Any]          =   Text("""Disk""",		font_size=24		)
        A :       List[str]          =   Group(lowerCamelCase__,		lowerCamelCase__		).arrange(lowerCamelCase__,		buff=0.5,		aligned_edge=lowerCamelCase__		)
        disk.move_to([-4.0, -1.25, 0]		)
        self.play(Write(lowerCamelCase__,		run_time=3		),		Write(lowerCamelCase__,		run_time=1		),		Create(lowerCamelCase__,		run_time=1		)		)

        A :       str          =   []
        for i, rect in enumerate(lowerCamelCase__		):
            A :       Optional[Any]          =   rect.copy()
            target.generate_target()
            target.target.move_to(disk_left_col_base[i]		).scale(0.5		)
            animations.append(MoveToTarget(lowerCamelCase__,		run_time=1.5		)		)
        self.play(*lowerCamelCase__		)

        self.play(FadeOut(lowerCamelCase__		)		)

        A :       List[str]          =   MarkupText(f'''Then, the checkpoint is removed from memory\nthrough garbage collection.''',		font_size=24		)
        step_a.move_to([2, 2, 0]		)

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

        self.play(
            FadeOut(lowerCamelCase__,		lowerCamelCase__,		*lowerCamelCase__,		*lowerCamelCase__		),		)

        self.wait()


