OpenNMT Forum

AttributeError: module 'opennmt.models.catalog' has no attribute 'NMTSmall'

I’ve followed OpenNMT-tf tutorial on this site

until ‘make data.yml’ process.

then I followed script on COLAB, because I would like to know
how do this code ,tf.estimator.train_and_evaluate, work.

from __future__ import print_function
import tensorflow as tf
from opennmt.runner import Runner
from opennmt.config import load_model
from opennmt.config import load_config

config = load_config(['/content/OpenNMT_COLAB_Practice/Data.yml'])

model = load_model(config["model_dir"],
                   model_name= 'NMTSmall',

then I got this message

AttributeError                            Traceback (most recent call last)

<ipython-input-68-5bbae122e853> in <module>()
      9 model = load_model(config["model_dir"],
     10                    model_file=None,
---> 11                    model_name= 'NMTSmall')

1 frames

/usr/local/lib/python3.6/dist-packages/opennmt/ in load_model_from_catalog(name)
     56     A :class:`opennmt.models.Model` instance.
     57   """
---> 58   return getattr(catalog, name)()
     60 def load_model(model_dir,

AttributeError: module 'opennmt.models.catalog' has no attribute 'NMTSmall'

I can’t understand why I got AttributeError, because ‘NMTSmall’ model is in the ‘’
and I don’t know how to fix it

This is not an official OpenNMT-tf tutorial, so you should raise the issue in the tutorial repository.

Here’s the fix though: