Evaluators¶
-
class
AlphaZero.evaluator.nn_eval_parallel.
NNEvaluator
(cluster, game_config, ext_config)¶ Provide neural network evaluation services for model evaluator and data generator. Instances should be created by the main evaluator/generator thread. Context manager (with statement) is preferred because of the automatic start and termination of the listening thread.
Example
- with NNEvaluator(…) as eval:
- pass
Parameters: - cluster – Tensorflow cluster spec
- game_config – A dictionary of game environment configuration
- ext_config – A dictionary of system configuration
-
eval
(state)¶ This function is called by mcts threads.
Parameters: state – GameState Returns: (policy, value) pair Return type: Tuple
-
sl_listen
()¶ The listener for saving and loading the network parameters. This is run in new thread instead of process.
-
load
(filename)¶ Send the load request.
Parameters: filename – the filename of the checkpoint
-
save
(filename)¶ Send the save request.
Parameters: filename – the filename of the checkpoint
-
listen
()¶ The listener for collecting the computation requests and performing neural network evaluation.