Trying to convert Float8_e4m3fn to the MPS backend but it does not have support for that dtype.
Custom Node Testing
- [x] I have tried disabling custom nodes and the issue persists (see how to disable custom nodes if you need help)
Expected Behavior
The image generation should be happen
Actual Behavior
It is always giving error while loading the model. It is due to the unsupported data type float8 over mac
Steps to Reproduce
Just run the main.py on the any macOS
Debug Logs
# ComfyUI Error Report
## Error Details
- **Node ID:** 31
- **Node Type:** KSampler
- **Exception Type:** TypeError
- **Exception Message:** Trying to convert Float8_e4m3fn to the MPS backend but it does not have support for that dtype.
## Stack Trace
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jainamnahar/Documents/GitHub/ComfyUI/comfy/ldm/flux/model.py", line 113, in forward_orig
img = self.img_in(img)
^^^^^^^^^^^^^^^^
File "/Users/jainamnahar/Documents/GitHub/ComfyUI/venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1751, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jainamnahar/Documents/GitHub/ComfyUI/venv/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1762, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jainamnahar/Documents/GitHub/ComfyUI/comfy/ops.py", line 84, in forward
return self.forward_comfy_cast_weights(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jainamnahar/Documents/GitHub/ComfyUI/comfy/ops.py", line 375, in forward_comfy_cast_weights
weight, bias = cast_bias_weight(self, input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jainamnahar/Documents/GitHub/ComfyUI/comfy/ops.py", line 51, in cast_bias_weight
bias = comfy.model_management.cast_to(s.bias, bias_dtype, device, non_blocking=non_blocking, copy=has_function, stream=offload_stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jainamnahar/Documents/GitHub/ComfyUI/comfy/model_management.py", line 1017, in cast_to
return weight.to(dtype=dtype, copy=copy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Trying to convert Float8_e4m3fn to the MPS backend but it does not have support for that dtype.
2025-07-21T14:27:55.849065 - Prompt executed in 0.04 seconds
Other
No response
That's related to torch mps support, nothing we can do
Root cause
-
The weights you pulled are stored in FP8 (Float8_e4m3fn) format. PyTorch’s MPS backend (the one that drives Apple-silicon GPUs) only understands FP32, FP16 and BF16. As soon as it tries to move an FP8 tensor onto the GPU it throws
TypeError: Trying to convert Float8_e4m3fn to the MPS backend …so the crash is not ComfyUI-specific—it’s a limitation of the current MPS kernel implementation.
-
Switching to the FP16 checkpoint resolves the dtype error, but the full FLUX-1 Kontext-dev stack is still enormous: UNet ≈ 23 GB + T5-XXL ≈ 10 GB + CLIP-L + VAE … A Mac with 16 GB (or even 24 GB) of unified memory simply cannot keep all of that resident on the GPU, so PyTorch runs out of memory and the process is killed during inference.
What I tried
- Deleted the FP8 files and replaced them with
flux1-kontext-dev.safetensors(FP16) +t5xxl_fp16.safetensors+clip_l.safetensors+ae.safetensors. - Forced FP16 in the ComfyUI node (
weight_dtype = fp16). - Reduced resolution / steps, disabled high-RAM nodes, etc.
Despite that, the run still aborts with an MPS OOM once the UNet and T5 are both in memory.
Recommendation
For practical work with FLUX-1 you really need a discrete NVIDIA card (RTX 3090 / 4090 or better) and the CUDA backend. If you must stay on macOS, consider:
- Remote inference (invoke AI / ComfyUI-server on a GPU box).
- Using a much smaller model (e.g. SD 1.5, SDXL-LCM) that fits into the 16-bit MPS budget.
Otherwise, running Windows/Linux on a machine with ≥ 24 GB VRAM is the most reliable path.
I wanted to try wan 2.2 locally, so I installed ComfyUI for the first time on my Mac Studio (Apple Silicon M1 Max). I chose the wan2.2 text to video template and downloaded over 30GB of models which took hours. I went to run it for the first time and got this error. Is there any way to filter out templates from the library that won't work on my machine to avoid such disappointments in the future?
Switching to the FP16 checkpoint resolves the dtype error
I tried it on a 32GB Mac Studio M1, and it works. However, it takes about 10x longer when I run the same model and workflow on a laptop with an 8GB 3050. So I suggest changing the model.
means ComfyUI (or one of its dependencies) is trying to use a Float8 tensor format that MPS simply doesn’t support. This is likely triggered by:
• A recent PyTorch nightly/dev build (2.10.0.dev20250930) introducing Float8 support. • ComfyUI or a model trying to use that dtype during sampling. • MPS backend (used on macOS) not supporting Float8 yet.
Fix Options
Option 1: Downgrade PyTorch to a stable version
Use a version that doesn’t include Float8:
pip uninstall torch pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2
This version is known to work well with MPS and ComfyUI.
Option 2: Force ComfyUI to avoid Float8
If you're using custom nodes or models that trigger Float8, you can try:
• Switching to a different sampler (e.g., Euler or DPM++ 2M). • Avoiding advanced samplers like KSamplerAdvanced if they force precision modes. • Adding this to your ComfyUI launch flags (if supported):
Bash --disable-float8 Though this flag isn’t officially documented, some forks support it.
Option 3: Switch to CPU or install ROCm/CUDA (not ideal on Mac)
MPS is limited in precision support. If you want full compatibility, you'd need to run ComfyUI on a Linux box with CUDA or ROCm — but that defeats your modular Mac-native flow.
• Locking PyTorch to a stable version (2.1.2). • Avoiding nightly builds unless testing specific features. • Keeping ComfyUI nodes minimal and modular — test each one after install.
PyTorch Cleanup + Reinstall Script (macOS, Python 3.9)
Bash:
Step 1: Uninstall any existing PyTorch packages
python3 -m pip uninstall -y torch torchvision torchaudio
Step 2: Install stable versions compatible with MPS
python3 -m pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2
Step 3: Verify MPS availability
python3 -c "import torch; print('MPS available:', torch.backends.mps.is_available())"
You should see:
MPS available: True
If it says False, we’ll troubleshoot your Metal setup next.
If you want to pivot toward a GGUF-based local inference flow (e.g., for text or hybrid workflows), here’s a modular plan:
• ComfyUI for image workflows • LM Studio or Ollama for GGUF-based text models • Bridge via local API or file drop: ◦ Generate prompt in LM Studio ◦ Drop into ComfyUI via Text Input node or custom loader • Optional Node Pack: Build a GGUF Text Loader node that reads .txt or .json from a local GGUF output folder