Decodes a list of tokens into a string. WARNING: the default behaviour of this function is lossy, since decoded bytes are not guaranteed to be valid UTF-8. You can control this behaviour using the `errors` parameter, for instance, setting `errors=strict`. ```
(self, tokens: Sequence[int], errors: str = "replace")
| 273 | return self._core_bpe.decode_bytes(tokens) |
| 274 | |
| 275 | def decode(self, tokens: Sequence[int], errors: str = "replace") -> str: |
| 276 | """Decodes a list of tokens into a string. |
| 277 | |
| 278 | WARNING: the default behaviour of this function is lossy, since decoded bytes are not |
| 279 | guaranteed to be valid UTF-8. You can control this behaviour using the `errors` parameter, |
| 280 | for instance, setting `errors=strict`. |
| 281 | |
| 282 | ``` |
| 283 | >>> enc.decode([31373, 995]) |
| 284 | 'hello world' |
| 285 | ``` |
| 286 | """ |
| 287 | return self._core_bpe.decode_bytes(tokens).decode("utf-8", errors=errors) |
| 288 | |
| 289 | def decode_single_token_bytes(self, token: int) -> bytes: |
| 290 | """Decodes a token into bytes. |