



from manim import *



class 							__snake_case		(	_SCREAMING_SNAKE_CASE		):




							def   UpperCAmelCase__     (			self	:			List[str]):
									lowerCAmelCase_     :	List[Any]							   =					Rectangle(height=0.5							,							width=0.5)
									lowerCAmelCase_     :	Optional[int]							   =					Rectangle(height=0.46							,							width=0.46).set_stroke(width=0)

									lowerCAmelCase_     :	List[Any]							   =					[mem.copy() for i in range(6)]
									lowerCAmelCase_     :	Dict							   =					[mem.copy() for i in range(6)]
									lowerCAmelCase_     :	int							   =					VGroup(*_lowercase).arrange(_lowercase							,							buff=0)
									lowerCAmelCase_     :	Optional[int]							   =					VGroup(*_lowercase).arrange(_lowercase							,							buff=0)
									lowerCAmelCase_     :	Optional[int]							   =					VGroup(_lowercase							,							_lowercase).arrange(_lowercase							,							buff=0)
									lowerCAmelCase_     :	Tuple							   =					Text('''CPU'''							,							font_size=2_4)
									lowerCAmelCase_     :	Any							   =					Group(_lowercase							,							_lowercase).arrange(_lowercase							,							buff=0.5							,							aligned_edge=_lowercase)
									cpu.move_to([-2.5, -0.5, 0])
									self.add(_lowercase)

									lowerCAmelCase_     :	Optional[int]							   =					[mem.copy() for i in range(4)]
									lowerCAmelCase_     :	Any							   =					VGroup(*_lowercase).arrange(_lowercase							,							buff=0)
									lowerCAmelCase_     :	str							   =					Text('''GPU'''							,							font_size=2_4)
									lowerCAmelCase_     :	Tuple							   =					Group(_lowercase							,							_lowercase).arrange(_lowercase							,							buff=0.5							,							aligned_edge=_lowercase)
									gpu.move_to([-1, -1, 0])
									self.add(_lowercase)

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

									lowerCAmelCase_     :	Dict							   =					Text('''Model'''							,							font_size=2_4)
									lowerCAmelCase_     :	Dict							   =					Group(_lowercase							,							_lowercase).arrange(_lowercase							,							buff=0.5							,							aligned_edge=_lowercase)
									model.move_to([3, -1.0, 0])
									self.add(_lowercase)

									lowerCAmelCase_     :	Dict							   =					[]
									for i, rect in enumerate(_lowercase):
											rect.set_stroke(_lowercase)
											# target = fill.copy().set_fill(YELLOW, opacity=0.7)
											# target.move_to(rect)
											# self.add(target)

											lowerCAmelCase_     :	Tuple							   =					Rectangle(height=0.46 / 4							,							width=0.46 / 3).set_stroke(width=0.0).set_fill(_lowercase							,							opacity=0.7)

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

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

									lowerCAmelCase_     :	List[Any]							   =					Text('''Loaded Checkpoint'''							,							font_size=2_4)
									lowerCAmelCase_     :	Dict							   =					Group(_lowercase							,							_lowercase).arrange(_lowercase							,							aligned_edge=_lowercase							,							buff=0.4)
									checkpoint.move_to([3, 0.5, 0])

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

									lowerCAmelCase_     :	str							   =					MarkupText(
									    F"""<b>Key:</b>\n\n<span fgcolor=\'{YELLOW}\'>●</span> Empty Model"""							,							font_size=1_8							,							)

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

									self.add(_lowercase							,							_lowercase)

									lowerCAmelCase_     :	Union[str, Any]							   =					MarkupText(
									    F"""<span fgcolor=\'{BLUE}\'>●</span> Checkpoint"""							,							font_size=1_8							,							)

									blue_text.next_to(_lowercase							,							DOWN * 2.4							,							aligned_edge=key_text.get_left())

									lowerCAmelCase_     :	Any							   =					MarkupText(
									    F"""Next, a <i><span fgcolor=\"{BLUE}\">second</span></i> model is loaded into memory,\nwith the weights of a <span fgcolor=\"{BLUE}\">single shard</span>."""							,							font_size=2_4							,							)
									step_a.move_to([2, 2, 0])
									self.play(Write(_lowercase)							,							Write(_lowercase))

									self.play(Write(_lowercase							,							run_time=1)							,							Create(_lowercase							,							run_time=1))

									lowerCAmelCase_     :	Optional[int]							   =					[]
									lowerCAmelCase_     :	List[Any]							   =					[]
									for i, rect in enumerate(_lowercase):
											lowerCAmelCase_     :	Tuple							   =					fill.copy().set_fill(_lowercase							,							opacity=0.7)
											target.move_to(_lowercase)
											first_animations.append(GrowFromCenter(_lowercase							,							run_time=1))

											lowerCAmelCase_     :	Dict							   =					target.copy()
											cpu_target.generate_target()
											if i < 5:
													cpu_target.target.move_to(cpu_left_col_base[i + 1])
											else:
													cpu_target.target.move_to(cpu_right_col_base[i - 5])
											second_animations.append(MoveToTarget(_lowercase							,							run_time=1.5))

									self.play(*_lowercase)
									self.play(*_lowercase)
									self.wait()







