6805be9179b0dde701296a7ed69feea1b26a3a48,pytorch_translate/utils.py,,load_diverse_ensemble_for_inference,#Any#Any#,81

Before Change


    if task is None:
        if hasattr(checkpoints_data[0]["args"], "mode"):
            checkpoints_data[0]["args"].mode = "eval"
        task = tasks.setup_task(checkpoints_data[0]["args"])
    for checkpoint_data in checkpoints_data:
        model = task.build_model(checkpoint_data["args"])
        model.load_state_dict(checkpoint_data["model"])

After Change


        cfg = get_cfg(checkpoints_data[0], "task")
        if hasattr(cfg, "mode"):
            cfg.mode = "eval"
        task = tasks.setup_task(cfg)
    for checkpoint_data in checkpoints_data:
        cfg = get_cfg(checkpoint_data, "model")
        model = task.build_model(cfg)
        model.load_state_dict(checkpoint_data["model"])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pytorch/translate
Commit Name: 6805be9179b0dde701296a7ed69feea1b26a3a48
Time: 2020-10-20
Author: alexei.b@gmail.com
File Name: pytorch_translate/utils.py
Class Name:
Method Name: load_diverse_ensemble_for_inference


Project Name: pytorch/fairseq
Commit Name: ff68a9ef501e7286501dba1719024dfaaab4b473
Time: 2018-06-15
Author: myleott@fb.com
File Name: eval_lm.py
Class Name:
Method Name: main