Skip to content

Commit

Permalink
usability fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Feb 22, 2024
1 parent c3fed8f commit ca5fd2b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion controllers/aici_abi/src/toktree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,14 @@ impl TokTrie {
}

pub fn token_dbg(&self, idx: u32) -> String {
format!("{:?}[{}]", self.token_str(idx), idx)
if idx == self.info.tok_eos {
"EOS".to_string()
} else if idx as usize >= self.vocab_size() {
format!("OOB[{}]", idx)
} else {
// format!("{:?}[{}]", self.token_str(idx), idx)
format!("{:?}", self.token_str(idx))
}
}

pub fn token_str(&self, idx: u32) -> String {
Expand Down Expand Up @@ -471,6 +478,8 @@ impl TokTrie {
}
}
r.trie_finished();
// revert the fake token
toks.disallow_token(defl_tok);
}
}

Expand Down

0 comments on commit ca5fd2b

Please sign in to comment.