3bfbb49ba5a8cba98a34496f81b70248a33664f0,tests/test_train.py,TestLoadCheckpoint,test_load_full_checkpoint,#TestLoadCheckpoint#,99

Before Change


        with contextlib.redirect_stdout(StringIO()):
            trainer, epoch_itr = get_trainer_and_epoch_itr(2, 150, 300, 150)

            with patch("fairseq.checkpoint_utils.reload_train", return_value=epoch_itr):
                checkpoint_utils.load_checkpoint(
                    self.args_mock, trainer, epoch_itr, 512, None)
            itr = epoch_itr.next_epoch_itr(shuffle=False)

            self.assertEqual(epoch_itr.epoch, 3)
            self.assertEqual(epoch_itr.iterations_in_epoch, 0)

After Change


    def test_load_full_checkpoint(self):
        with contextlib.redirect_stdout(StringIO()):
            trainer, epoch_itr = get_trainer_and_epoch_itr(2, 150, 300, 150)
            trainer.get_train_iterator = MagicMock(return_value=epoch_itr)

            _, epoch_itr = checkpoint_utils.load_checkpoint(self.args_mock, trainer)
            itr = epoch_itr.next_epoch_itr(shuffle=False)

            self.assertEqual(epoch_itr.epoch, 3)
            self.assertEqual(epoch_itr.iterations_in_epoch, 0)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 10

Instances


Project Name: pytorch/fairseq
Commit Name: 3bfbb49ba5a8cba98a34496f81b70248a33664f0
Time: 2019-05-16
Author: myleott@fb.com
File Name: tests/test_train.py
Class Name: TestLoadCheckpoint
Method Name: test_load_full_checkpoint


Project Name: elbayadm/attn2d
Commit Name: 3bfbb49ba5a8cba98a34496f81b70248a33664f0
Time: 2019-05-16
Author: myleott@fb.com
File Name: tests/test_train.py
Class Name: TestLoadCheckpoint
Method Name: test_load_full_checkpoint


Project Name: pytorch/fairseq
Commit Name: 3bfbb49ba5a8cba98a34496f81b70248a33664f0
Time: 2019-05-16
Author: myleott@fb.com
File Name: tests/test_train.py
Class Name: TestLoadCheckpoint
Method Name: test_load_partial_checkpoint