Detokenize a list of tokens. Args: tokens: The list of tokens to detokenize. prev_tokens: The list of previous tokens. Offset mapping will be performed if provided. special: Whether to detokenize special tokens. Returns: The detokeniz
(
self,
tokens: List[int],
prev_tokens: Optional[List[int]] = None,
special: bool = False,
)
| 611 | return self.tokenizer_.tokenize(text, add_bos, special) |
| 612 | |
| 613 | def detokenize( |
| 614 | self, |
| 615 | tokens: List[int], |
| 616 | prev_tokens: Optional[List[int]] = None, |
| 617 | special: bool = False, |
| 618 | ) -> bytes: |
| 619 | """Detokenize a list of tokens. |
| 620 | |
| 621 | Args: |
| 622 | tokens: The list of tokens to detokenize. |
| 623 | prev_tokens: The list of previous tokens. Offset mapping will be performed if provided. |
| 624 | special: Whether to detokenize special tokens. |
| 625 | |
| 626 | Returns: |
| 627 | The detokenized string. |
| 628 | """ |
| 629 | return self.tokenizer_.detokenize( |
| 630 | tokens, prev_tokens=prev_tokens, special=special |
| 631 | ) |
| 632 | |
| 633 | def set_cache(self, cache: Optional[BaseLlamaCache]): |
| 634 | """Set the cache. |
no outgoing calls