File size: 19,143 Bytes
c372d99 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | import os
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.enum.text import PP_ALIGN
from pptx.dml.color import RGBColor
from pptx.enum.shapes import MSO_SHAPE
def create_visual_journey_presentation():
pptx_path = "/home/adminuser/aiops_pocs/MAMBA_7B/docs/MAMBA_7B_INSTALLATION_AND_ARCHITECTURE_GUIDE.pptx"
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
# Ultra-Premium Dark Theme Color Palette
COLOR_BG = RGBColor(11, 15, 25) # Deep Obsidian Slate
COLOR_CARD = RGBColor(30, 41, 59) # Slate 800
COLOR_CARD_DARK = RGBColor(20, 27, 44) # Slate 900
COLOR_CYAN = RGBColor(6, 182, 212) # Electric Cyan
COLOR_GREEN = RGBColor(16, 185, 129) # Emerald Green
COLOR_PURPLE = RGBColor(168, 85, 247) # Vivid Purple
COLOR_AMBER = RGBColor(245, 158, 11) # Radiant Amber
COLOR_TEXT = RGBColor(248, 250, 252) # Pure White Slate
COLOR_MUTED = RGBColor(148, 163, 184) # Slate Muted
def apply_bg(slide):
bg = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, Inches(13.333), Inches(7.5))
bg.fill.solid()
bg.fill.fore_color.rgb = COLOR_BG
bg.line.fill.background()
def add_header(slide, title_text, chapter_text="MY EXPERIMENT JOURNEY"):
tb = slide.shapes.add_textbox(Inches(0.8), Inches(0.4), Inches(11.7), Inches(0.9))
tf = tb.text_frame
tf.word_wrap = True
p_cat = tf.paragraphs[0]
p_cat.text = chapter_text.upper()
p_cat.font.size = Pt(11)
p_cat.font.bold = True
p_cat.font.color.rgb = COLOR_CYAN
p_title = tf.add_paragraph()
p_title.text = title_text
p_title.font.size = Pt(24)
p_title.font.bold = True
p_title.font.color.rgb = COLOR_TEXT
# -------------------------------------------------------------
# SLIDE 1: Title Slide (Hero Graphics)
# -------------------------------------------------------------
slide1 = prs.slides.add_slide(prs.slide_layouts[6])
apply_bg(slide1)
# Hero Card Background Container
hero_card = slide1.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(0.8), Inches(1.2), Inches(11.7), Inches(5.1))
hero_card.fill.solid()
hero_card.fill.fore_color.rgb = COLOR_CARD_DARK
hero_card.line.color.rgb = COLOR_CYAN
hero_card.line.width = Pt(2)
# Top Accent Line
line = slide1.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(0.8), Inches(1.2), Inches(11.7), Inches(0.12))
line.fill.solid()
line.fill.fore_color.rgb = COLOR_CYAN
line.line.fill.background()
tb = slide1.shapes.add_textbox(Inches(1.2), Inches(1.6), Inches(10.9), Inches(4.2))
tf = tb.text_frame
tf.word_wrap = True
p1 = tf.paragraphs[0]
p1.text = "β‘ HANDS-ON RESEARCH & DEPLOYMENT JOURNEY"
p1.font.size = Pt(13)
p1.font.bold = True
p1.font.color.rgb = COLOR_CYAN
p2 = tf.add_paragraph()
p2.text = "My Journey with Mamba 7B: From Curiosity to Benchmarking"
p2.font.size = Pt(34)
p2.font.bold = True
p2.font.color.rgb = COLOR_TEXT
p3 = tf.add_paragraph()
p3.text = "\nAn empirical exploration of Selective State Space Models (SSMs). How I discovered Mamba, installed Codestral Mamba 7B locally via Ollama, built custom test suites, and evaluated performance against Qwen 2.5 7B on NVIDIA H200 GPUs."
p3.font.size = Pt(15)
p3.font.color.rgb = COLOR_MUTED
# Stat Badges at Bottom
badges = [
("ARCHITECTURE", "Selective SSM (S6)", COLOR_GREEN),
("MODEL TESTED", "Codestral Mamba 7B", COLOR_CYAN),
("HARDWARE", "2x NVIDIA H200 NVL", COLOR_PURPLE),
("CONTEXT", "256k Window", COLOR_AMBER)
]
for idx, (b_title, b_val, b_color) in enumerate(badges):
x = Inches(1.2 + idx * 2.7)
b_box = slide1.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, x, Inches(4.8), Inches(2.5), Inches(1.1))
b_box.fill.solid()
b_box.fill.fore_color.rgb = COLOR_CARD
b_box.line.color.rgb = b_color
b_box.line.width = Pt(1)
b_tf = b_box.text_frame
b_tf.word_wrap = True
p_t = b_tf.paragraphs[0]
p_t.text = b_title
p_t.font.size = Pt(9)
p_t.font.bold = True
p_t.font.color.rgb = COLOR_MUTED
p_v = b_tf.add_paragraph()
p_v.text = b_val
p_v.font.size = Pt(12)
p_v.font.bold = True
p_v.font.color.rgb = b_color
# -------------------------------------------------------------
# SLIDE 2: Chapter 1 - The Spark of Curiosity (Visual Cards)
# -------------------------------------------------------------
slide2 = prs.slides.add_slide(prs.slide_layouts[6])
apply_bg(slide2)
add_header(slide2, "Chapter 1: Why I Became Curious About Mamba", "Phase 1: Motivation")
pillars = [
("π¬ The Research Breakthrough", "Reading Albert Gu and Tri Dao's paper on Selective State Space Models (SSMs). The promise of escaping Transformer O(NΒ²) quadratic attention.", COLOR_PURPLE),
("πΎ The Constant Memory Hypothesis", "Transformers exhaust VRAM with KV-caches at 32k+ context. Mamba promises a fixed O(1) recurrent memory buffer.", COLOR_CYAN),
("π― My Goal & Mission", "Build a hands-on local deployment on NVIDIA H200 GPUs, test real-world code generation, measure throughput, and evaluate response quality.", COLOR_GREEN)
]
for idx, (title, desc, color) in enumerate(pillars):
x = Inches(0.8 + idx * 3.9)
card = slide2.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, x, Inches(1.6), Inches(3.6), Inches(5.2))
card.fill.solid()
card.fill.fore_color.rgb = COLOR_CARD
card.line.color.rgb = color
card.line.width = Pt(2)
# Top Accent Header Bar
bar = slide2.shapes.add_shape(MSO_SHAPE.RECTANGLE, x, Inches(1.6), Inches(3.6), Inches(0.1))
bar.fill.solid()
bar.fill.fore_color.rgb = color
bar.line.fill.background()
tf = card.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.text = title
p.font.size = Pt(17)
p.font.bold = True
p.font.color.rgb = color
p_d = tf.add_paragraph()
p_d.text = f"\n{desc}"
p_d.font.size = Pt(13)
p_d.font.color.rgb = COLOR_TEXT
# -------------------------------------------------------------
# SLIDE 3: Chapter 2 - Model Exploration & Baseline Selection
# -------------------------------------------------------------
slide3 = prs.slides.add_slide(prs.slide_layouts[6])
apply_bg(slide3)
add_header(slide3, "Chapter 2: Researching Hugging Face & Model Selection", "Phase 2: Model Selection")
c1 = slide3.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(0.8), Inches(1.6), Inches(5.6), Inches(5.2))
c1.fill.solid()
c1.fill.fore_color.rgb = COLOR_CARD
c1.line.color.rgb = COLOR_GREEN
c1.line.width = Pt(2)
tf1 = c1.text_frame
tf1.word_wrap = True
p = tf1.paragraphs[0]
p.text = "π Selected Model: Codestral Mamba 7B"
p.font.size = Pt(18)
p.font.bold = True
p.font.color.rgb = COLOR_GREEN
b1 = [
"β’ Model Repo: mistralai/mamba-codestral-7b",
"β’ GGUF Quantization: Q4_K_M (3.9 GB binary)",
"β’ Key Feature: 256k context window for repository-level code processing.",
"β’ Pure SSM S6: Zero self-attention layers."
]
for b in b1:
p = tf1.add_paragraph()
p.text = b
p.font.size = Pt(13)
p.font.color.rgb = COLOR_TEXT
c2 = slide3.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(6.8), Inches(1.6), Inches(5.6), Inches(5.2))
c2.fill.solid()
c2.fill.fore_color.rgb = COLOR_CARD
c2.line.color.rgb = COLOR_CYAN
c2.line.width = Pt(2)
tf2 = c2.text_frame
tf2.word_wrap = True
p = tf2.paragraphs[0]
p.text = "βοΈ Selected Baseline: Qwen 2.5 7B Instruct"
p.font.size = Pt(18)
p.font.bold = True
p.font.color.rgb = COLOR_CYAN
b2 = [
"β’ Model Tag: qwen2.5:7b-instruct (4.7 GB)",
"β’ Architecture: Multi-Head Self-Attention Transformer.",
"β’ Why Qwen 2.5? Top-performing 7B open model for coding & technical reasoning.",
"β’ Fair Evaluation: Identical parameter scale (7B) on the same GPU cluster."
]
for b in b2:
p = tf2.add_paragraph()
p.text = b
p.font.size = Pt(13)
p.font.color.rgb = COLOR_TEXT
# -------------------------------------------------------------
# SLIDE 4: Chapter 3 - Visual Stepper Installation Flow
# -------------------------------------------------------------
slide4 = prs.slides.add_slide(prs.slide_layouts[6])
apply_bg(slide4)
add_header(slide4, "Chapter 3: Local Setup Pipeline in Ollama", "Phase 3: Installation Flow")
steps = [
("1. DOWNLOAD", "Downloaded GGUF binary from Hugging Face into /data/ directory.", COLOR_CYAN),
("2. MODELFILE", "Created custom Modelfile setting SYSTEM prompt & num_ctx 65536.", COLOR_GREEN),
("3. REGISTER", "Ran 'ollama create mamba-codestral:7b' to build Ollama layers.", COLOR_PURPLE),
("4. VERIFY", "Verified model readiness & executed test queries via Ollama API.", COLOR_AMBER)
]
for idx, (s_title, s_desc, color) in enumerate(steps):
x = Inches(0.8 + idx * 2.95)
box = slide4.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, x, Inches(1.6), Inches(2.7), Inches(5.2))
box.fill.solid()
box.fill.fore_color.rgb = COLOR_CARD
box.line.color.rgb = color
box.line.width = Pt(2)
# Step Number Badge
num_circle = slide4.shapes.add_shape(MSO_SHAPE.OVAL, x + Inches(0.9), Inches(1.9), Inches(0.9), Inches(0.9))
num_circle.fill.solid()
num_circle.fill.fore_color.rgb = color
num_circle.line.fill.background()
tf_num = num_circle.text_frame
p_n = tf_num.paragraphs[0]
p_n.text = str(idx + 1)
p_n.font.size = Pt(20)
p_n.font.bold = True
p_n.font.color.rgb = COLOR_BG
p_n.alignment = PP_ALIGN.CENTER
tf = box.text_frame
tf.word_wrap = True
p_t = tf.paragraphs[0]
p_t.text = f"\n\n\n{s_title}"
p_t.font.size = Pt(15)
p_t.font.bold = True
p_t.font.color.rgb = color
p_t.alignment = PP_ALIGN.CENTER
p_d = tf.add_paragraph()
p_d.text = f"\n{s_desc}"
p_d.font.size = Pt(12)
p_d.font.color.rgb = COLOR_TEXT
p_d.alignment = PP_ALIGN.CENTER
# -------------------------------------------------------------
# SLIDE 5: Chapter 4 - Designing the Experiment (Category Cards)
# -------------------------------------------------------------
slide5 = prs.slides.add_slide(prs.slide_layouts[6])
apply_bg(slide5)
add_header(slide5, "Chapter 4: Designing My 10-Prompt Test Suite", "Phase 4: Test Suite Design")
categories = [
("β‘ 1. Algorithms & Data Structures", "Lock-free concurrent LRU Cache in Python & Red-Black Tree self-balancing in C++.", COLOR_CYAN),
("π οΈ 2. Systems & Low-Level Code", "Asyncio WebSockets Gateway server & Linux eBPF kernel network tracing in C/BCC.", COLOR_GREEN),
("π 3. Memory Safety & Rust Syntax", "C++ memory allocator race condition repair & Rust zero-copy slice lifetime parser.", COLOR_AMBER),
("π§ 4. Math Logic & AI Mechanics", "Bitmask TSP dynamic programming, pure Python matrix inversion & SSM vs Attention theory.", COLOR_PURPLE)
]
for idx, (title, desc, color) in enumerate(categories):
row = idx // 2
col = idx % 2
x = Inches(0.8 + col * 5.9)
y = Inches(1.6 + row * 2.6)
card = slide5.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, x, y, Inches(5.6), Inches(2.3))
card.fill.solid()
card.fill.fore_color.rgb = COLOR_CARD
card.line.color.rgb = color
card.line.width = Pt(1.5)
tf = card.text_frame
tf.word_wrap = True
p_t = tf.paragraphs[0]
p_t.text = title
p_t.font.size = Pt(16)
p_t.font.bold = True
p_t.font.color.rgb = color
p_d = tf.add_paragraph()
p_d.text = desc
p_d.font.size = Pt(13)
p_d.font.color.rgb = COLOR_TEXT
# -------------------------------------------------------------
# SLIDE 6: Chapter 5 - Hero Metric Callouts (Visual Stats)
# -------------------------------------------------------------
slide6 = prs.slides.add_slide(prs.slide_layouts[6])
apply_bg(slide6)
add_header(slide6, "Chapter 5: Benchmark Execution & Key Empirical Metrics", "Phase 5: Key Metrics")
stats = [
("42.2%", "LATENCY REDUCTION", "Codestral Mamba finished responses in 4.28s avg vs Qwen's 7.40s.", COLOR_GREEN),
("195 t/s", "GENERATION SPEED", "Both models saturated GPU hardware limits at ~194.8 t/s on NVIDIA H200 GPUs.", COLOR_CYAN),
("2.25x", "EXPLANATION DENSITY", "Qwen 2.5 generated 4,347 chars/response vs Mamba's 1,930 chars.", COLOR_AMBER),
("O(1)", "MEMORY RECURRENCE", "Mamba maintained a constant memory buffer without KV-cache VRAM inflation.", COLOR_PURPLE)
]
for idx, (num, label, desc, color) in enumerate(stats):
row = idx // 2
col = idx % 2
x = Inches(0.8 + col * 5.9)
y = Inches(1.6 + row * 2.6)
card = slide6.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, x, y, Inches(5.6), Inches(2.3))
card.fill.solid()
card.fill.fore_color.rgb = COLOR_CARD
card.line.color.rgb = color
card.line.width = Pt(1.5)
tf = card.text_frame
tf.word_wrap = True
p_num = tf.paragraphs[0]
p_num.text = num
p_num.font.size = Pt(36)
p_num.font.bold = True
p_num.font.color.rgb = color
p_lbl = tf.add_paragraph()
p_lbl.text = label
p_lbl.font.size = Pt(11)
p_lbl.font.bold = True
p_lbl.font.color.rgb = COLOR_MUTED
p_desc = tf.add_paragraph()
p_desc.text = desc
p_desc.font.size = Pt(12)
p_desc.font.color.rgb = COLOR_TEXT
# -------------------------------------------------------------
# SLIDE 7: Chapter 6 - Comparing Output Styles
# -------------------------------------------------------------
slide7 = prs.slides.add_slide(prs.slide_layouts[6])
apply_bg(slide7)
add_header(slide7, "Chapter 6: Comparing Code Generation Styles", "Phase 6: Quality Breakdown")
c1 = slide7.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(0.8), Inches(1.6), Inches(5.6), Inches(5.2))
c1.fill.solid()
c1.fill.fore_color.rgb = COLOR_CARD
c1.line.color.rgb = COLOR_GREEN
tf1 = c1.text_frame
tf1.word_wrap = True
p = tf1.paragraphs[0]
p.text = "π’ Codestral Mamba 7B Style"
p.font.size = Pt(18)
p.font.bold = True
p.font.color.rgb = COLOR_GREEN
b1 = [
"β’ Hyper-Concise & Direct: Jumps straight into executable code without conversational filler.",
"β’ Rapid Autocomplete: Ideal for real-time IDE completion where speed is paramount.",
"β’ Minimal Comments: Omits lengthy docstrings unless explicitly requested.",
"β’ 15-Line Compact Logic: e.g. Used collections.OrderedDict for a clean 15-line LRU cache."
]
for b in b1:
p = tf1.add_paragraph()
p.text = b
p.font.size = Pt(13)
p.font.color.rgb = COLOR_TEXT
c2 = slide7.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(6.8), Inches(1.6), Inches(5.6), Inches(5.2))
c2.fill.solid()
c2.fill.fore_color.rgb = COLOR_CARD
c2.line.color.rgb = COLOR_CYAN
tf2 = c2.text_frame
tf2.word_wrap = True
p = tf2.paragraphs[0]
p.text = "π΅ Qwen 2.5 7B Instruct Style"
p.font.size = Pt(18)
p.font.bold = True
p.font.color.rgb = COLOR_CYAN
b2 = [
"β’ Exhaustive & Production-Grade: Includes full class structures, type annotations & logging.",
"β’ Edge-Case Handling: Explicit thread locks, race condition guards & exception catching.",
"β’ Comprehensive Docstrings: Explains design choices and complexity bounds in detail.",
"β’ Full Microservices: Built multi-layered async server architectures out-of-the-box."
]
for b in b2:
p = tf2.add_paragraph()
p.text = b
p.font.size = Pt(13)
p.font.color.rgb = COLOR_TEXT
# -------------------------------------------------------------
# SLIDE 8: Chapter 7 - Final Takeaways & Deployment Recommendations
# -------------------------------------------------------------
slide8 = prs.slides.add_slide(prs.slide_layouts[6])
apply_bg(slide8)
add_header(slide8, "Chapter 7: My Final Verdict & Recommendations", "Phase 7: Final Roadmap")
c1 = slide8.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(0.8), Inches(1.6), Inches(5.6), Inches(5.2))
c1.fill.solid()
c1.fill.fore_color.rgb = COLOR_CARD
c1.line.color.rgb = COLOR_GREEN
tf1 = c1.text_frame
tf1.word_wrap = True
p = tf1.paragraphs[0]
p.text = "π Where I Would Deploy Mamba 7B"
p.font.size = Pt(18)
p.font.bold = True
p.font.color.rgb = COLOR_GREEN
recs1 = [
"1. Real-Time IDE Autocomplete: Sub-second response time for instant inline code completion.",
"2. Massive Context Ingestion (256k tokens): Ingesting giant repositories or log files without VRAM KV-cache crash.",
"3. High-Throughput Streaming APIs: Low-cost, low-latency microservice endpoints."
]
for r in recs1:
p = tf1.add_paragraph()
p.text = r
p.font.size = Pt(13)
p.font.color.rgb = COLOR_TEXT
c2 = slide8.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(6.8), Inches(1.6), Inches(5.6), Inches(5.2))
c2.fill.solid()
c2.fill.fore_color.rgb = COLOR_CARD
c2.line.color.rgb = COLOR_CYAN
tf2 = c2.text_frame
tf2.word_wrap = True
p = tf2.paragraphs[0]
p.text = "π Where I Would Deploy Qwen 2.5 7B"
p.font.size = Pt(18)
p.font.bold = True
p.font.color.rgb = COLOR_CYAN
recs2 = [
"1. Full System Architecture Design: Designing production microservices and complex refactors.",
"2. Automated Unit Test Suite Generation: Creating high-coverage pytest suites with mocks.",
"3. Interactive Code Review & Debugging: Deep-dive vulnerability analysis and bug repairs."
]
for r in recs2:
p = tf2.add_paragraph()
p.text = r
p.font.size = Pt(13)
p.font.color.rgb = COLOR_TEXT
prs.save(pptx_path)
print("Successfully created visual journey-framed presentation:", pptx_path)
if __name__ == "__main__":
create_visual_journey_presentation()
|