Decode tokens to text. Not necessary for most cases. Args: tokens (torch.Tensor): Input tokens. Returns: str: Decoded text.
(self, tokens: torch.Tensor)
| 123 | |
| 124 | @abstractmethod |
| 125 | def decode(self, tokens: torch.Tensor) -> str: |
| 126 | """Decode tokens to text. Not necessary for most cases. |
| 127 | |
| 128 | Args: |
| 129 | tokens (torch.Tensor): Input tokens. |
| 130 | |
| 131 | Returns: |
| 132 | str: Decoded text. |
| 133 | """ |
| 134 | raise NotImplementedError( |
| 135 | f'{self.__class__.__name__} does not implement' |
| 136 | '`decode` method.') |
| 137 | |
| 138 | @abstractmethod |
| 139 | def get_token_len(self, prompt: str) -> int: |
no outgoing calls
no test coverage detected