d63abb86304d5ceca8ec14109a4812258f9839ea,scripts/bert/finetune_classifier.py,,evaluate,#Any#Any#Any#,544

Before Change


    tic = time.time()
    for batch_id, seqs in enumerate(loader_dev):
        input_ids, valid_len, type_ids, label = seqs
        out = model(
            input_ids.as_in_context(ctx), type_ids.as_in_context(ctx),
            valid_len.astype("float32").as_in_context(ctx))
        ls = loss_function(out, label.as_in_context(ctx)).mean()

        step_loss += ls.asscalar()
        metric.update([label], [out])

After Change


    for batch_id, seqs in enumerate(loader_dev):
        input_ids, valid_length, segment_ids, label = seqs
        input_ids = input_ids.as_in_context(ctx)
        valid_length = valid_length.as_in_context(ctx).astype("float32")
        label = label.as_in_context(ctx)
        if use_roberta:
            out = model(input_ids, valid_length)
        else:
            out = model(input_ids, segment_ids.as_in_context(ctx), valid_length)
        ls = loss_function(out, label).mean()

        step_loss += ls.asscalar()
        metric.update([label], [out])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: dmlc/gluon-nlp
Commit Name: d63abb86304d5ceca8ec14109a4812258f9839ea
Time: 2019-09-24
Author: linhaibin.eric@gmail.com
File Name: scripts/bert/finetune_classifier.py
Class Name:
Method Name: evaluate


Project Name: dmlc/dgl
Commit Name: 708765f0a11d29b3d3f27857aeebfd10498f1937
Time: 2019-08-23
Author: wmjlyjemaine@gmail.com
File Name: examples/mxnet/rgcn/entity_classify.py
Class Name:
Method Name: main


Project Name: dmlc/gluon-nlp
Commit Name: d63abb86304d5ceca8ec14109a4812258f9839ea
Time: 2019-09-24
Author: linhaibin.eric@gmail.com
File Name: scripts/bert/finetune_classifier.py
Class Name:
Method Name: test