Skip to content

Add FP8 to FP16 conversion for MPS compatibility#14606

Closed
kkphyo999-ops wants to merge 3 commits into
Comfy-Org:masterfrom
kkphyo999-ops:mps-fp8-fix
Closed

Add FP8 to FP16 conversion for MPS compatibility#14606
kkphyo999-ops wants to merge 3 commits into
Comfy-Org:masterfrom
kkphyo999-ops:mps-fp8-fix

Conversation

@kkphyo999-ops

@kkphyo999-ops kkphyo999-ops commented Jun 23, 2026

Copy link
Copy Markdown

Summary

  • Convert FP8 tensors to FP16 during model loading (both safetensors and .pt/.ckpt paths) when running on Apple MPS devices, preventing runtime errors
  • Add fallback FP8 safety checks in cast_to to catch any FP8 tensors that slip through at inference time
  • MPS does not support FP8 dtypes natively; conversion goes FP8 → FP32 → FP16

Test plan

  • Load an FP8 safetensors model on an MPS (Apple Silicon) device and verify it converts to FP16 with log output
  • Load an FP8 .pt/.ckpt model on MPS and verify batch conversion with summary log
  • Verify non-MPS (CUDA/CPU) loading is unaffected
  • Verify non-FP8 models on MPS load without unnecessary conversions

🤖 Generated with Claude Code

API Node PR Checklist

Scope

  • Is API Node Change

Pricing & Billing

  • Need pricing update
  • No pricing update

If Need pricing update:

  • Metronome rate cards updated
  • Auto‑billing tests updated and passing

QA

  • QA done
  • QA not required

Comms

  • Informed Kosinkadink

bigcat88 and others added 3 commits June 18, 2026 07:57
Convert FP8 tensors to FP16 during model loading (safetensors and .pt/.ckpt)
and add a fallback safety net in cast_to for any FP8 tensors that slip through
at inference time, preventing MPS runtime errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f4f6b113-2866-4d89-9f70-22a39d16f7fb

📥 Commits

Reviewing files that changed from the base of the PR and between f6c162d and e419bfa.

⛔ Files ignored due to path filters (1)
  • comfy_api_nodes/apis/kling.py is excluded by !comfy_api_nodes/apis/**
📒 Files selected for processing (5)
  • comfy/model_management.py
  • comfy/utils.py
  • comfy_api_nodes/nodes_kling.py
  • comfyui_version.py
  • pyproject.toml

📝 Walkthrough

Walkthrough

This PR makes three independent sets of changes. First, FP8 tensor coercion for MPS devices is added: cast_to in model_management.py now detects FP8 input dtype or weight dtype targeting MPS and downcasts to torch.float16 with a warning; load_torch_file in utils.py applies the same conversion in both the safetensors and torch.load branches. Second, KlingVideoNode gains kling-3.0-turbo support via new helper functions (build_turbo_shot_prompt, execute_kling_turbo), updated model/resolution/pricing schema, and an early-exit execution branch. Third, the project version is bumped from 0.25.0 to 0.25.1 in comfyui_version.py and pyproject.toml.

✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch mps-fp8-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@kkphyo999-ops kkphyo999-ops deleted the mps-fp8-fix branch June 23, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants