MarianConverter
- class ctranslate2.converters.MarianConverter
Converts models trained with Marian.
Inherits from:
ctranslate2.converters.Converter
Extended by:
Methods:
- __init__(model_path: str, vocab_paths: List[str])
Initializes the Marian converter.
- Parameters
model_path – Path to the Marian model (.npz file).
vocab_paths – Paths to the vocabularies (.yml files).
- convert(output_dir: str, vmap: Optional[str] = None, quantization: Optional[str] = None, force: bool = False) str
Converts the model to the CTranslate2 format.
- Parameters
output_dir – Output directory where the CTranslate2 model is saved.
vmap – Optional path to a vocabulary mapping file that will be included in the converted model directory.
quantization – Weight quantization scheme (possible values are: int8, int8_float32, int8_float16, int8_bfloat16, int16, float16, bfloat16, float32).
force – Override the output directory if it already exists.
- Returns
Path to the output directory.
- Raises
RuntimeError – If the output directory already exists and
force
is not set.NotImplementedError – If the converter cannot convert this model to the CTranslate2 format.
- convert_from_args(args: Namespace) str
Helper function to call
ctranslate2.converters.Converter.convert()
with the parsed command line options.- Parameters
args – Namespace containing parsed arguments.
- Returns
Path to the output directory.
- static declare_arguments(parser: ArgumentParser) ArgumentParser
Adds common conversion options to the command line parser.
- Parameters
parser – Command line argument parser.