5fe8d7b7f5770d82e4f3bfb489a67999d9442ce6,scripts/bert/finetune_classifier.py,,evaluate,#Any#Any#Any#,557

Before Change


            out = model(input_ids, valid_length)
        else:
            out = model(input_ids, segment_ids.as_in_context(ctx), valid_length)
        label_list.append(label.as_in_context(mx.cpu(0)))
        out_list.append(out.as_in_context(mx.cpu(0)))
        ls = loss_function(out, label).mean()

After Change



        ls = loss_function(out, label).mean()
        step_loss += ls.asscalar()
        if not do_regression:
            label = label.reshape((-1))
        metric.update([label], [out])
        if (batch_id + 1) % (args.log_interval) == 0:
            log_eval(batch_id, len(loader_dev), metric, step_loss, args.log_interval)
            step_loss = 0
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: dmlc/gluon-nlp
Commit Name: 5fe8d7b7f5770d82e4f3bfb489a67999d9442ce6
Time: 2020-01-22
Author: 798672141@qq.com
File Name: scripts/bert/finetune_classifier.py
Class Name:
Method Name: evaluate


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


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