yusuketomoto / chainer-char-rnn

karpathy's char-rnn (https://github.com/karpathy/char-rnn) implementation by Chainer
MIT License
167 stars 62 forks source link

int64 != <type 'numpy.int32'> on sample #4

Closed genekogan closed 9 years ago

genekogan commented 9 years ago

training works great, but I am getting this traceback on running the sampling script.

python sample.py --vocabulary vocab.bin --model charrnn_epoch_49.76.chainermodel --primetext hello /Library/Python/2.7/site-packages/scikit_cuda-0.5.0-py2.7.egg/skcuda/cublas.py:273: UserWarning: creating CUBLAS context to get version number warnings.warn('creating CUBLAS context to get version number') romeouTraceback (most recent call last): File "sample.py", line 62, in state, prob = model.predict(prev_char, state) File "/Users/gene/Code/Python/text-learning/chainer-char-rnn/CharRNN.py", line 36, in predict h0 = self.embed(x) File "/Library/Python/2.7/site-packages/chainer/function.py", line 137, in call self._check_data_type_forward(in_data) File "/Library/Python/2.7/site-packages/chainer/function.py", line 191, in _check_data_type_forward self.check_type_forward(in_type) File "/Library/Python/2.7/site-packages/chainer/functions/embed_id.py", line 42, in check_type_forward x_type.ndim == 1, File "/Library/Python/2.7/site-packages/chainer/utils/type_check.py", line 457, in expect expr.expect() File "/Library/Python/2.7/site-packages/chainer/utils/type_check.py", line 428, in expect '{0} {1} {2}'.format(left, self.inv, right)) chainer.utils.type_check.InvalidType: Expect: in_types[0].dtype == <type 'numpy.int32'> Actual: int64 != <type 'numpy.int32'>

yusuketomoto commented 9 years ago

It seems to be the same issue https://github.com/yusuketomoto/chainer-char-rnn/issues/2

I'm wondering if you tried on the latest commit. https://github.com/yusuketomoto/chainer-char-rnn/commit/e9884226ccf04de87829f60a202a273455f93b6b

genekogan commented 9 years ago

yes, latest commit fixed it, thanks!