fix eof error in generate
This commit is contained in:
parent
b227261f21
commit
e1f0a0dc74
1 changed files with 2 additions and 2 deletions
|
@ -199,10 +199,10 @@ func (llm *llama) generate(tokens []C.llama_token, fn func(string)) error {
|
||||||
|
|
||||||
token, err := llm.sample(pastTokens, &opts)
|
token, err := llm.sample(pastTokens, &opts)
|
||||||
switch {
|
switch {
|
||||||
case err != nil:
|
|
||||||
return err
|
|
||||||
case errors.Is(err, io.EOF):
|
case errors.Is(err, io.EOF):
|
||||||
return nil
|
return nil
|
||||||
|
case err != nil:
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fn(llm.detokenize(token))
|
fn(llm.detokenize(token))
|
||||||
|
|
Loading…
Reference in a new issue