flux-local

Generate images locally with Flux via diffusers on Apple Silicon MPS.

1|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/Cyandex/ErnOS --skill flux-local-cyandex
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: flux-local
Source: https://github.com/Cyandex/ErnOS/tree/main/skills/flux-local
Command: npx skills add https://github.com/Cyandex/ErnOS --skill flux-local-cyandex

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires diffusers, torch, transformers, sentencepiece, accelerate, protobuf, and includes scripts (resource) components.

What problem does it solve? Running Flux image generation typically requires cloud APIs or complex environment setup. This Skill runs Flux locally through the diffusers library on Apple Silicon (MPS), keeping image generation offline and under your control. ## Core Features & Use Cases - Local Flux Inference: Generate images from text prompts using Flux weights loaded from the HuggingFace cache, with automatic device detection across MPS, CUDA, and CPU. - Configurable Generation: Control width, height, inference steps, guidance scale, seed, and model path via CLI arguments or the FLUX_MODEL_PATH environment variable. - MPS Stability Patch: Includes a scheduler monkeypatch that catches an IndexError bug specific to Apple Silicon MPS generation. - Use Case: Ask your agent to create a 1024x1024 concept illustration of a sunset over mountains; the script saves the PNG locally and prints a MEDIA line so ErnOS can attach the image in chat. ## Quick Start Ask the agent to generate an image of a sunset over mountains saved as sunset.png using the local Flux model.

Frequently Asked Questions about flux-local

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate images locally with Flux on Apple Silicon?▼

Run the generate_image.py script with uv, passing a prompt and output filename. The script auto-detects the MPS device, loads the Flux pipeline in float16, and saves the image locally while printing a MEDIA line for chat attachment.

How to run Flux with diffusers without a cloud API?▼

Use the diffusers FluxPipeline with locally cached weights from the HuggingFace hub. Set FLUX_MODEL_PATH or pass --model to point at your weights, and generation runs entirely offline on your machine.

Does Flux image generation work on CUDA or CPU?▼

Yes, the script detects the best available device: MPS on Apple Silicon, then CUDA, then CPU as fallback. It selects float16 for MPS, bfloat16 for CUDA, and float32 for CPU automatically.

Why does Flux generation fail with an IndexError on MPS?▼

A known MPS-specific scheduler bug can raise an IndexError at the end of generation. The script monkeypatches scheduler.step to catch this error and return the sample as-is, so the image still saves correctly.

How long does the first Flux image generation take?▼

The first inference takes 60-120 seconds because the Flux weights must load into MPS memory. Subsequent generations in the same session are faster once the pipeline is loaded.