'''simple docstring'''



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


_lowercase          =						logging.get_logger(__name__)

_lowercase          =						{
    """facebook/dpr-ctx_encoder-single-nq-base""": (
        """https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main/config.json"""
    ),
    """facebook/dpr-question_encoder-single-nq-base""": (
        """https://huggingface.co/facebook/dpr-question_encoder-single-nq-base/resolve/main/config.json"""
    ),
    """facebook/dpr-reader-single-nq-base""": (
        """https://huggingface.co/facebook/dpr-reader-single-nq-base/resolve/main/config.json"""
    ),
    """facebook/dpr-ctx_encoder-multiset-base""": (
        """https://huggingface.co/facebook/dpr-ctx_encoder-multiset-base/resolve/main/config.json"""
    ),
    """facebook/dpr-question_encoder-multiset-base""": (
        """https://huggingface.co/facebook/dpr-question_encoder-multiset-base/resolve/main/config.json"""
    ),
    """facebook/dpr-reader-multiset-base""": (
        """https://huggingface.co/facebook/dpr-reader-multiset-base/resolve/main/config.json"""
    ),
}




class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: str										=  '''dpr'''




						def __init__(   self       ,  _lowercase=30_522       ,  _lowercase=768       ,  _lowercase=12       ,  _lowercase=12       ,  _lowercase=3_072       ,  _lowercase="gelu"       ,  _lowercase=0.1       ,  _lowercase=0.1       ,  _lowercase=512       ,  _lowercase=2       ,  _lowercase=0.02       ,  _lowercase=1e-12       ,  _lowercase=0       ,  _lowercase="absolute"       ,  _lowercase = 0       ,  **_lowercase       ,  ):

												"""simple docstring"""



												super().__init__(pad_token_id=_lowercase       ,  **_lowercase )

												_lowerCAmelCase    		=					vocab_size
												_lowerCAmelCase    		=					hidden_size
												_lowerCAmelCase    		=					num_hidden_layers
												_lowerCAmelCase    		=					num_attention_heads
												_lowerCAmelCase    		=					hidden_act
												_lowerCAmelCase    		=					intermediate_size
												_lowerCAmelCase    		=					hidden_dropout_prob
												_lowerCAmelCase    		=					attention_probs_dropout_prob
												_lowerCAmelCase    		=					max_position_embeddings
												_lowerCAmelCase    		=					type_vocab_size
												_lowerCAmelCase    		=					initializer_range
												_lowerCAmelCase    		=					layer_norm_eps
												_lowerCAmelCase    		=					projection_dim
												_lowerCAmelCase    		=					position_embedding_type
