Skip to content

Commit

Permalink
token healing fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed May 6, 2024
1 parent 0befe69 commit d665934
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controllers/guidance_ctrl/src/earley/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use aici_abi::{

use super::grammar::{CGrammar, CSymIdx, CSymbol, ModelVariable, RuleIdx};

const DEBUG: bool = true;
const DEBUG: bool = false;
const INFO: bool = true;

macro_rules! debug {
Expand Down
4 changes: 2 additions & 2 deletions controllers/guidance_ctrl/src/tokenparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ impl TokenParser {

pub fn bytes_since(&self, mut idx: usize) -> &[u8] {
idx += self.grm_prefix.len();
if idx >= self.llm_bytes.len() {
let endp = std::cmp::min(self.llm_bytes.len(), self.parser.hidden_start());
if idx >= self.llm_bytes.len() || idx >= endp {
return &[];
}
let endp = std::cmp::min(self.llm_bytes.len(), self.parser.hidden_start());
&self.llm_bytes[idx..endp]
}

Expand Down

0 comments on commit d665934

Please sign in to comment.