Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiprocessing.py is an unfinished module? #18

Open
Vovak1919 opened this issue Feb 15, 2021 · 0 comments
Open

Multiprocessing.py is an unfinished module? #18

Vovak1919 opened this issue Feb 15, 2021 · 0 comments

Comments

@Vovak1919
Copy link

Vovak1919 commented Feb 15, 2021

Multiprocessing creates processes with the Train.py module, which has a get_tree procedure. It tries to create the MCTS.MCTS class, but the parameters of the call do not coincide with the MCTS.py file, but it does coincide with the MCTSTraining.py file, where the tree creation algorithm is different.

This is what get_tree looks like from Main.py:

# Creating and returning a tree with properties specified from the input
def get_tree(config, agent, game, dirichlet_noise=True):
    tree = MCTS.MCTS(game, game.get_board(), agent, config)
    return tree

And like this from Train.py:

# Creating and returning a tree with properties specified from the input
def get_tree(config, agent, game, dirichlet_noise=True, seed=0):
    tree = MCTS.MCTS()  # (game, game.get_board(), None, config)
    tree.dirichlet_noise = dirichlet_noise
    tree.NN_input_dim = config.board_dims
    tree.policy_output_dim = config.policy_output_dim
    tree.NN_output_to_moves_func = config.NN_output_to_moves
    tree.move_to_number_func = config.move_to_number
    tree.number_to_move_func = config.number_to_move
    tree.set_evaluation(agent)
    tree.set_game(game)
    # print("setting seed", seed)
    tree.set_seed(seed)
    return tree

This results in the following error:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 315, in _bootstrap
self.run()
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "c:\AZ\AlphaZero-CogitoNTNU\Train.py", line 225, in generate_data2
game_generators = [GameGenerator(config1, agent, seed=seeds[i]) for i in range(num_games_each_process)]
File "c:\AZ\AlphaZero-CogitoNTNU\Train.py", line 225, in
game_generators = [GameGenerator(config1, agent, seed=seeds[i]) for i in range(num_games_each_process)]
File "c:\AZ\AlphaZero-CogitoNTNU\Train.py", line 42, in init
self.tree = get_tree(config, agent, self.game, seed=seed)
File "c:\AZ\AlphaZero-CogitoNTNU\Train.py", line 21, in get_tree
tree = MCTS.MCTS() # (game, game.get_board(), None, config)
TypeError: init() missing 4 required positional arguments: 'game', 'start_state', 'agent', and 'Config'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant