Ejemplo n.º 1
0
def add_model_args(parser):
    group = parser.add_argument_group('Model configuration')

    # Model definitions can be found under fairseq/models/
    #
    # The model architecture can be specified in several ways.
    # In increasing order of priority:
    # 1) model defaults (lowest priority)
    # 2) --arch argument
    # 3) --encoder/decoder-* arguments (highest priority)
    group.add_argument(
        '--arch', '-a', default='fconv', metavar='ARCH', required=True,
        choices=ARCH_MODEL_REGISTRY.keys(),
        help='model architecture: {} (default: fconv)'.format(
            ', '.join(ARCH_MODEL_REGISTRY.keys())),
    )

    # Criterion definitions can be found under fairseq/criterions/
    group.add_argument(
        '--criterion', default='cross_entropy', metavar='CRIT',
        choices=CRITERION_REGISTRY.keys(),
        help='training criterion: {} (default: cross_entropy)'.format(
            ', '.join(CRITERION_REGISTRY.keys())),
    )

    return group
Ejemplo n.º 2
0
def add_model_args(parser):
    group = parser.add_argument_group('Model configuration')
    # fmt: off

    # Model definitions can be found under fairseq/models/
    #
    # The model architecture can be specified in several ways.
    # In increasing order of priority:
    # 1) model defaults (lowest priority)
    # 2) --arch argument
    # 3) --encoder/decoder-* arguments (highest priority)
    from fairseq.models import ARCH_MODEL_REGISTRY
    group.add_argument('--arch', '-a', default='fconv', metavar='ARCH', required=True,
                       choices=ARCH_MODEL_REGISTRY.keys(),
                       help='Model Architecture')
    # fmt: on

    group.add_argument('--init-type', default='default', type=str, choices=['adaptive', 'adaptive-profiling', \
        'default', 'looklinear', 'rezero', 'rezero_postln']) 

    group.add_argument('--plot_variance', action='store_true')
    group.add_argument('--plot_gradient', action='store_true')
    group.add_argument('--plot_stability', action='store_true')
    group.add_argument('--gradient_as_delta', action='store_true')
    group.add_argument('--mixed_precision', action='store_true')
    
    return group
Ejemplo n.º 3
0
def add_model_args(parser):
    group = parser.add_argument_group("Model configuration")
    # fmt: off

    # Model definitions can be found under fairseq/models/
    #
    # The model architecture can be specified in several ways.
    # In increasing order of priority:
    # 1) model defaults (lowest priority)
    # 2) --arch argument
    # 3) --encoder/decoder-* arguments (highest priority)
    group.add_argument(
        '--ngrams',
        default=5,
        type=int,
        metavar='N',
        help='read this many sentences into a buffer before processing them')
    from fairseq.models import ARCH_MODEL_REGISTRY
    group.add_argument('--arch',
                       '-a',
                       default='fconv',
                       metavar='ARCH',
                       choices=ARCH_MODEL_REGISTRY.keys(),
                       help='Model Architecture')
    # fmt: on
    return group
Ejemplo n.º 4
0
def add_model_args(parser):
    group = parser.add_argument_group("Model configuration")
    # fmt: off

    # Model definitions can be found under fairseq/models/
    #
    # The model architecture can be specified in several ways.
    # In increasing order of priority:
    # 1) model defaults (lowest priority)
    # 2) --arch argument
    # 3) --encoder/decoder-* arguments (highest priority)
    from fairseq.models import ARCH_MODEL_REGISTRY
    group.add_argument('--arch',
                       '-a',
                       metavar='ARCH',
                       choices=ARCH_MODEL_REGISTRY.keys(),
                       help='model architecture')
    group.add_argument('--z-size',
                       default=64,
                       type=int,
                       help='latent hidden size for cvae')
    group.add_argument('--init-w',
                       default=0.02,
                       type=float,
                       help='init weight for the Variation')
    # fmt: on
    return group
Ejemplo n.º 5
0
def add_model_args(parser):
    group = parser.add_argument_group("Model configuration")
    # fmt: off

    # Model definitions can be found under fairseq/models/
    #
    # The model architecture can be specified in several ways.
    # In increasing order of priority:
    # 1) model defaults (lowest priority)
    # 2) --arch argument
    # 3) --encoder/decoder-* arguments (highest priority)
    from fairseq.models import ARCH_MODEL_REGISTRY
    group.add_argument('--arch',
                       '-a',
                       default='fconv',
                       metavar='ARCH',
                       choices=ARCH_MODEL_REGISTRY.keys(),
                       help='Model Architecture')

    # Some of the algorithm-specific options below
    group.add_argument(
        '--use-is-obj',
        type=int,
        default=1,
        choices=[0, 1],
        help='use importance sampling objective')  # set to 0 for mle
    group.add_argument('--load-path-mle', type=str, default=None)
    group.add_argument(
        '--q-baseline',
        type=float,
        default=-10.0,
        help='subtracted baseline for q function')  # per-step b in Algo 1
    group.add_argument('--reward-type',
                       type=str,
                       default='logp',
                       choices=['sump',
                                'logp'])  # logp is GOLD-p; sump is GOLD-s
    group.add_argument('--trunc-min', type=float, default=1.0)  # c in Algo 1
    group.add_argument('--iw-min', type=float, default=0.0)  # u in Algo 1
    group.add_argument('--policy-update-per-k-epoch', type=int,
                       default=5000)  # k in Algo 1

    # Below: not used for now; could be helpful for further experiments; ablation studies / more tuning
    group.add_argument('--suffix-num',
                       type=int,
                       default=5,
                       choices=[0, 1, 2, 3, 4, 5],
                       help='number of suffix tokens to consider'
                       )  # not used now; will be useful for ablation/tuning
    group.add_argument(
        '--gamma', type=float, default=1.0, help='discount rate'
    )  # not used now; will be useful for full trajectory returns
    group.add_argument('--p40', type=int, default=0,
                       choices=[0, 1])  # not used now

    # fmt: on
    return group
Ejemplo n.º 6
0
def add_model_args(parser):
    group = parser.add_argument_group('Model configuration')
    # fmt: off

    # Model definitions can be found under fairseq/models/
    #
    # The model architecture can be specified in several ways.
    # In increasing order of priority:
    # 1) model defaults (lowest priority)
    # 2) --arch argument
    # 3) --encoder/decoder-* arguments (highest priority)
    from fairseq.models import ARCH_MODEL_REGISTRY
    group.add_argument('--arch', '-a', default='fconv', metavar='ARCH', required=True,
                       choices=ARCH_MODEL_REGISTRY.keys(),
                       help='Model Architecture')
    # fmt: on
    return group
Ejemplo n.º 7
0
def add_model_args(parser):
    group = parser.add_argument_group('Model configuration')

    # Model definitions can be found under fairseq/models/
    #
    # The model architecture can be specified in several ways.
    # In increasing order of priority:
    # 1) model defaults (lowest priority)
    # 2) --arch argument
    # 3) --encoder/decoder-* arguments (highest priority)
    group.add_argument(
        '--arch', '-a', default='fconv', metavar='ARCH', required=True,
        choices=ARCH_MODEL_REGISTRY.keys(),
        help='Model Architecture',
    )

    # Criterion definitions can be found under fairseq/criterions/
    group.add_argument(
        '--criterion', default='cross_entropy', metavar='CRIT',
        choices=CRITERION_REGISTRY.keys(),
        help='Training Criterion',
    )

    return group