pytorch_translate/char_source_hybrid.py [50:119]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        parser.add_argument(
            "--char-embed-dim",
            type=int,
            default=128,
            metavar="N",
            help=("Character embedding dimension."),
        )
        parser.add_argument(
            "--char-cnn-params",
            type=str,
            metavar="EXPR",
            help=("String experission, [(dim, kernel_size), ...]."),
        )
        parser.add_argument(
            "--char-cnn-nonlinear-fn",
            type=str,
            default="tanh",
            metavar="EXPR",
            help=("Nonlinearity applied to char conv outputs. Values: relu, tanh."),
        )
        parser.add_argument(
            "--char-cnn-num-highway-layers",
            type=int,
            default=0,
            metavar="N",
            help=("Char cnn encoder highway layers."),
        )
        parser.add_argument(
            "--char-cnn-output-dim",
            type=int,
            default=-1,
            metavar="N",
            help="Output dim of the CNN layer. If set to -1, this is computed "
            "from char-cnn-params.",
        )
        parser.add_argument(
            "--use-pretrained-weights",
            type=utils.bool_flag,
            nargs="?",
            const=True,
            default=False,
            help="Use pretrained weights for the character model including "
            "the char embeddings, CNN filters, highway networks",
        )
        parser.add_argument(
            "--finetune-pretrained-weights",
            type=utils.bool_flag,
            nargs="?",
            const=True,
            default=False,
            help="Boolean flag to specify whether or not to update the "
            "pretrained weights as part of training",
        )
        parser.add_argument(
            "--pretrained-weights-file",
            type=str,
            default="",
            help=("Weights file for loading pretrained weights"),
        )

    @classmethod
    def build_model(cls, args, task):
        """Build a new model instance."""
        src_dict, dst_dict = task.source_dictionary, task.target_dictionary
        base_architecture(args)

        assert hasattr(args, "char_source_dict_size"), (
            "args.char_source_dict_size required. "
            "should be set by load_binarized_dataset()"
        )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



pytorch_translate/char_source_transformer_model.py [37:106]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        parser.add_argument(
            "--char-embed-dim",
            type=int,
            default=128,
            metavar="N",
            help=("Character embedding dimension."),
        )
        parser.add_argument(
            "--char-cnn-params",
            type=str,
            metavar="EXPR",
            help=("String experission, [(dim, kernel_size), ...]."),
        )
        parser.add_argument(
            "--char-cnn-nonlinear-fn",
            type=str,
            default="tanh",
            metavar="EXPR",
            help=("Nonlinearity applied to char conv outputs. Values: relu, tanh."),
        )
        parser.add_argument(
            "--char-cnn-num-highway-layers",
            type=int,
            default=0,
            metavar="N",
            help=("Char cnn encoder highway layers."),
        )
        parser.add_argument(
            "--char-cnn-output-dim",
            type=int,
            default=-1,
            metavar="N",
            help="Output dim of the CNN layer. If set to -1, this is computed "
            "from char-cnn-params.",
        )
        parser.add_argument(
            "--use-pretrained-weights",
            type=utils.bool_flag,
            nargs="?",
            const=True,
            default=False,
            help="Use pretrained weights for the character model including "
            "the char embeddings, CNN filters, highway networks",
        )
        parser.add_argument(
            "--finetune-pretrained-weights",
            type=utils.bool_flag,
            nargs="?",
            const=True,
            default=False,
            help="Boolean flag to specify whether or not to update the "
            "pretrained weights as part of training",
        )
        parser.add_argument(
            "--pretrained-weights-file",
            type=str,
            default="",
            help=("Weights file for loading pretrained weights"),
        )

    @classmethod
    def build_model(cls, args, task):
        """Build a new model instance."""
        src_dict, dst_dict = task.source_dictionary, task.target_dictionary
        base_architecture(args)

        assert hasattr(args, "char_source_dict_size"), (
            "args.char_source_dict_size required. "
            "should be set by load_binarized_dataset()"
        )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



