Open ToBeIronMan opened 4 years ago
pytorch训练的模型直接用pytoch加载不更好吗
应该在human_play.py中把 best_policy = PolicyValueNetNumpy(width, height, policy_param)改为 best_policy = PolicyValueNet(width, height, policy_param) 同时最上面解除 from policy_value_net_pytorch import PolicyValueNet # Pytorch 的注释
还要把human_play.py中的 best_policy = PolicyValueNet(width, height, policy_param) 改为 best_policy = PolicyValueNet(width, height, model_file) 也就是说不需要使用pickle
Traceback (most recent call last): File "human_play.py", line 88, in
run()
File "human_play.py", line 81, in run
game.start_play(human, mcts_player, start_player=0, is_shown=1)
File "C:\Users\lucky\Desktop\AlphaZero_Gomoku-master\AlphaZero_Gomoku-master\game.py", line 177, in start_play
move = player_in_turn.get_action(self.board)
File "C:\Users\lucky\Desktop\AlphaZero_Gomoku-master\AlphaZero_Gomoku-master\mcts_alphaZero.py", line 190, in get_action
acts, probs = self.mcts.get_move_probs(board, temp)
File "C:\Users\lucky\Desktop\AlphaZero_Gomoku-master\AlphaZero_Gomoku-master\mcts_alphaZero.py", line 147, in get_move_probs
self._playout(state_copy)
File "C:\Users\lucky\Desktop\AlphaZero_Gomoku-master\AlphaZero_Gomoku-master\mcts_alphaZero.py", line 122, in _playout
action_probs, leaf_value = self._policy(state)
File "C:\Users\lucky\Desktop\AlphaZero_Gomoku-master\AlphaZero_Gomoku-master\policy_value_net_numpy.py", line 104, in policy_value_fn
X = relu(conv_forward(X, self.params[i], self.params[i+1]))
TypeError: 'int' object is not subscriptable