Debian Codegraph @

manim_animations/dataloaders/stage_3.py

raw
1 # Copyright 2024 The HuggingFace Team. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 from manim import *
16
17 class Stage3(Scene):
18 def construct(self):
19 step_1 = MarkupText(
20 f"To combat this, Accelerate employs one of two different\nSampler wrapper methods depending on the scenario:",
21 font_size=24
22 )
23 step_1.move_to([0, 1.5, 0])
24 self.add(step_1)
25 step_2 = MarkupText(
26 f"1. Sharding the dataset before drawing:\n\t● <span fgcolor='{RED}'>IterableDatasetShard</span>\n\t● <span fgcolor='{RED}'>BatchSamplerShard</span>",
27 font_size=24,
28 ).next_to(step_1, direction=DOWN, aligned_edge=LEFT)
29 self.add(step_2)
30 step_3 = MarkupText(
31 f"\n\n2. Splitting the batch after drawing:\n\t● <span fgcolor='{BLUE}'>DataLoaderDispatcher</span>",
32 font_size=24,
33 ).next_to(step_2, direction=DOWN, aligned_edge=LEFT)
34 self.add(step_3)