376b01c2e338ec63e638f62a76d67f6a9323e47c,code/deep/DeepCoral/DeepCoral.py,,,#,109

Before Change


    if cuda:
        model.cuda()
    model = load_pretrain(model)
    for epoch in range(1, epochs + 1):
        train(epoch, model)
        t_correct = test(model)
        if t_correct > correct:
            correct = t_correct
        print("source: {} to target: {} max correct: {} max accuracy{: .2f}%\n".format(
              source_name, target_name, correct, 100. * correct / len_target_dataset ))

After Change


    source_loader, target_train_loader, target_test_loader = load_data(source_name, target_name, CFG["data_path"])

    model = models.DeepCoral(CFG["n_class"], CFG["backbone"]).to(DEVICE)
    optimizer = torch.optim.SGD([
        {"params": model.sharedNet.parameters()},
        {"params": model.fc.parameters()},
        {"params": model.cls_fc.parameters(), "lr": 10 * CFG["lr"]},
    ], lr=CFG["lr"], momentum=CFG["momentum"], weight_decay=CFG["l2_decay"])

    train(source_loader, target_train_loader, target_test_loader, model, optimizer, CFG)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: jindongwang/transferlearning
Commit Name: 376b01c2e338ec63e638f62a76d67f6a9323e47c
Time: 2019-08-14
Author: jindongwang@outlook.com
File Name: code/deep/DeepCoral/DeepCoral.py
Class Name:
Method Name:


Project Name: pytorch/tutorials
Commit Name: 3128e13109c8766eafb413f2428bba976701e929
Time: 2020-12-02
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: beginner_source/transformer_tutorial.py
Class Name:
Method Name:


Project Name: pyprob/pyprob
Commit Name: 9cf91d62a1705c3837eea652c985fa0e49f8eb24
Time: 2017-04-04
Author: atilimgunes.baydin@gmail.com
File Name: compile.py
Class Name:
Method Name: