"""Assemble actual pipeline outputs without fabricated comparison imagery.""" import hashlib import html import json from pathlib import Path from PIL import Image, ImageDraw, ImageFont def main(): root = Path("comparisons/optimization-r3") root.mkdir(parents=True, exist_ok=True) cases = ["product", "portrait", "holdout-detail", "edit"] groups = [ ("Exact Q/K fusion + FC2 tuning", "optimization-r3-qk", "qk-fc2-native-norm"), ( "Lossless packed weights + exact tuning", "optimization-r3-compact", "qk-fc2-native-norm", ), ( "Full-width fusion: exact pixels, memory tradeoff", "optimization-r3-deployment", "qk-fc2", ), ] parts = [ '
Actual saved model outputs, matched prompts, seeds, canvas and reference inputs. Each linked gallery includes native-resolution crops, vertical stacks, and RGB differences amplified eight times.
Exact means no additional change relative to the MLX BF16 recipe on these cases. FP32-decoder and CUDA comparisons are linked separately below.
", ] records = [] font = ImageFont.truetype("/System/Library/Fonts/Supplemental/Arial.ttf", 21) for title, folder, variant in groups: paths = [Path("comparisons") / folder / case / variant for case in cases] if not all( (p / "metrics.json").exists() and (p / "grid.png").exists() for p in paths ): raise FileNotFoundError(f"Incomplete final gallery: {folder}") parts.append(f"
'
)
images.append((case, Image.open(path / "grid.png").convert("RGB")))
width = max(im.width for _, im in images)
canvas = Image.new(
"RGB", (width, sum(im.height + 38 for _, im in images)), (16, 21, 29)
)
draw = ImageDraw.Draw(canvas)
y = 0
for case, im in images:
draw.text((12, y + 6), case, font=font, fill="white")
canvas.paste(im, (0, y + 38))
y += im.height + 38
stack = root / f"{folder}-all-cases.png"
canvas.save(stack)
parts.append(
f'These are earlier experiments, retained to show actual quality differences. Their timings are not pooled with this campaign.