Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

报一个小bug,用num_fakes做切片时没有取整。 #75

Closed
131250208 opened this issue Apr 13, 2020 · 1 comment
Closed

报一个小bug,用num_fakes做切片时没有取整。 #75

131250208 opened this issue Apr 13, 2020 · 1 comment

Comments

@131250208
Copy link

报错信息:

TypeError                                 Traceback (most recent call last)
<ipython-input-7-039e026fb8a7> in <module>
     30 # step 8: predict
     31 print('predicting..')
---> 32 results = trainer.predict(print_steps=print_steps)

~/anaconda3/envs/paddle/lib/python3.6/site-packages/paddlepalm/trainer.py in predict(self, output_dir, print_steps)
    645         cur_predict_step = 0
    646         for feed in iterator:
--> 647             rt_outputs = self.predict_one_batch(feed)
    648             # rt_outputs = {k[len(self.name+'.'):]: v for k,v in rt_outputs.items() if k.startswith(self.name+'.')}
    649             self._pred_head.batch_postprocess(rt_outputs)

~/anaconda3/envs/paddle/lib/python3.6/site-packages/paddlepalm/trainer.py in predict_one_batch(self, batch)
    752             num_fakes = decode_fake(len(rt_outputs[0]), mask, self._predict_batch_size)
    753             if num_fakes:
--> 754                 rt_outputs = [i[:-num_fakes] for i in rt_outputs]
    755         else:
    756             feed = self._pred_feed_batch_process_fn(batch)

~/anaconda3/envs/paddle/lib/python3.6/site-packages/paddlepalm/trainer.py in <listcomp>(.0)
    752             num_fakes = decode_fake(len(rt_outputs[0]), mask, self._predict_batch_size)
    753             if num_fakes:
--> 754                 rt_outputs = [i[:-num_fakes] for i in rt_outputs]
    755         else:
    756             feed = self._pred_feed_batch_process_fn(batch)

TypeError: slice indices must be integers or None or have an __index__ method

Debug:

ipdb> num_fakes
6.0
wangxiao1021 added a commit to wangxiao1021/PALM that referenced this issue Apr 13, 2020
wangxiao1021 added a commit to wangxiao1021/PALM that referenced this issue Apr 13, 2020
xixiaoyao added a commit that referenced this issue Apr 14, 2020
@xixiaoyao
Copy link
Contributor

非常感谢,bug已修复,可以update后再试一下

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants