cogitontnu / alphazero Goto Github PK
View Code? Open in Web Editor NEWAn implementation of AlphaZero, trained to master Tic-Tac-Toe and Four in a row
License: MIT License
An implementation of AlphaZero, trained to master Tic-Tac-Toe and Four in a row
License: MIT License
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'
C:\AZ\AlphaZero-CogitoNTNU>python Multiprocessing.py
Traceback (most recent call last):
File "Multiprocessing.py", line 134, in
train(Config, 3000, 8, 500, 600, Config.name)
File "Multiprocessing.py", line 115, in train
x, y_pol, y_val = multiprocess_function(config, num_processes, num_games_each_process, num_search,
File "Multiprocessing.py", line 44, in multiprocess_function
worker.start()
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 326, in _Popen
return Popen(process_obj)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\multiprocessing\popen_spawn_win32.py", line 93, in init reduction.dump(process_obj, to_child)
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle 'module' object
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.