Skip to content

Commit

Permalink
llama : refactor samplers internal implementation (#9370)
Browse files Browse the repository at this point in the history
  • Loading branch information
slaren authored Sep 8, 2024
1 parent 2a358fb commit 19f4a7b
Show file tree
Hide file tree
Showing 4 changed files with 841 additions and 685 deletions.
4 changes: 4 additions & 0 deletions src/llama-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ struct ring_buffer {
}

void push_back(const T & value) {
if (capacity == 0) {
throw std::runtime_error("ring buffer: capacity is zero");
}

if (sz == capacity) {
// advance the start when buffer is full
first = (first + 1) % capacity;
Expand Down
Loading

0 comments on commit 19f4a7b

Please sign in to comment.