huggingface / huggingface/candle

`broadcast_as` error when processing multiple tokens at once in quantized example

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

Description

Hello all,

Thanks for your great work here. We are implementing speculative decoding at mistral.rs, and were in the final stages of testing when we discovered some incredibly strange behavior. Specifically, the following error results when sending multiple tokens at once during the completions steps:

`Error: cannot broadcast [3, 3] to [1, 32, 3, 5]`

Reproducing this error is simple:

In the [`quantized/main.rs:578`](https://github.com/huggingface/candle/blob/a09d451d11a91ea7a7feaa40460abb282581a0f1/candle-examples/examples/quantized/main.rs#L578):

```diff
- let input = Tensor::new(&[next_token], &device)?.unsqueeze(0)?;
+ let input = Tensor::new(&[next_token, next_token, next_token], &device)?.unsqueeze(0)?;
```

Is this a bug?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.