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

大佬,你好,我在用pytorch训练出来的模型,无法加载运行,报了如下错误 #97

Open
ToBeIronMan opened this issue Feb 28, 2020 · 3 comments

Comments

@ToBeIronMan
Copy link

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

@syys96
Copy link

syys96 commented Apr 17, 2020

pytorch训练的模型直接用pytoch加载不更好吗

@yaohaizhou
Copy link

应该在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
的注释

@yaohaizhou
Copy link

还要把human_play.py中的
best_policy = PolicyValueNet(width, height, policy_param)
改为
best_policy = PolicyValueNet(width, height, model_file)
也就是说不需要使用pickle

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

3 participants