Example #1
0
def legacy_transformer_model_description_dynamic_axes(ntokens=28785):
    input_desc = Legacy_IODescription('input1', ['bptt', 'batch_size'])
    label_desc = Legacy_IODescription('label', ['bptt_x_batch_size'])
    loss_desc = Legacy_IODescription('loss', [])
    predictions_desc = Legacy_IODescription('predictions',
                                            ['bptt', 'batch_size', ntokens])
    return Legacy_ModelDescription([input_desc, label_desc],[loss_desc, predictions_desc]),\
           Legacy_IODescription('__learning_rate', [1])
Example #2
0
def legacy_transformer_model_description(bptt=35,
                                         batch_size=20,
                                         ntokens=28785):
    input_desc = Legacy_IODescription('input1', [bptt, batch_size])
    label_desc = Legacy_IODescription('label', [bptt * batch_size])
    loss_desc = Legacy_IODescription('loss', [])
    predictions_desc = Legacy_IODescription('predictions',
                                            [bptt, batch_size, ntokens])
    return Legacy_ModelDescription([input_desc, label_desc],[loss_desc, predictions_desc]),\
           Legacy_IODescription('__learning_rate', [1])
Example #3
0
def legacy_transformer_model_description_dynamic_axes(ntokens=28785):
    input_desc = Legacy_IODescription("input1", ["bptt", "batch_size"])
    label_desc = Legacy_IODescription("label", ["bptt_x_batch_size"])
    loss_desc = Legacy_IODescription("loss", [])
    predictions_desc = Legacy_IODescription("predictions",
                                            ["bptt", "batch_size", ntokens])
    return (
        Legacy_ModelDescription([input_desc, label_desc],
                                [loss_desc, predictions_desc]),
        Legacy_IODescription("__learning_rate", [1]),
    )
Example #4
0
def legacy_transformer_model_description(bptt=35,
                                         batch_size=20,
                                         ntokens=28785):
    input_desc = Legacy_IODescription("input1", [bptt, batch_size])
    label_desc = Legacy_IODescription("label", [bptt * batch_size])
    loss_desc = Legacy_IODescription("loss", [])
    predictions_desc = Legacy_IODescription("predictions",
                                            [bptt, batch_size, ntokens])
    return (
        Legacy_ModelDescription([input_desc, label_desc],
                                [loss_desc, predictions_desc]),
        Legacy_IODescription("__learning_rate", [1]),
    )
def legacy_ort_trainer_learning_rate_description():
    return Legacy_IODescription(
        "Learning_Rate",
        [
            1,
        ],
        torch.float32,
    )
def legacy_bert_model_description():
    vocab_size = 30528
    input_ids_desc = Legacy_IODescription('input_ids', ['batch', 'max_seq_len_in_batch'])
    segment_ids_desc = Legacy_IODescription('segment_ids', ['batch', 'max_seq_len_in_batch'])
    input_mask_desc = Legacy_IODescription('input_mask', ['batch', 'max_seq_len_in_batch'])
    masked_lm_labels_desc = Legacy_IODescription('masked_lm_labels', ['batch', 'max_seq_len_in_batch'])
    next_sentence_labels_desc = Legacy_IODescription('next_sentence_labels', ['batch', ])
    loss_desc = Legacy_IODescription('loss', [])

    return Legacy_ModelDescription([input_ids_desc, segment_ids_desc, input_mask_desc, masked_lm_labels_desc,
                             next_sentence_labels_desc], [loss_desc])
def legacy_bert_model_description():
    vocab_size = 30528
    input_ids_desc = Legacy_IODescription("input_ids", ["batch", "max_seq_len_in_batch"])
    segment_ids_desc = Legacy_IODescription("segment_ids", ["batch", "max_seq_len_in_batch"])
    input_mask_desc = Legacy_IODescription("input_mask", ["batch", "max_seq_len_in_batch"])
    masked_lm_labels_desc = Legacy_IODescription("masked_lm_labels", ["batch", "max_seq_len_in_batch"])
    next_sentence_labels_desc = Legacy_IODescription(
        "next_sentence_labels",
        [
            "batch",
        ],
    )
    loss_desc = Legacy_IODescription("loss", [])

    return Legacy_ModelDescription(
        [input_ids_desc, segment_ids_desc, input_mask_desc, masked_lm_labels_desc, next_sentence_labels_desc],
        [loss_desc],
    )