Skip to content

Commit

Permalink
fix underflow in reported num_tokens; fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Jul 30, 2024
1 parent fc08c32 commit f79d955
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parser/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Reporter {
res.push(ParserOutput::Text {
bytes: new_text.into(),
log_prob: 0.0, // TODO
num_tokens: num_tokens - self.token_ptr,
num_tokens: num_tokens.saturating_sub(self.token_ptr),
is_generated: self.is_generated,
stats,
});
Expand Down

0 comments on commit f79d955

Please sign in to comment.