Commit
•
9cd761d
1
Parent(s):
73927d2
Adding all exports
Browse files- Latency_and_Throughput_Manim.ipynb +116 -132
Latency_and_Throughput_Manim.ipynb
CHANGED
@@ -28,30 +28,68 @@
|
|
28 |
},
|
29 |
{
|
30 |
"cell_type": "code",
|
31 |
-
"execution_count":
|
32 |
"id": "f8ffa0be-d1ae-4b1d-8827-01e11ef5be68",
|
33 |
"metadata": {
|
34 |
"tags": []
|
35 |
},
|
36 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
"source": [
|
38 |
"!wget -O user.svg https://pic.onlinewebfonts.com/thumbnails/icons_308642.svg"
|
39 |
]
|
40 |
},
|
41 |
{
|
42 |
-
"cell_type": "
|
43 |
-
"
|
44 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
"source": [
|
46 |
-
"
|
47 |
-
"\n",
|
48 |
-
"The second line controls the maximum width used to display videos in this notebook, and the third line controls the verbosity of the log output. Feel free to adapt both of these settings to your liking."
|
49 |
]
|
50 |
},
|
51 |
{
|
52 |
"cell_type": "code",
|
53 |
-
"execution_count":
|
54 |
-
"id": "
|
55 |
"metadata": {
|
56 |
"tags": []
|
57 |
},
|
@@ -63,22 +101,28 @@
|
|
63 |
"config.verbosity = \"WARNING\""
|
64 |
]
|
65 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
{
|
67 |
"cell_type": "code",
|
68 |
-
"execution_count": null,
|
69 |
"id": "257cf337-948e-4ef7-aae3-2fb7b5b58602",
|
70 |
"metadata": {
|
71 |
"tags": []
|
72 |
},
|
73 |
-
"outputs": [],
|
74 |
"source": [
|
75 |
-
"%%manim -qm --format
|
76 |
"\n",
|
77 |
"from manim import *\n",
|
78 |
"\n",
|
79 |
"text = \"The cake is a lie\"\n",
|
80 |
"text_list = text.split(\" \")\n",
|
81 |
-
"rounds =
|
82 |
"class LatencyVisualization(Scene):\n",
|
83 |
"\n",
|
84 |
" def construct(self):\n",
|
@@ -127,139 +171,48 @@
|
|
127 |
" # Conclusion\n",
|
128 |
" self.wait(2)\n",
|
129 |
" self.play(FadeOut(conclusion_text), FadeOut(llm_box), FadeOut(llm_text), FadeOut(user), FadeOut(timer_text))\n"
|
130 |
-
]
|
|
|
|
|
131 |
},
|
132 |
{
|
133 |
-
"cell_type": "
|
134 |
-
"id": "
|
135 |
"metadata": {},
|
136 |
"source": [
|
137 |
-
"
|
138 |
-
]
|
|
|
|
|
139 |
},
|
140 |
{
|
141 |
"cell_type": "code",
|
142 |
-
"
|
143 |
-
"
|
144 |
-
"metadata": {
|
145 |
-
"tags": []
|
146 |
-
},
|
147 |
-
"outputs": [],
|
148 |
"source": [
|
149 |
-
"
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
" def construct(self):\n",
|
154 |
-
" # Use Unicode escape sequence for the butterfly emoji\n",
|
155 |
-
" text = Text(\"Butterfly: \\U0001F98B 🦋\", font=\"Apple Color Emoji\")\n",
|
156 |
-
" self.add(text)\n",
|
157 |
-
" self.play(FadeIn(text))\n",
|
158 |
-
" self.wait(2)\n",
|
159 |
-
"\n",
|
160 |
-
"# Render the scene\n",
|
161 |
-
"scene = EmojiScene()\n",
|
162 |
-
"scene.render()\n"
|
163 |
-
]
|
164 |
},
|
165 |
{
|
166 |
-
"cell_type": "
|
167 |
-
"
|
168 |
-
"id": "f0e03d7a-0db1-41aa-8a79-4a9f0f5615e7",
|
169 |
"metadata": {
|
170 |
-
"jupyter": {
|
171 |
-
"outputs_hidden": true
|
172 |
-
},
|
173 |
"tags": []
|
174 |
},
|
175 |
-
"outputs": [],
|
176 |
"source": [
|
177 |
-
"
|
178 |
-
"from manim import *\n",
|
179 |
-
"\n",
|
180 |
-
"class FontDemo(Scene):\n",
|
181 |
-
" def construct(self):\n",
|
182 |
-
" font_names = [\n",
|
183 |
-
" 'Academy Engraved LET', 'Adelle Sans Devanagari', 'AkayaKanadaka', 'AkayaTelivigala',\n",
|
184 |
-
" 'Al Bayan', 'Al Nile', 'Al Tarikh', 'American Typewriter', 'Andale Mono', 'Annai MN',\n",
|
185 |
-
" 'Apple Braille', 'Apple Chancery', 'Apple Color Emoji', 'Apple LiGothic', 'Apple LiSung',\n",
|
186 |
-
" 'Apple SD Gothic Neo', 'Apple Symbols', 'AppleGothic', 'AppleMyungjo', 'Arial', 'Arial Black',\n",
|
187 |
-
" 'Arial Hebrew', 'Arial Hebrew Scholar', 'Arial Narrow', 'Arial Rounded MT Bold', 'Arial Unicode MS',\n",
|
188 |
-
" 'Arima Koshi', 'Arima Madurai', 'Avenir', 'Avenir Next', 'Avenir Next Condensed', 'Ayuthaya',\n",
|
189 |
-
" 'BM Dohyeon', 'BM Hanna 11yrs Old', 'BM Hanna Air', 'BM Hanna Pro', 'BM Jua', 'BM Kirang Haerang',\n",
|
190 |
-
" 'BM Yeonsung', 'Baghdad', 'Bai Jamjuree', 'Baloo 2', 'Baloo Bhai 2', 'Baloo Bhaijaan',\n",
|
191 |
-
" 'Baloo Bhaina 2', 'Baloo Chettan 2', 'Baloo Da 2', 'Baloo Paaji 2', 'Baloo Tamma 2',\n",
|
192 |
-
" 'Baloo Tammudu 2', 'Baloo Thambi 2', 'Bangla MN', 'Bangla Sangam MN', 'Baoli SC', 'Baoli TC',\n",
|
193 |
-
" 'Baskerville', 'Beirut', 'BiauKai', 'Big Caslon', 'Bodoni 72', 'Bodoni 72 Oldstyle',\n",
|
194 |
-
" 'Bodoni 72 Smallcaps', 'Bodoni Ornaments', 'Bradley Hand', 'Brush Script MT', 'Cambay Devanagari',\n",
|
195 |
-
" 'Chakra Petch', 'Chalkboard', 'Chalkboard SE', 'Chalkduster', 'Charm', 'Charmonman', 'Charter',\n",
|
196 |
-
" 'Cochin', 'Comic Sans MS', 'Copperplate', 'Corsiva Hebrew', 'Courier New', 'DIN Alternate',\n",
|
197 |
-
" 'DIN Condensed', 'Damascus', 'DecoType Naskh', 'Devanagari MT', 'Devanagari Sangam MN', 'Didot',\n",
|
198 |
-
" 'Diwan Kufi', 'Diwan Thuluth', 'Euphemia UCAS', 'Fahkwang', 'Farah', 'Farisi', 'Futura',\n",
|
199 |
-
" 'GB18030 Bitmap', 'Galvji', 'Geeza Pro', 'Geneva', 'Georgia', 'Gill Sans', 'Gotu', 'Grantha Sangam MN',\n",
|
200 |
-
" 'Graphik', 'Gujarati MT', 'Gujarati Sangam MN', 'GungSeo', 'Gurmukhi MN', 'Gurmukhi MT',\n",
|
201 |
-
" 'Gurmukhi Sangam MN', 'Hannotate SC', 'Hannotate TC', 'HanziPen SC', 'HanziPen TC', 'HeadLineA',\n",
|
202 |
-
" 'Hei', 'Heiti SC', 'Heiti TC', 'Helvetica', 'Helvetica Neue', 'Herculanum', 'Hiragino Maru Gothic ProN',\n",
|
203 |
-
" 'Hiragino Mincho ProN', 'Hiragino Sans', 'Hiragino Sans CNS', 'Hiragino Sans GB', 'Hoefler Text',\n",
|
204 |
-
" 'Hubballi', 'ITF Devanagari', 'ITF Devanagari Marathi', 'Impact', 'InaiMathi', 'Jaini', 'Jaini Purva',\n",
|
205 |
-
" 'K2D', 'Kai', 'Kailasa', 'Kaiti SC', 'Kaiti TC', 'Kannada MN', 'Kannada Sangam MN', 'Katari',\n",
|
206 |
-
" 'Kavivanar', 'Kefa', 'Khmer MN', 'Khmer Sangam MN', 'Klee', 'KoHo', 'Kodchasan', 'Kohinoor Bangla',\n",
|
207 |
-
" 'Kohinoor Devanagari', 'Kohinoor Gujarati', 'Kohinoor Telugu', 'Kokonor', 'Krub', 'Krungthep',\n",
|
208 |
-
" 'KufiStandardGK', 'Lahore Gurmukhi', 'Lantinghei SC', 'Lantinghei TC', 'Lao MN', 'Lao Sangam MN',\n",
|
209 |
-
" 'Lava Devanagari', 'Lava Kannada', 'Lava Telugu', 'LiHei Pro', 'LiSong Pro', 'Libian SC', 'Libian TC',\n",
|
210 |
-
" 'LingWai SC', 'LingWai TC', 'Lucida Grande', 'Luminari', 'Maku', 'Malayalam MN', 'Malayalam Sangam MN',\n",
|
211 |
-
" 'Mali', 'Marker Felt', 'Menlo', 'Microsoft Sans Serif', 'Mishafi', 'Mishafi Gold', 'Modak', 'Monaco',\n",
|
212 |
-
" 'Monaspace Argon', 'Monaspace Argon Var', 'Monaspace Krypton', 'Monaspace Krypton Var', 'Monaspace Neon',\n",
|
213 |
-
" 'Monaspace Neon Var', 'Monaspace Radon', 'Monaspace Radon Var', 'Monaspace Xenon', 'Monaspace Xenon Var',\n",
|
214 |
-
" 'Monospace', 'Mshtakan', 'Mukta', 'Mukta Mahee', 'Mukta Malar', 'Mukta Vaani', 'Muna', 'Myanmar MN',\n",
|
215 |
-
" 'Myanmar Sangam MN', 'Nadeem', 'Nanum Brush Script', 'Nanum Gothic', 'Nanum Myeongjo', 'Nanum Pen Script',\n",
|
216 |
-
" 'New Peninim MT', 'Niramit', 'Noteworthy', 'Noto Nastaliq Urdu', 'Noto Sans Batak', 'Noto Sans Kannada',\n",
|
217 |
-
" 'Noto Sans Myanmar', 'Noto Sans NKo', 'Noto Sans Oriya', 'Noto Sans Tagalog', 'Noto Serif Kannada',\n",
|
218 |
-
" 'Noto Serif Myanmar', 'October Compressed Devanagari', 'October Compressed Tamil',\n",
|
219 |
-
" 'October Condensed Devanagari', 'October Condensed Tamil', 'October Devanagari', 'October Tamil', 'Optima',\n",
|
220 |
-
" 'Oriya MN', 'Oriya Sangam MN', 'Osaka', 'PCMyungjo', 'PSL Ornanong Pro', 'PT Mono', 'PT Sans',\n",
|
221 |
-
" 'PT Sans Caption', 'PT Sans Narrow', 'PT Serif', 'PT Serif Caption', 'Padyakke Expanded One', 'Palatino',\n",
|
222 |
-
" 'Papyrus', 'Party LET', 'Phosphate', 'PilGi', 'PingFang HK', 'PingFang SC', 'PingFang TC',\n",
|
223 |
-
" 'Plantagenet Cherokee', 'Raanana', 'Rockwell', 'STFangsong', 'STHeiti', 'STIX Two Math', 'STIX Two Text',\n",
|
224 |
-
" 'STKaiti', 'STSong', 'Sama Devanagari', 'Sama Gujarati', 'Sama Gurmukhi', 'Sama Kannada', 'Sama Malayalam',\n",
|
225 |
-
" 'Sama Tamil', 'Sana', 'Sans', 'Sarabun', 'Sathu', 'Savoye LET', 'Serif', 'Shobhika', 'Shree Devanagari 714',\n",
|
226 |
-
" 'SignPainter', 'Silom', 'SimSong', 'Sinhala MN', 'Sinhala Sangam MN', 'Skia', 'Snell Roundhand',\n",
|
227 |
-
" 'Songti SC', 'Songti TC', 'Srisakdi', 'Sukhumvit Set', 'Symbol', 'Tahoma', 'Tamil MN', 'Tamil Sangam MN',\n",
|
228 |
-
" 'Telugu MN', 'Telugu Sangam MN', 'Thonburi', 'Times New Roman', 'Tiro Bangla', 'Tiro Devanagari Hindi',\n",
|
229 |
-
" 'Tiro Devanagari Marathi', 'Tiro Devanagari Sanskrit', 'Tiro Gurmukhi', 'Tiro Kannada', 'Tiro Tamil',\n",
|
230 |
-
" 'Tiro Telugu', 'Toppan Bunkyu Gothic', 'Toppan Bunkyu Midashi Gothic', 'Toppan Bunkyu Midashi Mincho',\n",
|
231 |
-
" 'Toppan Bunkyu Mincho', 'Trattatello', 'Trebuchet MS', 'Tsukushi A Round Gothic', 'Tsukushi B Round Gothic',\n",
|
232 |
-
" 'Verdana', 'Waseem', 'Wawati SC', 'Wawati TC', 'Webdings', 'Wingdings', 'Wingdings 2', 'Wingdings 3',\n",
|
233 |
-
" 'Xingkai SC', 'Xingkai TC', 'YuGothic', 'YuKyokasho', 'YuKyokasho Yoko', 'YuMincho', 'YuMincho +36p Kana',\n",
|
234 |
-
" 'Yuanti SC', 'Yuanti TC', 'Yuppy SC', 'Yuppy TC', 'Zapf Dingbats', 'Zapfino', 'cursive', 'fantasy', 'system-ui'\n",
|
235 |
-
" ]\n",
|
236 |
-
"\n",
|
237 |
-
" texts = []\n",
|
238 |
-
" for font_name in font_names:\n",
|
239 |
-
" text_part = Text(f\"{font_name}: 🦋 \\U0001F98B\", font=font_name).scale(0.75)\n",
|
240 |
-
" combined_text = VGroup(text_part).arrange(RIGHT, buff=0.1)\n",
|
241 |
-
" texts.append(combined_text)\n",
|
242 |
-
"\n",
|
243 |
-
" for i in range(0, len(texts), 15):\n",
|
244 |
-
" batch = VGroup(*texts[i:i+15]).arrange(DOWN, buff=0.5)\n",
|
245 |
-
" batch.scale_to_fit_height(config.frame_height - 1)\n",
|
246 |
-
" self.play(FadeIn(batch))\n",
|
247 |
-
" self.wait(1)\n",
|
248 |
-
" self.play(FadeOut(batch))\n",
|
249 |
-
"\n",
|
250 |
-
" self.wait(2)\n"
|
251 |
]
|
252 |
},
|
253 |
{
|
254 |
"cell_type": "code",
|
255 |
-
"execution_count": null,
|
256 |
"id": "37ad0a6c-e068-4ace-b31f-2c8c1eb8f52b",
|
257 |
"metadata": {
|
258 |
"tags": []
|
259 |
},
|
260 |
-
"outputs": [],
|
261 |
"source": [
|
262 |
-
"%%manim -qm ThroughputVisualization\n",
|
263 |
"\n",
|
264 |
"from manim import *\n",
|
265 |
"\n",
|
@@ -308,22 +261,29 @@
|
|
308 |
" ]\n",
|
309 |
" storage_offsets = [0, 0, 0, 0] # Initialize offsets for each storage position\n",
|
310 |
"\n",
|
311 |
-
" packets =
|
312 |
" \n",
|
313 |
" # Timer setup\n",
|
314 |
" timer = ValueTracker(0)\n",
|
315 |
-
" timer_text = always_redraw(lambda: Text(f\"Time: {timer.get_value():.2f}s\\nThroughput: 4
|
316 |
"\n",
|
317 |
" self.add(timer_text)\n",
|
318 |
"\n",
|
319 |
" def create_packet_group(words):\n",
|
320 |
-
" packet_group =
|
321 |
" for i, word in enumerate(words):\n",
|
322 |
" row, col = divmod(i, 2)\n",
|
323 |
" packet = Square(color=GREEN).scale(0.3).move_to(start_point + RIGHT * col * 0.6 + DOWN * row * 0.6)\n",
|
324 |
-
"
|
325 |
-
"
|
326 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
" packet_group.next_to(llm_box)\n",
|
328 |
" return packet_group\n",
|
329 |
"\n",
|
@@ -352,7 +312,31 @@
|
|
352 |
" # Conclusion\n",
|
353 |
" self.wait(2)\n",
|
354 |
" self.play(FadeOut(packets), FadeOut(conclusion_text), FadeOut(llm_box), FadeOut(llm_text), FadeOut(user), FadeOut(timer_text))\n"
|
355 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
},
|
357 |
{
|
358 |
"cell_type": "code",
|
@@ -379,7 +363,7 @@
|
|
379 |
"name": "python",
|
380 |
"nbconvert_exporter": "python",
|
381 |
"pygments_lexer": "ipython3",
|
382 |
-
"version": "3.
|
383 |
}
|
384 |
},
|
385 |
"nbformat": 4,
|
|
|
28 |
},
|
29 |
{
|
30 |
"cell_type": "code",
|
31 |
+
"execution_count": 1,
|
32 |
"id": "f8ffa0be-d1ae-4b1d-8827-01e11ef5be68",
|
33 |
"metadata": {
|
34 |
"tags": []
|
35 |
},
|
36 |
+
"outputs": [
|
37 |
+
{
|
38 |
+
"name": "stdout",
|
39 |
+
"output_type": "stream",
|
40 |
+
"text": [
|
41 |
+
"--2024-05-18 06:19:15-- https://pic.onlinewebfonts.com/thumbnails/icons_308642.svg\n",
|
42 |
+
"Resolving pic.onlinewebfonts.com (pic.onlinewebfonts.com)... 107.161.24.252\n",
|
43 |
+
"Connecting to pic.onlinewebfonts.com (pic.onlinewebfonts.com)|107.161.24.252|:443... connected.\n",
|
44 |
+
"HTTP request sent, awaiting response... 200 OK\n",
|
45 |
+
"Length: unspecified [image/svg+xml]\n",
|
46 |
+
"Saving to: ‘user.svg’\n",
|
47 |
+
"\n",
|
48 |
+
"user.svg [ <=> ] 1.44K --.-KB/s in 0s \n",
|
49 |
+
"\n",
|
50 |
+
"2024-05-18 06:19:15 (234 MB/s) - ‘user.svg’ saved [1470]\n",
|
51 |
+
"\n"
|
52 |
+
]
|
53 |
+
}
|
54 |
+
],
|
55 |
"source": [
|
56 |
"!wget -O user.svg https://pic.onlinewebfonts.com/thumbnails/icons_308642.svg"
|
57 |
]
|
58 |
},
|
59 |
{
|
60 |
+
"cell_type": "code",
|
61 |
+
"execution_count": 2,
|
62 |
+
"id": "7743cc54-42db-4002-a785-60070ddb628e",
|
63 |
+
"metadata": {
|
64 |
+
"tags": []
|
65 |
+
},
|
66 |
+
"outputs": [
|
67 |
+
{
|
68 |
+
"name": "stdout",
|
69 |
+
"output_type": "stream",
|
70 |
+
"text": [
|
71 |
+
"--2024-05-18 06:19:16-- https://img.freepik.com/free-vector/yellow-beauty-butterfly-insect-icon_18591-82368.jpg\n",
|
72 |
+
"Resolving img.freepik.com (img.freepik.com)... 23.215.0.170, 23.215.0.167, 2600:1408:5400:13::17cf:caca, ...\n",
|
73 |
+
"Connecting to img.freepik.com (img.freepik.com)|23.215.0.170|:443... connected.\n",
|
74 |
+
"HTTP request sent, awaiting response... 200 OK\n",
|
75 |
+
"Length: 75172 (73K) [image/jpeg]\n",
|
76 |
+
"Saving to: ‘butterfly.jpg’\n",
|
77 |
+
"\n",
|
78 |
+
"butterfly.jpg 100%[===================>] 73.41K --.-KB/s in 0.005s \n",
|
79 |
+
"\n",
|
80 |
+
"2024-05-18 06:19:16 (14.6 MB/s) - ‘butterfly.jpg’ saved [75172/75172]\n",
|
81 |
+
"\n"
|
82 |
+
]
|
83 |
+
}
|
84 |
+
],
|
85 |
"source": [
|
86 |
+
"!wget -O butterfly.jpg https://img.freepik.com/free-vector/yellow-beauty-butterfly-insect-icon_18591-82368.jpg"
|
|
|
|
|
87 |
]
|
88 |
},
|
89 |
{
|
90 |
"cell_type": "code",
|
91 |
+
"execution_count": 3,
|
92 |
+
"id": "64771639-9c66-49a9-ad1f-b5e4dc83a768",
|
93 |
"metadata": {
|
94 |
"tags": []
|
95 |
},
|
|
|
101 |
"config.verbosity = \"WARNING\""
|
102 |
]
|
103 |
},
|
104 |
+
{
|
105 |
+
"cell_type": "markdown",
|
106 |
+
"id": "06a8c7a5-ac68-4c18-9d2f-6ad52cda7826",
|
107 |
+
"metadata": {},
|
108 |
+
"source": [
|
109 |
+
"# Latency Visualization"
|
110 |
+
]
|
111 |
+
},
|
112 |
{
|
113 |
"cell_type": "code",
|
|
|
114 |
"id": "257cf337-948e-4ef7-aae3-2fb7b5b58602",
|
115 |
"metadata": {
|
116 |
"tags": []
|
117 |
},
|
|
|
118 |
"source": [
|
119 |
+
"%%manim -qm --format mp4 LatencyVisualization\n",
|
120 |
"\n",
|
121 |
"from manim import *\n",
|
122 |
"\n",
|
123 |
"text = \"The cake is a lie\"\n",
|
124 |
"text_list = text.split(\" \")\n",
|
125 |
+
"rounds = 2\n",
|
126 |
"class LatencyVisualization(Scene):\n",
|
127 |
"\n",
|
128 |
" def construct(self):\n",
|
|
|
171 |
" # Conclusion\n",
|
172 |
" self.wait(2)\n",
|
173 |
" self.play(FadeOut(conclusion_text), FadeOut(llm_box), FadeOut(llm_text), FadeOut(user), FadeOut(timer_text))\n"
|
174 |
+
],
|
175 |
+
"outputs": [],
|
176 |
+
"execution_count": null
|
177 |
},
|
178 |
{
|
179 |
+
"cell_type": "code",
|
180 |
+
"id": "59202547-0e0d-4ea1-a82a-1c12135844ed",
|
181 |
"metadata": {},
|
182 |
"source": [
|
183 |
+
"%manim -qm --format gif LatencyVisualization"
|
184 |
+
],
|
185 |
+
"outputs": [],
|
186 |
+
"execution_count": null
|
187 |
},
|
188 |
{
|
189 |
"cell_type": "code",
|
190 |
+
"id": "9a4c8bd1-c03b-4f35-bb67-8ad3dd25df32",
|
191 |
+
"metadata": {},
|
|
|
|
|
|
|
|
|
192 |
"source": [
|
193 |
+
"%manim -qm --format webm LatencyVisualization"
|
194 |
+
],
|
195 |
+
"outputs": [],
|
196 |
+
"execution_count": null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
},
|
198 |
{
|
199 |
+
"cell_type": "markdown",
|
200 |
+
"id": "d8e185f7-8abd-43ed-a3cd-f370553ad58d",
|
|
|
201 |
"metadata": {
|
|
|
|
|
|
|
202 |
"tags": []
|
203 |
},
|
|
|
204 |
"source": [
|
205 |
+
"# Throughput Visualization"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
]
|
207 |
},
|
208 |
{
|
209 |
"cell_type": "code",
|
|
|
210 |
"id": "37ad0a6c-e068-4ace-b31f-2c8c1eb8f52b",
|
211 |
"metadata": {
|
212 |
"tags": []
|
213 |
},
|
|
|
214 |
"source": [
|
215 |
+
"%%manim -qm --format mp4 ThroughputVisualization\n",
|
216 |
"\n",
|
217 |
"from manim import *\n",
|
218 |
"\n",
|
|
|
261 |
" ]\n",
|
262 |
" storage_offsets = [0, 0, 0, 0] # Initialize offsets for each storage position\n",
|
263 |
"\n",
|
264 |
+
" packets = Group()\n",
|
265 |
" \n",
|
266 |
" # Timer setup\n",
|
267 |
" timer = ValueTracker(0)\n",
|
268 |
+
" timer_text = always_redraw(lambda: Text(f\"Time: {timer.get_value():.2f}s\\nThroughput: 4 tokens/s\", font_size=18).to_corner(UR))\n",
|
269 |
"\n",
|
270 |
" self.add(timer_text)\n",
|
271 |
"\n",
|
272 |
" def create_packet_group(words):\n",
|
273 |
+
" packet_group = Group()\n",
|
274 |
" for i, word in enumerate(words):\n",
|
275 |
" row, col = divmod(i, 2)\n",
|
276 |
" packet = Square(color=GREEN).scale(0.3).move_to(start_point + RIGHT * col * 0.6 + DOWN * row * 0.6)\n",
|
277 |
+
" \n",
|
278 |
+
" if \"🦋\" in word:\n",
|
279 |
+
" butterfly_image = ImageMobject(\"butterfly.jpg\").scale_to_fit_height(0.3)\n",
|
280 |
+
" butterfly_image.move_to(packet.get_center())\n",
|
281 |
+
" packet_with_image = Group(packet, butterfly_image)\n",
|
282 |
+
" else:\n",
|
283 |
+
" packet_text = Text(word, font_size=12).move_to(packet.get_center())\n",
|
284 |
+
" packet_with_image = Group(packet, packet_text)\n",
|
285 |
+
" \n",
|
286 |
+
" packet_group.add(packet_with_image)\n",
|
287 |
" packet_group.next_to(llm_box)\n",
|
288 |
" return packet_group\n",
|
289 |
"\n",
|
|
|
312 |
" # Conclusion\n",
|
313 |
" self.wait(2)\n",
|
314 |
" self.play(FadeOut(packets), FadeOut(conclusion_text), FadeOut(llm_box), FadeOut(llm_text), FadeOut(user), FadeOut(timer_text))\n"
|
315 |
+
],
|
316 |
+
"outputs": [],
|
317 |
+
"execution_count": null
|
318 |
+
},
|
319 |
+
{
|
320 |
+
"cell_type": "code",
|
321 |
+
"id": "d36ce190-a3ce-461a-b364-91e73b1300da",
|
322 |
+
"metadata": {},
|
323 |
+
"source": [
|
324 |
+
"%manim -qm --format gif ThroughputVisualization"
|
325 |
+
],
|
326 |
+
"outputs": [],
|
327 |
+
"execution_count": null
|
328 |
+
},
|
329 |
+
{
|
330 |
+
"cell_type": "code",
|
331 |
+
"id": "7dc2a1dd-489c-40ce-9c61-d097dee8a11d",
|
332 |
+
"metadata": {
|
333 |
+
"tags": []
|
334 |
+
},
|
335 |
+
"source": [
|
336 |
+
"%manim -qm --format webm ThroughputVisualization"
|
337 |
+
],
|
338 |
+
"outputs": [],
|
339 |
+
"execution_count": null
|
340 |
},
|
341 |
{
|
342 |
"cell_type": "code",
|
|
|
363 |
"name": "python",
|
364 |
"nbconvert_exporter": "python",
|
365 |
"pygments_lexer": "ipython3",
|
366 |
+
"version": "3.9.5"
|
367 |
}
|
368 |
},
|
369 |
"nbformat": 4,
|