Handle the empty sequence case properly. (#712)
* Handle the empty sequence case properly. * Proper fix.
This commit is contained in:
parent
19042962d5
commit
4d56cef583
|
@ -18,7 +18,7 @@ impl Model {
|
|||
let input = Tensor::new(tokens, &dev)?.unsqueeze(0)?;
|
||||
let logits = self.inner.llama.forward(&input, tokens.len())?;
|
||||
let logits = logits.squeeze(0)?;
|
||||
let logits = if self.repeat_penalty == 1. {
|
||||
let logits = if self.repeat_penalty == 1. || tokens.is_empty() {
|
||||
logits
|
||||
} else {
|
||||
let start_at = self.tokens.len().saturating_sub(REPEAT_LAST_N);
|
||||
|
|
Loading…
Reference in New Issue