Exemple #1
0
    def test_alpha_zero_compilation(self):
        """Test whether AlphaZero can be built with all frameworks."""
        config = (az.AlphaZeroConfig().environment(
            env=CartPoleSparseRewards).training(
                model={"custom_model": DenseModel}))
        num_iterations = 1

        # Only working for torch right now.
        for _ in framework_iterator(config, frameworks="torch"):
            trainer = config.build()
            for i in range(num_iterations):
                results = trainer.train()
                check_train_results(results)
                print(results)
Exemple #2
0
def _import_alpha_zero():
    import ray.rllib.algorithms.alpha_zero as alpha_zero

    return alpha_zero.AlphaZero, alpha_zero.AlphaZeroConfig().to_dict()