preserve "prev" length during rollback
This commit is contained in:
parent
a5c3f30cb6
commit
d5f4dec935
1 changed files with 4 additions and 0 deletions
|
@ -335,5 +335,9 @@ void llama_sampling_rollback(
|
|||
rollback_num = ctx_sampling->prev.size();
|
||||
}
|
||||
|
||||
// remove rollback_num elements from the end
|
||||
ctx_sampling->prev.erase(ctx_sampling->prev.end() - rollback_num, ctx_sampling->prev.end());
|
||||
|
||||
// Insert rollback_num zeros at the beginning to preserve the size of prev
|
||||
ctx_sampling->prev.insert(ctx_sampling->prev.begin(), rollback_num, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue