Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

swig api中DataConverter处理integer_value_sub_sequence出错

Open pengli09 opened this issue 9 years ago • 3 comments

paddle/py_paddle/dataprovider_converter.py在处理integer_value_sub_sequence型的数据时会出错。原因是integer_value_sub_sequence与其他类型的sub_sequence格式不同,前者形如[[], [], []],后者形如[[[],[]], [[],[]]],从而导致内层的SequenceScaner出错。

pengli09 avatar Mar 17 '17 07:03 pengli09

具体报错的表现是什么呢?之前写code引入了一个bug,related issue是 #1703,不知道是不是类似的问题?

reyoung avatar Apr 17 '17 08:04 reyoung

log如下:

I0417 17:19:48.828279  6406 Util.cpp:160] commandline:  --use_gpu=0
[WARNING 2017-04-17 17:19:48,866 layers.py:1360] You are getting the first instance for a time series, and it is a normal recurrent layer output. There is no time series information at all. Maybe you want to use last_seq instead.
[WARNING 2017-04-17 17:19:48,878 networks.py:1444] `outputs` routine try to calculate network's inputs and outputs order. It might not work well.Please see follow log carefully.
[INFO 2017-04-17 17:19:48,878 networks.py:1472] The input order is [sent]
[INFO 2017-04-17 17:19:48,878 networks.py:1478] The output order is [states, fc2, __maxid_layer_0__]
I0417 17:19:48.953286  6406 GradientMachine.cpp:75] Loading parameters from ./model.177.vcb30k.k100.run1/models/pass-00021
{'sent': [[24, 13, 6, 3, 25, 17, 93, 54, 79, 245, 203, 2308, 129, 68, 64, 54, 38, 140], [133, 79, 107, 7021, 525, 10, 260, 787, 680, 6826, 41, 2263, 10], [7116], [72, 611, 74, 717, 364, 54], [62, 1544, 357, 504, 10], [362, 37, 197, 60, 121, 357, 178, 460]]}
Traceback (most recent call last):
  File "./predictor.py", line 93, in <module>
    predictor.predict(sys.stdin, callback)
  File "./predictor.py", line 71, in predict
    in_arg = self.converter([data['sent']])
  File "/PATH/lib/python2.7/site-packages/py_paddle/dataprovider_converter.py", line 175, in __call__
    return self.convert(dat, argument)
  File "/PATH/lib/python2.7/site-packages/py_paddle/dataprovider_converter.py", line 167, in convert
    scanner.scan(each_step)
  File "/PATH/lib/python2.7/site-packages/py_paddle/dataprovider_converter.py", line 131, in scan
    self.__seq__.append(self.__seq__[-1] + self.get_size(dat))
  File "/PATH/lib/python2.7/site-packages/py_paddle/dataprovider_converter.py", line 142, in get_size
    return sum(self.__inner_scanner__.get_size(item) for item in dat)
  File "/PATH/lib/python2.7/site-packages/py_paddle/dataprovider_converter.py", line 142, in <genexpr>
    return sum(self.__inner_scanner__.get_size(item) for item in dat)
  File "/PATH/lib/python2.7/site-packages/py_paddle/dataprovider_converter.py", line 144, in get_size
    return len(dat)
TypeError: object of type 'int' has no len()

pengli09 avatar Apr 17 '17 09:04 pengli09

由于长时间没有信息更新,我先close掉此issue。如果有进一步的信息,可以reopen后继续交流。

lcy-seso avatar Oct 23 '17 10:10 lcy-seso