Пример #1
0
    def test_train_ppo(self, mock_train):
        env_config = get_env_config()
        train_config = TrainConfig(experiment_name="experiment_name",
                                   num_workers=4)
        config = get_config(env_config, reward_func=1, use_aft=False)
        with tempfile.NamedTemporaryFile() as env_file:
            env_config.save_file(env_file.name)
            train([
                train_config.experiment_name,
                "--workers",
                str(train_config.num_workers),
                "--model",
                "PPO",
                "--manifest_file",
                env_file.name,
            ])

        mock_train.assert_called_once()
        mock_train.assert_called_with(train_config, config)
Пример #2
0
 def test_train_invalid_website_file(self):
     with pytest.raises(IOError):
         train(["experiment_name", "--manifest_file", "/non/existent/file"])
Пример #3
0
 def test_train_with_resume_and_no_resume(self):
     with pytest.raises(SystemExit):
         train([
             "experiment_name", "--manifest_file", "/tmp/manifest_file",
             "--resume", "--no-resume"
         ])
Пример #4
0
 def test_train_exits_with_invalid_arguments(self):
     with pytest.raises(SystemExit):
         train([])