-
Can someone please point me at a complete code example of constructing and using SpTokenizer to tokenize a given sentence? I saw in the JavaDocs that its constructor requires a model argument - what can I enter there? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You can find SpTokenizer examples in this test code: https://github.com/deepjavalibrary/djl/blob/master/extensions/sentencepiece/src/test/java/ai/djl/sentencepiece/SpTokenizerTest.java#L31 You can also find text embedding examples here: https://github.com/deepjavalibrary/djl/blob/master/extensions/sentencepiece/src/test/java/ai/djl/sentencepiece/SpTextEmbeddingTest.java We only support run inference with pre-trained model. You can train it with python code and use DJL to load the model. By the way, we have Huggingface tokenizer support in DJL, it can also load sentencepiece model. |
Beta Was this translation helpful? Give feedback.
-
@dripp55 |
Beta Was this translation helpful? Give feedback.
@dripp55
You can find SpTokenizer examples in this test code: https://github.com/deepjavalibrary/djl/blob/master/extensions/sentencepiece/src/test/java/ai/djl/sentencepiece/SpTokenizerTest.java#L31
You can also find text embedding examples here: https://github.com/deepjavalibrary/djl/blob/master/extensions/sentencepiece/src/test/java/ai/djl/sentencepiece/SpTextEmbeddingTest.java
We only support run inference with pre-trained model. You can train it with python code and use DJL to load the model.
By the way, we have Huggingface tokenizer support in DJL, it can also load sentencepiece model.