Improve error for truncation with too high stride (#1275)

This commit is contained in:
Connor Boyle
2023-06-12 01:38:42 -07:00
committed by GitHub
parent 348ed70e58
commit 8c9cfb0b68

View File

@ -316,7 +316,7 @@ impl Encoding {
return;
}
assert!(stride < max_len);
assert!(stride < max_len, "`stride` must be strictly less than `max_len={}` (note that `max_len` may be shorter than the max length of the original model, as it subtracts the number of special characters", max_len);
// When truncating, we lose the `sequence_ranges` information.
self.sequence_ranges.clear();