Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.
TypeScript ai-photo-editorcomfyui-alternativegenerative-fillimage-editingimage-generationinpaintinglinuxlocal-aimacosmcpmcp-servernano-banana-alternativeofflinephoto-editorprivacyqwen-imageqwen-image-2-1stable-diffusion-cppvulkanwindows
Mac engine: tools/ab.sh, alternated A/B of build snapshots
Gabriele Lozupone77f0d491e0c3
diff --git a/engine-mac/README.md b/engine-mac/README.mdindex 748bfea..9a0206d 100644--- a/engine-mac/README.md+++ b/engine-mac/README.md@@ -20,6 +20,8 @@ swift test # no model needed.build/release/kokon-engine-mac bench # a few minutes: speed and accuracy of this Mac's paths, a report.build/release/kokon-engine-mac check-na # the Metal 4 matrix product against MPS.build/release/kokon-engine-mac check-ane8 # the int8 Neural Engine programs against the fp16 one+bash tools/ab.sh snapshot base; bash tools/ab.sh run 2 "base|base|X=1" "new|new|X=1" -- time-dit <dit.gguf> 64 32+ # alternated A/B of build snapshots and settings (steps, page-ins)```In the app: `bash tools/install-dev.sh` puts the build where Kokon looks for it, then Settings → Performance →diff --git a/engine-mac/tools/ab.sh b/engine-mac/tools/ab.shnew file mode 100755index 0000000..3856e3c--- /dev/null+++ b/engine-mac/tools/ab.sh@@ -0,0 +1,45 @@+#!/bin/bash+# Alternated A/B runs of kokon-engine-mac: each arm is a snapshot of a build (the executable and its resource bundle,+# which must sit beside it) plus environment variables; the arms run in turn, `rounds` times, and each run prints its+# per-step times, total, peak footprint and the page-ins it caused (vm_stat).+#+# bash tools/ab.sh snapshot <name> # copy the current release build to $AB_DIR/<name>/+# bash tools/ab.sh run <rounds> "<label>|<snapshot>|<ENV=x ...>" ... -- <kokon-engine-mac arguments>+#+# Example, an evaluation alone (fast) and then whole edits:+# bash tools/ab.sh snapshot base # before the change; swift build -c release; bash tools/ab.sh snapshot new+# bash tools/ab.sh run 2 "base|base|X=1" "new|new|X=1" -- time-dit <dit.gguf> 64 32+# bash tools/ab.sh run 2 "base|base|X=1" "new|new|X=1" -- generate <enc> <dit> <vae> "prompt" --ref in.png --mmproj <mmproj>+# Close other heavy apps (asitop too) first; do not build while it runs.+set -euo pipefail+here="$(cd "$(dirname "$0")/.." && pwd)"+dir="${AB_DIR:-$HOME/kokon-bench/ab}"+case "${1:-}" in+snapshot)+ name="${2:?a snapshot name}"+ rm -rf "$dir/$name" && mkdir -p "$dir/$name"+ cp "$here/.build/release/kokon-engine-mac" "$dir/$name/"+ cp -R "$here/.build/release/KokonEngineMac_KokonEngine.bundle" "$dir/$name/"+ echo "snapshot $dir/$name ($(git -C "$here" rev-parse --short HEAD)$(git -C "$here" diff --quiet || echo ' + changes'))"+ ;;+run)+ rounds="${2:?rounds}"; shift 2+ arms=()+ while [ $# -gt 0 ] && [ "$1" != "--" ]; do arms+=("$1"); shift; done+ shift || true+ pageins() { vm_stat | awk '/Pageins/ {gsub("\\.", "", $2); print $2}'; }+ for r in $(seq 1 "$rounds"); do+ for arm in "${arms[@]}"; do+ IFS='|' read -r label snapshot envs <<< "$arm"+ p0=$(pageins)+ out=$(env $envs "$dir/$snapshot/kokon-engine-mac" "$@" 2>&1) || echo "$label r$r FAILED: $(echo "$out" | tail -2)"+ p1=$(pageins)+ steps=$(echo "$out" | grep -E "^step [0-9]+/" | sed -E 's/.*: ([0-9.]+) s/\1/' | tr '\n' ' ' || true)+ evals=$(echo "$out" | grep -E "^evaluation [0-9]+: " | sed -E 's/^evaluation [0-9]+: ([0-9.]+) s.*/\1/' | tr '\n' ' ' || true)+ total=$(echo "$out" | grep -oE "total [0-9.]+ s" | tail -1 || true)+ echo "$label r$r | page-ins $(( (p1 - p0) * 16384 / 1000000 )) MB | ${steps:+steps $steps| }${evals:+evaluations $evals| }${total:+$total | }$(echo "$out" | grep -o 'peak footprint [0-9.]* GB' || true)"+ done+ done+ ;;+*) sed -n 2,14p "$0"; exit 1 ;;+esac