Closed coder-free closed 1 year ago
I fixed this bug.
In file MCTS.pyx
line 197, change function _add_root_noise
:
from
cpdef void _add_root_noise(self):
cdef int num_valid_moves = len(self._root._children)
cdef float[:] noise = np.array(np.random.dirichlet(
[NOISE_ALPHA_RATIO / num_valid_moves] * num_valid_moves
), dtype=np.float32)
cdef Node c
cdef float n
for n, c in zip(noise, self._root._children):
c.p = c.p * (1 - self.root_noise_frac) + self.root_noise_frac * n
change to:
cpdef void _add_root_noise(self):
cdef int num_valid_moves = len(self._root._children)
cdef double[:] noise = np.array(np.random.dirichlet(
[NOISE_ALPHA_RATIO / num_valid_moves] * num_valid_moves
))
cdef Node c
cdef double n
cdef float nf
for n, c in zip(noise, self._root._children):
nf = <float>n
c.p = c.p * (1 - self.root_noise_frac) + self.root_noise_frac * nf
I'm training gobang (10x10 board with 5 connect), I got this error:
The train is not interrupt. But I don't know what will happened. I training it with python 3.8