Closed KaqiKaqi closed 6 years ago
你好:
你将mask = 1 + (-1) * mask
改为mask = (1 - mask.long()).byte()
试试。
祝好
On Tue, Mar 13, 2018 at 9:27 AM, KaqiKaqi notifications@github.com wrote:
Traceback (most recent call last): File "../test.py", line 77, in targets_list = sl_model.predict(sample_batched) File "/xunku/SLTK-master/TorchNN/layers/bilstm_crf.py", line 106, in predict path_score, best_paths = self.crf(lstm_feats, mask) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, *kwargs) File "/xunku/SLTK-master/TorchNN/layers/crf.py", line 182, in forward path_score, best_path = self._viterbi_decode(feats, mask) File "/xunku/SLTK-master/TorchNN/layers/crf.py", line 130, in _viterbi_decode mask = 1 + (-1) mask RuntimeError: value cannot be converted to type uint8_t without overflow: -1
不知道这是怎么回事?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/liu-nlper/SLTK/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/ASWWim_6M6AIbXO69y-lpGlBzNGLxcUDks5tdyCFgaJpZM4Sn8Oa .
还是不行,报了另外一个错
Traceback (most recent call last):
File "../test.py", line 77, in
我知道原因了。
line 134 partition_history.append(partition)
加进去的 partition 的 rank 是3,最后一维的 dim 是1
line 140 加进去的 partition 的 rank 是2。也就是说 partition, cur_bp = torch.max(cur_values, 1)
产生的 partition 的 rank 是2.
我的torch 是0.3.0, 不知道和版本有关系没有。
Traceback (most recent call last): File "../test.py", line 77, in
targets_list = sl_model.predict(sample_batched)
File "/xunku/SLTK-master/TorchNN/layers/bilstm_crf.py", line 106, in predict
path_score, best_paths = self.crf(lstm_feats, mask)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call
result = self.forward(*input, *kwargs)
File "/xunku/SLTK-master/TorchNN/layers/crf.py", line 182, in forward
path_score, best_path = self._viterbi_decode(feats, mask)
File "/xunku/SLTK-master/TorchNN/layers/crf.py", line 130, in _viterbi_decode
mask = 1 + (-1) mask
RuntimeError: value cannot be converted to type uint8_t without overflow: -1
不知道这是怎么回事?