Cannot initialize Translator class object

Hi all,

I’m trying to initialize a Translator class object.

onmt.translate.Translator(model, fields, src_reader, tgt_reader)

I cannot figure out how to correctly define the fields dictionary.

Additionally I’ve seen that there exists a build_translator function within the onmt.translate.translator.py file, is that an alternative method of building a translator object? and if so what does the opt argument refer to?

Cheers

Adam

Basically, opt is the arparse Namespace regrouping all the parameters of the run.
The process of using some of the APIs ‘from scratch’ is not very straightforward, but should be doable.
You can refer to the ‘Library’ example in the docs for details about using the API: