De-tokenize. Args: t: a list of token ids. offset: for incrementally decoding. Default to None, which means not applied. skip_special_tokens: Whether or not to remove special tokens in the decoding. Returns:
(
self,
t: Sequence[int],
offset: int | None = None,
skip_special_tokens: bool = True,
)
| 483 | return encoded |
| 484 | |
| 485 | def decode( |
| 486 | self, |
| 487 | t: Sequence[int], |
| 488 | offset: int | None = None, |
| 489 | skip_special_tokens: bool = True, |
| 490 | ): |
| 491 | """De-tokenize. |
| 492 | |
| 493 | Args: |
| 494 | t: a list of token ids. |
| 495 | offset: for incrementally decoding. Default to None, which |
| 496 | means not applied. |
| 497 | skip_special_tokens: Whether or not to remove special |
| 498 | tokens in the decoding. |
| 499 | |
| 500 | Returns: |
| 501 | str: text of decoding tokens. |
| 502 | """ |
| 503 | return self.model.decode(t, offset, skip_special_tokens) |
| 504 | |
| 505 | def detokenize_incrementally(self, |
| 506 | all_input_ids: Sequence[int], |
no outgoing calls