0

I can't seem to figure out how to find out the input/output of a model from huggingface, specifically "dbmdz/electra-large-discriminator-finetuned-conll03-english". I keep getting the following error: Exception in thread "main" ai.djl.repository.zoo.ModelNotFoundException: No matching model with specified Input/Output type found.

I'm only trying to get the model and use it on a String. I can find and download other pytorch models such as '/sentence-transformers/all-MiniLM-L6-v2/' just not the dbmdz one and it doesn't have a tokenizer.json to use the Huggingface tokenizer.

Here is my code hopefully someone can help:

        Criteria<String[], Classifications[]> criteria = Criteria.builder()
                .setTypes(String[].class, Classifications[].class)
                .optTranslator(new MyTranslator(vocabularyPath, 128))
                .optProgress(new ProgressBar())
                .optModelUrls(
                        "djl://ai.djl.huggingface.pytorch/dbmdz/electra-large-discriminator-finetuned-conll03-english")
                .build();
        ZooModel<String[], Classifications[]> model = criteria.loadModel(); // EXCEPTION HAPPENS HERE

        // Run inference
        Predictor<String[], Classifications[]> predictor = model.newPredictor();
        Classifications[] predict = predictor.predict(new String[]{text});

        // Process the output
        for (Classifications classifications : predict) {
            for (Classifications.Classification classifaction : classifications.items()) {
                String label = classifaction.getClassName();
                double probability = classifaction.getProbability();
                System.out.println("ClassName: " + label);
                //System.out.println("Word: " + classifaction.getWord());
                //System.out.println("Label: " + label);
                System.out.println("Probability: " + probability);
                System.out.println();
            }
        }
        predictor.close();

I have tried downloading the model locally but had the same issue, tried using HuggingFace tokenizer but that did not work as the model doesn't have a tokenizer.json.

essm21
  • 1
  • 1

0 Answers0