Interface Tokenizer
- All Known Implementing Classes:
QwenTokenizer
Deprecated.
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Decode token ids to StringDeprecated.Encode the input text, handles special tokens.encodeOrdinary(String text) Deprecated.Encoding that ignores any special tokens.
-
Method Details
-
encodeOrdinary
Deprecated.Encoding that ignores any special tokens. There is no guarantee that the results will be completely consistent with the model output. Compared with the python version, there are some differences. It is known that the results of processing 2 or 4 consecutive spaces are different. Detailed information for qwen reference: https://github.com/QwenLM/Qwen/blob/main/tokenization_note_zh.md- Parameters:
text- The input.- Returns:
- The list of token ids.
-
encode
List<Integer> encode(String text, String allowedSpecial) throws NoSpecialTokenExists, UnSupportedSpecialTokenMode Deprecated.Encode the input text, handles special tokens. There is no guarantee that the results will be completely consistent with the model output. Compared with the python version, there are some differences. It is known that the results of processing 2 or 4 consecutive spaces are different. Detailed information for qwen reference: https://github.com/QwenLM/Qwen/blob/main/tokenization_note_zh.md- Parameters:
text- The input to be encode.allowedSpecial- The special token options can be "all"|"none"|"none_raise", if none_raise, then an `NoSpecialTokenExists` is throw if any special token is encountered in text, if null, use "all"- Returns:
- The list of token encode.
- Throws:
NoSpecialTokenExists- No special token in the input.UnSupportedSpecialTokenMode- the allowedSpecial is not["all"|"none"|"none_raise"]
-
decode
Deprecated.Decode token ids to String- Parameters:
ids- The input token ids, eg: [2610, 525, 264, 10950, 17847, 13], will be Decoded to "You are a helpful assistant."- Returns:
- The token ids corresponding string.
-