huggingface / huggingface/candle

Codegemma-7b-instruct failure on Metal

Open
#2,090 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
21k
Forks
1.8k
Avg merge
16h 42m
Merged PRs (30d)
25

Description

`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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported `cargo run --features metal --example gemma -- --which code-7b-it` command, then compare its Metal failure with the same invocation using `--cpu`. Trace the example's Metal matmul path and stride handling; done means the CodeGemma example accepts prompts on Metal without the reported invalid-matmul error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.