mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 10:38:54 +00:00
Optimize copy-2d for metal. (#2024)
* Optimize copy-2d for metal. * Add a hacky stopping rule for moondream.
This commit is contained in:
@ -123,7 +123,7 @@ impl TextGeneration {
|
||||
let next_token = self.logits_processor.sample(&logits)?;
|
||||
tokens.push(next_token);
|
||||
generated_tokens += 1;
|
||||
if next_token == eos_token {
|
||||
if next_token == eos_token || tokens.ends_with(&[27, 10619, 29] /* <END> */) {
|
||||
break;
|
||||
}
|
||||
let token = self.tokenizer.decode(&[next_token], true).map_err(E::msg)?;
|
||||
|
Reference in New Issue
Block a user