Skip to content

FILL-MASK task code question #2265

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

You must be logged in to vote

@LMartinezEXEX
This is a mock test, we created a Block that mock the real model's output.

In real case, you need load a huggingface model from the folder, or using existing DJL's huggingface model zoo:

String text = "Hello I'm a [MASK] model.";
Criteria<String, Classifications> criteria =
        Criteria.builder()
                .setTypes(String.class, Classifications.class)
                .optModelUrls("djl://ai.djl.huggingface.pytorch/bert-base-uncased")
                .optEngine("PyTorch")
                .build();

try (ZooModel<String, Classifications> model = criteria.loadModel();
        Predictor<String, Classifications> predictor = model.newPredictor()) {
    Classifications …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by LMartinezEXEX
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