Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove state cast to fp32 #2423

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Remove state cast to fp32 #2423

wants to merge 1 commit into from

Conversation

finnvoor
Copy link

Currently states are always cast to fp32 tensors. This causes a ValueError when, e.g., a fp16 KV cache is used with a fp16 model:

ValueError: In op, of type scaled_dot_product_attention, named attn_output.1, the named input 'key' must have the same data type as the named input 'query'. However, key has dtype fp32 whereas query has dtype fp16.

It's unclear to me why these are cast to fp32's, and removing this fixes both full and half precision conversions at least in my case, but I'm not familiar enough with coremltools to know if there are any side effects to this change.

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.

1 participant