Skip to content

Fix mps device check for moe histogram routing#45754

Open
belamaran96-coder wants to merge 1 commit intohuggingface:mainfrom
belamaran96-coder:fix-moe-mps-histogram
Open

Fix mps device check for moe histogram routing#45754
belamaran96-coder wants to merge 1 commit intohuggingface:mainfrom
belamaran96-coder:fix-moe-mps-histogram

Conversation

@belamaran96-coder
Copy link
Copy Markdown

What does this PR do?

Fixes #45685

This PR updates the device check during the histogram calculation in the MoE routing logic (moe.py and finegrained_fp8.py).

Apple Silicon (mps) does not support histc for integer types, so it must be cast to a float before the operation, aligning it with the CPU behavior.

Code Agent Policy

  • I confirm that this is not a pure code agent PR.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline, Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

cc @amyeroberts (as discussed in the issue)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=45754&sha=bf5603

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.

[moe] mps interface has error "histogram_mps" not implemented for 'Int'

1 participant