Error when converting model into CTranslate2

Hi,

I have trained a Chinese-Korean TransformerBig model and averaged checkpoints. I can translate texts correctly with the averaged checkpoint. However, when I converted the averaged checkpoint into CTranslate2 format, the following error occurred:

Blockquote
2022-10-26 10:15:25.939000: I runner.py:456] Restored checkpoint D:\kidden\mt\mt-exp\zh-ko\opus\run1\model\avg\ckpt-21600
2022-10-26 10:15:26.799464: I tensorflow/stream_executor/cuda/cuda_dnn.cc:369] Loaded cuDNN version 8100

File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\converter.py”, line 89, in convert
model_spec = self._load()
File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\opennmt_tf.py”, line 83, in _load
model_spec = _get_model_spec_from_model(self._model)
File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\opennmt_tf.py”, line 205, in _get_model_spec_from_model
check.validate()
File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\utils.py”, line 29, in validate
raise_unsupported(self._unsupported_reasons)
File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\utils.py”, line 16, in raise_unsupported
raise ValueError(message)
ValueError: The model you are trying to convert is not supported by CTranslate2. We identified the following reasons:
- Only Transformer models are supported

I am using OpenNMT-tf 2.26.1 and ctranslate2 2.17.0. With the same environment, I have converted other checkpoints into CTranslate2 format correctly.

I don’t know the reason. Who can help me?
Thanks!

I have found the reason.

I modified OpenNMT-tf, created a new project based on it and changed the package names, so CTranslate 2 cannot recognize them.

In CTranslate2, before conversion it check many things including a number of types, which contain package information, such as openmt.models.Transformer.

I hope this is helpful for you.