# Model¶

OpenNMT-tf can be used to train several types of models, here is a non exhaustive overview of supported models:

Maching translation

Speech recognition

Language modeling

Sequence tagging

and most ideas and modules coming from these papers can be reused for other models or tasks.

## Catalog¶

OpenNMT-tf comes with a set of standard models that are defined in the catalog. These models can be directly selected with the --model_type command line option, e.g.:

onmt-main train --model_type Transformer [...]


## Custom models¶

Models are defined from Python code to allow a high level of modeling freedom. They are opennmt.models.Model instances that use available or user-defined modules. Some of these modules are defined to contain other modules and can be used to design complex architectures:

• opennmt.encoders.ParallelEncoder
• opennmt.encoders.SequentialEncoder
• opennmt.inputters.MixedInputter
• opennmt.inputters.ParallelInputter

For example, these container modules can be used to implement multi source inputs, multi modal training, mixed word/character embeddings, and arbitrarily complex encoder architectures (e.g. mixing convolution, RNN, self-attention, etc.).

Some examples are available in the directory config/models in the Git repository. The custom model file should be selected with the --model command line option, e.g.:

onmt-main train --model config/models/custom_model.py [...]