Skip to content

Code example of using SpTokenizer #3014

Answered by frankfliu
dripp55 asked this question in Q&A
Discussion options

You must be logged in to vote

@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.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@dripp55
Comment options

Answer selected by dripp55
Comment options

You must be logged in to vote
2 replies
@dripp55
Comment options

@frankfliu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants