From a3332206750c9ead895bba046c2c37a54b307673 Mon Sep 17 00:00:00 2001 From: torsten Date: Sat, 14 Nov 2026 20:38:04 +0100 Subject: [PATCH] =?UTF-8?q?art/setup.py:=20--sdxl=20f=C3=BCr=20Apple=20Sil?= =?UTF-8?q?icon,=20SETUP=20um=2024-GB-=20und=20Air-F=C3=A4lle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ein Mac kann FLUX.2 nicht sinnvoll lokal fahren: fp8 wird auf MPS hochgecastet (~19 GB Modell, ~17 GB Textencoder), und ein lüfterloses MacBook Air drosselt zusätzlich. `setup.py models` hat bisher trotzdem die 18 GB Pflichtgewichte geladen, bevor SDXL überhaupt in Frage kam. - `models --sdxl`: lädt nur SDXL + Pixel-LoRA (6,7 GB), ohne FLUX.2 - `check --sdxl`: erwartet die FLUX.2-Gewichte nicht, meldet sie als "nicht nötig" statt als fehlend; Exit bleibt 0 - `all --sdxl` reicht das durch - SETUP.md: Tabellenzeile für 24 GB Unified Memory, Hinweis auf lüfterlose Geräte, Mac-Befehl auf `--mps --sdxl`, und der Beispielaufruf in §4 auf 640×360 / 2× nachgezogen --- art/SETUP.md | 20 ++++++++++++++++---- art/tools/setup.py | 16 +++++++++++++++- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/art/SETUP.md b/art/SETUP.md index 5b0fbec..b33851e 100644 --- a/art/SETUP.md +++ b/art/SETUP.md @@ -26,6 +26,7 @@ ist idempotent. Einzelschritte, wenn etwas schiefgeht: | `setup.py comfy --nvidia` | ComfyUI + PyTorch in einen Workspace installieren | ~20 min, ~10 GB | | `setup.py models` | die drei Pflichtmodelle laden, gegen Byte-Größe prüfen | ~18 GB | | `setup.py models --optional` | zusätzlich SDXL + Pixel-LoRA (nur zum Nachvollziehen) | +6,7 GB | +| `setup.py models --sdxl` | **nur** SDXL + Pixel-LoRA, ohne FLUX.2 (Apple Silicon, kleine GPU) | 6,7 GB | | `setup.py workbench DIR` | Arbeitsordner mit Symlinks ins Repo anlegen | Sekunden | | `setup.py check` | meldet jede Abweichung, Exit-Code 1 | Sekunden | @@ -97,12 +98,13 @@ comfy run --workflow art/workflows/flux2_klein9b_api.json --wait comfy download -o assets/raw/Pictures/ python3 art/tools/pixelize.py assets/raw/Pictures/.png \ -o assets/final/Pictures/_1280x720.png \ - --size 320x180 --colors 64 --levels 0.5 --gamma 1.3 --upscale 4 + --size 640x360 --colors 64 --levels 0.5 --gamma 1.3 --upscale 2 ``` Kommt ein Bild in 1280×720 mit 64 Farben heraus, ist die Kette komplett. `setup.py check --smoke` prüft dieselbe Kette ohne GPU in zwei Sekunden -(Testbild → `pixelize` → Palette und 4×-Raster). +(Testbild → `pixelize` → Palette und nearest-Raster; prüft das Werkzeug, +nicht die Zielauflösung). ## 4.1 macOS @@ -121,10 +123,16 @@ Konkret zur Hardware: - **Apple Silicon, 16 GB** — FLUX.2 9B ist nicht sinnvoll (Textencoder 8 GB kommt noch dazu). SDXL lokal oder fal.ai. +- **Apple Silicon, 24 GB** — dasselbe: fp8 wird auf MPS hochgecastet, das + Modell allein braucht dann ~19 GB Spitze, der Encoder ~17 GB. SDXL ist die + lokale Wahl. - **Apple Silicon, 32 GB** — FLUX.2 versuchen, aber mit Erwartung „Minuten pro Bild statt Sekunden und evtl. Swap". Wenn es zäh wird: SDXL. - **Apple Silicon, 64 GB+** — FLUX.2 9B läuft brauchbar; trotzdem langsamer als die RTX 5060 Ti. +- **MacBook Air (lüfterlos)** — Dauerlast drosselt unabhängig vom Speicher. + Für FLUX.2 ist das der zweite Grund dagegen; SDXL-Läufe in kleinen Serien, + nicht als Stapel. - **Intel-Mac** — keine sinnvolle lokale Diffusion. `fal.ai` (Endpoints in `WORKFLOW.md` §5) oder Comfy Cloud; die Assets, Prompts und `pixelize` sind trotzdem alle nutzbar. @@ -132,10 +140,14 @@ Konkret zur Hardware: Auf einem Mac also: ```bash -python3 art/tools/setup.py all ~/workbench/taloria --mps -python3 art/tools/setup.py models --optional # SDXL mitnehmen +python3 art/tools/setup.py all ~/workbench/taloria --mps --sdxl +python3 art/tools/setup.py check --sdxl --smoke # FLUX.2 wird nicht erwartet ``` +`--sdxl` lässt die 18 GB FLUX.2-Gewichte weg und lädt nur SDXL + Pixel-LoRA +(6,7 GB). Die `art/workflows/sdxl_t2i.json` ist dafür da; FLUX.2-Jobdateien +bleiben liegen, laufen auf dem Mac aber nicht sinnvoll. + Zwei macOS-spezifische Stolpersteine, die `setup.py` abfängt: - **Homebrew-Python** verweigert `pip install --user` (PEP 668). Das Skript diff --git a/art/tools/setup.py b/art/tools/setup.py index fbf82f7..c52228d 100755 --- a/art/tools/setup.py +++ b/art/tools/setup.py @@ -251,6 +251,7 @@ def pillow_version() -> str | None: def cmd_check(args: argparse.Namespace) -> int: problems: list[str] = [] + only_sdxl = getattr(args, "sdxl", False) head("Python") if sys.version_info >= PY_MIN: @@ -307,6 +308,9 @@ def cmd_check(args: argparse.Namespace) -> int: for m in MODELS: p = ws / m.folder / m.file if not p.exists(): + if m.required and only_sdxl: + say(f" {'nicht nötig':<13} {m.folder}/{m.file} (--sdxl)") + continue state = "FEHLT" if m.required else "optional fehlt" say(f" {state:<13} {m.folder}/{m.file}") if m.required: @@ -546,7 +550,11 @@ def cmd_models(args: argparse.Namespace) -> int: say("Kein ComfyUI-Workspace gefunden. Erst: python3 art/tools/setup.py comfy --nvidia") return 1 head(f"Modelle -> {ws}") - todo = [m for m in MODELS if m.required or args.optional] + if args.sdxl: + todo = [m for m in MODELS if not m.required] + say(" --sdxl: nur SDXL + Pixel-LoRA (kein FLUX.2 — Apple Silicon/kleine GPU)") + else: + todo = [m for m in MODELS if m.required or args.optional] total = sum(m.size for m in todo if not (ws / m.folder / m.file).exists()) say(f" {len(todo)} Dateien, offen: {human(total)}") if args.dry_run: @@ -667,6 +675,8 @@ def main(argv: list[str] | None = None) -> int: c = sub.add_parser("check", help="Ist-Zustand prüfen, nichts ändern") c.add_argument("--smoke", action="store_true", help="pixelize.py mit Testbild ausführen") + c.add_argument("--sdxl", action="store_true", + help="FLUX.2 nicht erwarten (Apple Silicon/kleine GPU)") c.set_defaults(func=cmd_check) c = sub.add_parser("deps", help="Pillow und comfy-cli installieren") @@ -683,6 +693,8 @@ def main(argv: list[str] | None = None) -> int: c = sub.add_parser("models", help="Modellgewichte laden und per Größe prüfen") c.add_argument("--optional", action="store_true", help="auch SDXL und die Pixel-LoRA") + c.add_argument("--sdxl", action="store_true", + help="nur SDXL + LoRA, ohne FLUX.2 (Apple Silicon/kleine GPU)") c.add_argument("--dry-run", action="store_true") c.set_defaults(func=cmd_models) @@ -699,6 +711,8 @@ def main(argv: list[str] | None = None) -> int: c.add_argument("--cpu", dest="gpu", action="store_const", const="cpu") c.add_argument("--version", help="ComfyUI-Version") c.add_argument("--optional", action="store_true", help="auch die optionalen Modelle") + c.add_argument("--sdxl", action="store_true", + help="nur SDXL laden, ohne FLUX.2 (Apple Silicon/kleine GPU)") c.add_argument("--dry-run", action="store_true") c.set_defaults(func=cmd_all, gpu="auto", dry_run=False, force=False)