How to use the ctranslate2.converters function in ctranslate2

To help you get started, we’ve selected a few ctranslate2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenNMT / CTranslate2 / python / ctranslate2 / bin / opennmt_tf_converter.py View on Github external
def main():
    parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("--model_path", required=True,
                        help="Model path (a checkpoint, a checkpoint directory, or a SavedModel).")
    parser.add_argument("--src_vocab", default=None,
                        help="Source vocabulary file (required if converting a checkpoint).")
    parser.add_argument("--tgt_vocab", default=None,
                        help="Target vocabulary file (required if converting a checkpoint).")
    converters.Converter.declare_arguments(parser)
    args = parser.parse_args()
    converters.OpenNMTTFConverter(
        args.model_path,
        src_vocab=args.src_vocab,
        tgt_vocab=args.tgt_vocab).convert_from_args(args)