Fooocus icon indicating copy to clipboard operation
Fooocus copied to clipboard

[Bug]: Apple Silicon: `Error: MLIR pass manager failed'

Open xDhii opened this issue 10 months ago • 5 comments

Checklist

  • [x] The issue has not been resolved by following the troubleshooting guide
  • [x] The issue exists on a clean installation of Fooocus
  • [x] The issue exists in the current version of Fooocus
  • [x] The issue has not been reported before recently
  • [ ] The issue has been reported before but has not been fixed yet

What happened?

While trying to generate any image, the build crashes a few seconds after clicking in the "Generate" button.

Steps to reproduce the problem

  1. Clean install
  2. Run on the terminal
  3. Go to the UI, insert prompt and negative prompt
  4. Click to generate

What should have happened?

Image should be generated after some time.

What browsers do you use to access Fooocus?

Apple Safari

Where are you running Fooocus?

Locally

What operating system are you using?

macOS 15.3

Console logs

~ ❯ cd Desktop/Fooocus && conda activate fooocus && python entry_with_update.py --preset realistic
Already up-to-date
Update succeeded.
[System ARGV] ['entry_with_update.py', '--preset', 'realistic']
Python 3.10.16 (main, Dec 11 2024, 10:22:29) [Clang 14.0.6 ]
Fooocus version: 2.5.5
Loaded preset: /Users/adrianovalumin/Desktop/Fooocus/presets/realistic.json
[Cleanup] Attempting to delete content of temp dir /var/folders/kg/fh_tr76d51b0fkh8l1n2_py40000gn/T/fooocus
[Cleanup] Cleanup successful
Total VRAM 18432 MB, total RAM 18432 MB
Set vram state to: SHARED
Always offload VRAM
Device: mps
VAE dtype: torch.float32
OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --attention-split
Refiner unloaded.
Running on local URL:  http://127.0.0.1:7865

To create a public link, set `share=True` in `launch()`.
model_type EPS
UNet ADM Dimension 2816
IMPORTANT: You are using gradio version 3.41.2, however version 4.44.1 is available, please upgrade.
--------
Using split attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using split attention in VAE
extra {'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_l.text_projection'}
left over keys: dict_keys(['cond_stage_model.clip_l.transformer.text_model.embeddings.position_ids'])
Base model loaded: /Users/adrianovalumin/Desktop/Fooocus/models/checkpoints/realisticStockPhoto_v20.safetensors
VAE loaded: None
Request to load LoRAs [('SDXL_FILM_PHOTOGRAPHY_STYLE_V1.safetensors', 0.25)] for model [/Users/adrianovalumin/Desktop/Fooocus/models/checkpoints/realisticStockPhoto_v20.safetensors].
Loaded LoRA [/Users/adrianovalumin/Desktop/Fooocus/models/loras/SDXL_FILM_PHOTOGRAPHY_STYLE_V1.safetensors] for UNet [/Users/adrianovalumin/Desktop/Fooocus/models/checkpoints/realisticStockPhoto_v20.safetensors] with 722 keys at weight 0.25.
Loaded LoRA [/Users/adrianovalumin/Desktop/Fooocus/models/loras/SDXL_FILM_PHOTOGRAPHY_STYLE_V1.safetensors] for CLIP [/Users/adrianovalumin/Desktop/Fooocus/models/checkpoints/realisticStockPhoto_v20.safetensors] with 264 keys at weight 0.25.
Fooocus V2 Expansion: Vocab with 642 words.
Fooocus Expansion engine loaded for cpu, use_fp16 = False.
Requested to load SDXLClipModel
Requested to load GPT2LMHeadModel
Loading 2 new models
[Fooocus Model Management] Moving model(s) has taken 1.67 seconds
Started worker with PID 7021
App started successful. Use the app with http://127.0.0.1:7865/ or 127.0.0.1:7865
[Parameters] Adaptive CFG = 7
[Parameters] CLIP Skip = 2
[Parameters] Sharpness = 2
[Parameters] ControlNet Softness = 0.25
[Parameters] ADM Scale = 1.5 : 0.8 : 0.3
[Parameters] Seed = 5656907459760800293
[Parameters] CFG = 3
[Fooocus] Loading control models ...
[Parameters] Sampler = dpmpp_2m - karras
[Parameters] Steps = 30 - 15
[Fooocus] Initializing ...
[Fooocus] Loading models ...
Refiner unloaded.
model_type EPS
UNet ADM Dimension 2816
Using split attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using split attention in VAE
extra {'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_l.text_projection'}
left over keys: dict_keys(['cond_stage_model.clip_l.transformer.text_model.embeddings.position_ids'])
Base model loaded: /Users/adrianovalumin/Desktop/Fooocus/models/checkpoints/juggernautXL_v8Rundiffusion.safetensors
VAE loaded: None
Request to load LoRAs [('SDXL_FILM_PHOTOGRAPHY_STYLE_V1.safetensors', 0.25)] for model [/Users/adrianovalumin/Desktop/Fooocus/models/checkpoints/juggernautXL_v8Rundiffusion.safetensors].
Loaded LoRA [/Users/adrianovalumin/Desktop/Fooocus/models/loras/SDXL_FILM_PHOTOGRAPHY_STYLE_V1.safetensors] for UNet [/Users/adrianovalumin/Desktop/Fooocus/models/checkpoints/juggernautXL_v8Rundiffusion.safetensors] with 722 keys at weight 0.25.
Loaded LoRA [/Users/adrianovalumin/Desktop/Fooocus/models/loras/SDXL_FILM_PHOTOGRAPHY_STYLE_V1.safetensors] for CLIP [/Users/adrianovalumin/Desktop/Fooocus/models/checkpoints/juggernautXL_v8Rundiffusion.safetensors] with 264 keys at weight 0.25.
Requested to load SDXLClipModel
Loading 1 new model
[Fooocus Model Management] Moving model(s) has taken 1.32 seconds
[Fooocus] Processing prompts ...
[Fooocus] Preparing Fooocus text #1 ...
[Prompt Expansion] 25-year-old woman from Dublin, Ireland, standing confidently in a cozy café with warm ambient lighting. Slender yet toned ectomorph physique (1.65m, 55kg), athletic posture. Copper-red hair (#A9593D) in loose, shoulder-length 3A curls framing her face. Striking emerald-green eyes with a soft, maternal gaze. Wearing a form-fitting knee-length dress in deep burgundy with lace detailing along the plunging V-neckline and sleeves, accentuating her figure. Pairing the dress with knee-high leather boots (matte black, chunky heel, buckled at the ankles). Minimal jewelry: thin gold necklace with a claddagh pendant. Makeup: natural freckles visible, subtle winged eyeliner, muted red lipstick. Background: rustic wooden tables, shelves of books (titles in English, Polish, Portuguese), and steaming teacups. Warm, inviting expression with a slight smile, hands resting gently on a leather-bound journal, intricate, elegant, highly detailed, dramatic
[Fooocus] Preparing Fooocus text #2 ...
[Prompt Expansion] 25-year-old woman from Dublin, Ireland, standing confidently in a cozy café with warm ambient lighting. Slender yet toned ectomorph physique (1.65m, 55kg), athletic posture. Copper-red hair (#A9593D) in loose, shoulder-length 3A curls framing her face. Striking emerald-green eyes with a soft, maternal gaze. Wearing a form-fitting knee-length dress in deep burgundy with lace detailing along the plunging V-neckline and sleeves, accentuating her figure. Pairing the dress with knee-high leather boots (matte black, chunky heel, buckled at the ankles). Minimal jewelry: thin gold necklace with a claddagh pendant. Makeup: natural freckles visible, subtle winged eyeliner, muted red lipstick. Background: rustic wooden tables, shelves of books (titles in English, Polish, Portuguese), and steaming teacups. Warm, inviting expression with a slight smile, hands resting gently on a leather-bound journal, intricate, elegant, highly detailed, dramatic
[Fooocus] Encoding positive #1 ...
[Fooocus] Encoding positive #2 ...
[Fooocus] Encoding negative #1 ...
[Fooocus] Encoding negative #2 ...
[Parameters] Denoising Strength = 1.0
[Parameters] Initial Latent shape: Image Space (1152, 896)
Preparation time: 25.54 seconds
Using karras scheduler.
[Fooocus] Preparing task 1/2 ...
[Sampler] refiner_swap_method = joint
[Sampler] sigma_min = 0.0291671771556139, sigma_max = 14.614643096923828
Requested to load SDXL
Loading 1 new model
[Fooocus Model Management] Moving model(s) has taken 60.93 seconds
  0%|                                                    | 0/30 [00:00<?, ?it/s]huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
	- Avoid using `tokenizers` before the fork if possible
	- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
/AppleInternal/Library/BuildRoots/799aba5a-efcd-11ef-b353-122ba06eff56/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphExecutable.mm:3561: failed assertion `Error: MLIR pass manager failed'
[1]    7021 abort      python entry_with_update.py --preset realistic
/opt/anaconda3/envs/fooocus/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

Additional information

Clean installation, zsh terminal, conda installed with GUI installer. MacBook Pro - M3 Pro 18gb

xDhii avatar Mar 04 '25 12:03 xDhii

This issue has been included in my Error Report submitted to Apple (as it is also occouring in SwarmUI, Open WebUI, etc) under reference FB16737092.

Please submit your own report to Apple; reference the previous submission.

Shanesan avatar Mar 05 '25 16:03 Shanesan

any solutions now?

generalwu1 avatar Mar 13 '25 05:03 generalwu1

@generalwu1 Running on latest MacOS with the latest pytorch installations

pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu pip install tensorflow tensorflow-macos tensorflow-metal

I'm not having errors any longer. You?

Shanesan avatar Apr 29 '25 16:04 Shanesan

@Shanesan which macos version do you have?

mschneider1711 avatar Jun 04 '25 08:06 mschneider1711

@mschneider1711 Currently on Sequoia 15.5 Beta, but surely was not on that April 29th.

Shanesan avatar Jun 04 '25 19:06 Shanesan