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

Codegemma-7b-instruct failure on Metal #2090

Open
niklasha opened this issue Apr 19, 2024 · 4 comments
Open

Codegemma-7b-instruct failure on Metal #2090

niklasha opened this issue Apr 19, 2024 · 4 comments

Comments

@niklasha
Copy link
Contributor

cargo run --features metal --example gemma -- --which code-7b-it --prompt "explain isakmpd's architecture"
fails with:

retrieved the files in 27.197292ms
loaded the model in 36.859128625s
explain isakmpd's architectureError: Metal error Invalid matmul arguments [1296, 81, 9, 1] [36864, 256, 4096, 1] (9, 256, 9)

The prompt is not of great importance, other prompts just give different strides, but fails equally.
I did look into this a bit, but I confess it sort of goes over my current competence. I thought the stride vector always should be decreasing, but the rhs stride info is, as can be seen [36864, 256, 4096, 1], which does not fit into my mental model. However the running with "--cpu" does accept this. I am still sceptic it does the math correctly, since it too seems to get the same striding, but it may be I that misunderstand the concept.

@LaurentMazare
Copy link
Collaborator

Thanks for reporting this, I think it's an issue that only happens on the 7b because of MQA (which is not present on the 2b version which was used for testing), could you give a try to #2091 , hopefully this should provide the appropriate fix.

@niklasha
Copy link
Contributor Author

I have tested, and it does not crash anymore, thanks, and the output matches "--cpu". However the quality of the response to the example prompt is pretty low, subjectively. But that is not the key issue here I guess :-)

@LaurentMazare
Copy link
Collaborator

LaurentMazare commented Apr 19, 2024

Glad that it helped. Did you make sure to respect the prompt format? This example is very barebone and doesn't do it for you. https://huggingface.co/blog/codegemma#prompt-format

@niklasha
Copy link
Contributor Author

Aha! thanks, well I just was testing and did not do my homework. No I did not respect the prompt format :-)

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

No branches or pull requests

2 participants