ComfyUI Startup Log on macOS Sequoia 15.1.1 with MPS and PyTorch (BFloat16 Unsupported)
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Expected Behavior
The application should start without any errors on macOS Sequoia 15.1.1, utilizing the Metal Performance Shaders (MPS) for accelerated tensor operations. It should handle all operations efficiently, including the use of BFloat16, and properly load the model without crashing or generating warnings related to unsupported features like BFloat16 on MPS. All components should work seamlessly, and there should be no issues with GPU acceleration in the expected environment.
### Actual Behavior
The application crashes or fails to start on macOS Sequoia 15.1.1 due to issues with the Metal Performance Shaders (MPS) or unsupported tensor operations such as BFloat16. The model fails to load, and warnings related to the incompatibility of BFloat16 with MPS are generated. These errors prevent the expected functionality, and the application does not utilize GPU acceleration properly in the current environment.
### Steps to Reproduce
**Steps to Reproduce:**
1. **Install the application on macOS:**
- Use macOS Sequoia 15.1.1 (or a similar version) with Metal Performance Shaders (MPS) enabled.
2. **Create a Conda environment:**
- Run the following commands in your terminal:
conda create -n comfyui python==3.10.12
conda activate comfyui
3. **Install ComfyUI:**
- Clone the ComfyUI repository:
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
- Install dependencies:
pip install -r requirements.txt
4. **Install custom nodes:**
- Navigate to the `custom_nodes` directory and clone the ComfyUI-Manager repository:
cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager.git
pip install -r requirements.txt
cd ..
5. **Run ComfyUI:**
- Run the following command to start the ComfyUI application:
python main.py
Or use the optional arguments for split-cross-attention:
python main.py --use-split-cross-attention
Or disable parallelism for tokenizers:
TOKENIZERS_PARALLELISM=false python main.py --use-split-cross-attention
6. **Upload and run the model:**
- Upload the "workflow file.json" workflow.
- Run the model to observe the issue.
---
These steps outline a clear path to reproduce the issue in a macOS environment, specifically with MPS-enabled systems.
### Debug Logs
```powershell
% python main.py
[START] Security scan
[DONE] Security scan
## ComfyUI-Manager: installing dependencies done.
** ComfyUI startup time: 2024-11-28 22:30:07.534729
** Platform: Darwin
** Python version: 3.10.12 (main, Jul 5 2023, 15:34:07) [Clang 14.0.6 ]
** Python executable: /Volumes/Samsung2TB/VirtualEnvDir/comfyui3/bin/python
** ComfyUI Path: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI
** Log path: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfyui.log
Prestartup times for custom nodes:
2.7 seconds: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/ComfyUI-Manager
Total VRAM 32768 MB, total RAM 32768 MB
pytorch version: 2.2.2
Set vram state to: SHARED
Device: mps
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
[Prompt Server] web root: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/web
[Crystools INFO] Crystools version: 1.21.0
[Crystools INFO] CPU: Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz - Arch: x86_64 - OS: Darwin 24.1.0
[Crystools ERROR] Could not init pynvml (Nvidia).NVML Shared Library Not Found
[Crystools WARNING] No GPU with CUDA detected.
### Loading: ComfyUI-Manager (V2.52.1)
### ComfyUI Revision: 2866 [0d4e29f1] | Released on '2024-11-27'
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
Import times for custom nodes:
0.0 seconds: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/websocket_image_save.py
0.0 seconds: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/ComfyUI-Custom-Scripts
0.0 seconds: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/ComfyUI-GGUF
0.1 seconds: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/ComfyUI-Crystools
0.2 seconds: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/ComfyUI-Manager
4.0 seconds: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/x-flux-comfyui
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json
Starting server
To see the GUI go to: http://127.0.0.1:8188
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
FETCH DATA from: /Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/ComfyUI-Manager/extension-node-map.json [DONE]
[]
[]
got prompt
Using split attention in VAE
Using split attention in VAE
/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/ComfyUI-GGUF/nodes.py:79: UserWarning: The given NumPy array is not writable, and PyTorch does not support non-writable tensors. This means writing to this tensor will result in undefined behavior. You may want to copy the array to protect its data or make it writable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_numpy.cpp:212.)
torch_tensor = torch.from_numpy(tensor.data) # mmap
ggml_sd_loader:
GGMLQuantizationType.Q4_K 144
GGMLQuantizationType.F32 50
GGMLQuantizationType.Q6_K 25
Requested to load FluxClipModel_
Loading 1 new model
loaded completely 0.0 323.94775390625 True
Requested to load FluxClipModel_
Loading 1 new model
ggml_sd_loader:
GGMLQuantizationType.F16 476
GGMLQuantizationType.Q4_0 304
model weight dtype torch.bfloat16, manual cast: None
model_type FLUX
Requested to load Flux
Loading 1 new model
!!! Exception during processing !!! BFloat16 is not supported on MPS
Traceback (most recent call last):
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/execution.py", line 323, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/execution.py", line 198, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/execution.py", line 169, in _map_node_over_list
process_inputs(input_dict, i)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/execution.py", line 158, in process_inputs
results.append(getattr(obj, func)(**inputs))
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/nodes.py", line 1457, in sample
return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/nodes.py", line 1424, in common_ksampler
samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/sample.py", line 43, in sample
samples = sampler.sample(noise, positive, negative, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/samplers.py", line 855, in sample
return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/samplers.py", line 753, in sample
return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/samplers.py", line 730, in sample
self.inner_model, self.conds, self.loaded_models = comfy.sampler_helpers.prepare_sampling(self.model_patcher, noise.shape, self.conds)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/sampler_helpers.py", line 62, in prepare_sampling
comfy.model_management.load_models_gpu([model] + models, memory_required=memory_required, minimum_memory_required=minimum_memory_required)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/model_management.py", line 545, in load_models_gpu
cur_loaded_model = loaded_model.model_load(lowvram_model_memory, force_patch_weights=force_patch_weights)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/model_management.py", line 327, in model_load
raise e
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/model_management.py", line 323, in model_load
self.real_model = self.model.patch_model(device_to=patch_model_to, lowvram_model_memory=lowvram_model_memory, load_weights=load_weights, force_patch_weights=force_patch_weights)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/model_patcher.py", line 480, in patch_model
self.load(device_to, lowvram_model_memory=lowvram_model_memory, force_patch_weights=force_patch_weights, full_load=full_load)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/custom_nodes/ComfyUI-GGUF/nodes.py", line 186, in load
super().load(*args, force_patch_weights=True, **kwargs)
File "/Volumes/Samsung2TB/GitHub/AI/ComfyUIRoot/ComfyUI/comfy/model_patcher.py", line 452, in load
x[2].to(device_to)
File "/Volumes/Samsung2TB/VirtualEnvDir/comfyui3/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1152, in to
return self._apply(convert)
File "/Volumes/Samsung2TB/VirtualEnvDir/comfyui3/lib/python3.10/site-packages/torch/nn/modules/module.py", line 825, in _apply
param_applied = fn(param)
File "/Volumes/Samsung2TB/VirtualEnvDir/comfyui3/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1150, in convert
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
TypeError: BFloat16 is not supported on MPS
Prompt executed in 33.90 seconds
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)
```
### Other
check this file for full error report
[error_report.txt](https://github.com/user-attachments/files/17951009/error_report.txt)
WorkFlow
[workflow file.json](https://github.com/user-attachments/files/17951049/workflow.file.json)
Model download links
Flux Dev
models/unet
[flux1-dev-Q4_0.gguf](https://huggingface.co/city96/FLUX.1-dev-gguf/blob/main/flux1-dev-Q4_0.gguf)
Clips
models/clip/
[t5-v1_1-xxl-encoder-Q4_K_M.gguf](https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/blob/main/t5-v1_1-xxl-encoder-Q4_K_M.gguf)
[clip_l.safetensors](https://huggingface.co/comfyanonymous/flux_text_encoders/blob/main/clip_l.safetensors)
vae
models/vae
ae.safetensors, renamed as flux_vae [download](https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/ae.safetensors)
Error Screenshots
Contributor guide
Assessment
This issue has not been assessed yet.