Skip to content

Commit

Permalink
Update unwrap logic
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLBuehler committed Mar 1, 2024
1 parent 3e0d469 commit b97bbc0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/logits_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ impl LogitsProcessor {
Ordering::Greater
}
})
.unwrap(); // It was certainly found.
// These are where the top n are
.unwrap_err();
// These are where the top n are
let top_n_toks_range =
next_token_index.saturating_sub(self.top_n_logprobs)..=next_token_index;
// The top n's values
Expand All @@ -116,7 +116,7 @@ impl LogitsProcessor {
Ordering::Greater
}
})
.unwrap(); // It was certainly found.
.unwrap_err();
top_n_toks.push(idx);
}

Expand Down Expand Up @@ -164,8 +164,8 @@ impl LogitsProcessor {
Ordering::Greater
}
})
.unwrap(); // It was certainly found.
// These are where the top n are
.unwrap_err();
// These are where the top n are
let top_n_toks_range =
next_token_index.saturating_sub(self.top_n_logprobs)..=next_token_index;
// The top n's values
Expand All @@ -184,7 +184,7 @@ impl LogitsProcessor {
Ordering::Greater
}
})
.unwrap(); // It was certainly found.
.unwrap_err();
top_n_toks.push(idx);
}

Expand Down

0 comments on commit b97bbc0

Please sign in to comment.