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
:(
Actual Behavior
:(
Steps to Reproduce
:(
Debug Logs
:(
Other
No response
Instead of getting the generated image, this error is thrown. Why arent the corresponding logs attached when opening the issue automatically?
use this piece of code to convert the float8_e4m3fm to float16, as macos doesn't support float8
from safetensors.torch import save_file, safe_open
import torch
# Load model weights from safetensors on CPU
state_dict = {}
with safe_open("models/diffusion_models/flux1-dev-kontext_fp8_scaled.safetensors", framework="pt", device="cpu") as f:
for k in f.keys():
v = f.get_tensor(k)
# Cast FP8 weights to float16 on CPU
if v.dtype not in [torch.float16, torch.float32, torch.bfloat16]:
v = v.to(torch.float16)
state_dict[k] = v
# Save as safetensors
save_file(state_dict, "models/diffusion_models/flux1-dev-kontext_fp16_scaled.safetensors")
convert both the text_encoder and flux1-dev file
then try to run the code again
I am brand new to ComfyUI and am attempting to run it on a M4 Mac Mini Pro. I am getting this same error and I appreciate your feedback @jainamnahar14surat however I have no idea as to where to place that code :-) -- finding good info for beginners (especially for the mac environment) can be challenging as the tech changes so quickly -- before finding this thread I assumed I had installed all of my prerequisite software wrong, is that still a possibility? Either way, any guidance on how to fix this would be appreciated.