0

has anyone managed to translate something using Helsinki-NLP and ONNX Runtime in Java? Using a Python script, I generated these files:

├── encoder_model.onnx
├── decoder_model.onnx
├── decoder_with_past_model.onnx
├── config.json
├── generation_config.json
├── tokenizer_config.json
├── special_tokens_map.json
├── source.spm
└── target.spm

Then I try to run it in Java like this:

OrtSession.SessionOptions opts = new OrtSession.SessionOptions();

// 2. Load models
System.out.println("Loading encoder and decoder...");
OrtSession encoder = env.createSession(modelDir + "/encoder_model.onnx", opts);
OrtSession decoder = env.createSession(modelDir + "/decoder_model.onnx", opts);

// 3. Tokenizer
HuggingFaceTokenizer tokenizer = HuggingFaceTokenizer.newInstance(modelDir);

But the problem is that there is no tokenizer.json, and the tokenizer tries to download it from Hugging Face, which results in a 404 — I don’t know how to create tokenizer.json.

Or maybe there is some other simpler way to use this model in Java?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.