mirror of
https://github.com/mii443/tokenizers.git
synced 2025-12-06 04:38:23 +00:00
Option to skip special tokens while decoding
This commit is contained in:
@@ -192,12 +192,16 @@ impl Tokenizer {
|
||||
.into()
|
||||
}
|
||||
|
||||
fn decode(&self, ids: Vec<u32>) -> PyResult<String> {
|
||||
ToPyResult(self.tokenizer.decode(ids)).into()
|
||||
fn decode(&self, ids: Vec<u32>, skip_special_tokens: bool) -> PyResult<String> {
|
||||
ToPyResult(self.tokenizer.decode(ids, skip_special_tokens)).into()
|
||||
}
|
||||
|
||||
fn decode_batch(&self, sentences: Vec<Vec<u32>>) -> PyResult<Vec<String>> {
|
||||
ToPyResult(self.tokenizer.decode_batch(sentences)).into()
|
||||
fn decode_batch(
|
||||
&self,
|
||||
sentences: Vec<Vec<u32>>,
|
||||
skip_special_tokens: bool,
|
||||
) -> PyResult<Vec<String>> {
|
||||
ToPyResult(self.tokenizer.decode_batch(sentences, skip_special_tokens)).into()
|
||||
}
|
||||
|
||||
fn token_to_id(&self, token: &str) -> Option<u32> {
|
||||
|
||||
Reference in New Issue
Block a user