OpenNMT / OpenNMT/CTranslate2

I can not get expected result following the quick start demo

Open
#1,890 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
4.7k
Forks
536
Avg merge
12h 12m
Merged PRs (30d)
4

Description

I did it as link https://opennmt.net/CTranslate2/quickstart.html

c++ code as below:

`int main()
{
//system("chcp 850");

const std::string model_path("D:\\code\\CTranslate2\\models\\opus-mt-en-de\\");
const ctranslate2::models::ModelLoader model_loader(model_path);

ctranslate2::Translator translator(model_loader);

const std::vector<std::vector<std::string>> batch = { {"▁Hello", "▁World", "!", "</s>"} };
const auto translation = translator.translate_batch(batch);

for (const auto& token : translation[0].output())
    std::cout << token << ' ';
std::cout << std::endl;

return 0;

}`

but the output is:

鈻? 鈻丯ein , 鈻乶ein .

instead of '▁Hall o ▁Welt !' that in document.

my model is generated from following command:

huggingface-cli download --resume-download --local-dir-use-symlinks False Helsinki-NLP/opus-mt-en-de
cd D:\code\CTranslate2\models
ct2-transformers-converter --model Helsinki-NLP/opus-mt-en-de --quantization int8 --output_dir opus-mt-en-de

I need help.
sorry for my poor English.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C++ quick-start snippet and the Hugging Face download and ct2-transformers-converter commands shown in the issue. Compare the generated model's translation output with the quick-start expectation, including the displayed token encoding. Done means the same model and C++ example produce the documented output or the cause of the discrepancy is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.