Error when converting model into CTranslate2


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:

2022-10-26 10:15:25.939000: I] 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/] Loaded cuDNN version 8100

File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\”, line 89, in convert
model_spec = self._load()
File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\”, line 83, in _load
model_spec = _get_model_spec_from_model(self._model)
File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\”, line 205, in _get_model_spec_from_model
File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\”, line 29, in validate
File “D:\Virtualenv\tf26gpu\lib\site-packages\ctranslate2\converters\”, 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?

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.