DDParser icon indicating copy to clipboard operation
DDParser copied to clipboard

GPU版本的ddp.parse报错

Open Yuhuajoe opened this issue 3 years ago • 2 comments

Environment info

Platform: centos 7 cuda version: 11.2 Python version: 3.8.5 ddparser version: 1.0.6 paddlepaddle version: paddlepaddle-gpu 2.2.1 Using GPU in script?: yes

To reproduce

  • code
from ddparser import DDParser   

ddp = DDParser(                                                                                                      
            #encoding_model='transformer'
            prob=True, #概率输出
            use_pos=True, #词性输出
            use_cuda=True
        )
ddp.parse(["百度是一家高科技公司"])
  • output
W1221 17:48:36.195587  3303 analysis_predictor.cc:1353] Deprecated. Please use CreatePredictor instead.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/zhouyuhua/.local/lib/python3.8/site-packages/ddparser/run.py", line 399, in parse
    pred_arcs, pred_rels, pred_probs = epoch_predict(self.env, self.args, self.model, dataset.loader)
  File "/home/zhouyuhua/.conda/envs/paddle/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/zhouyuhua/.conda/envs/paddle/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 276, in __impl__
    return func(*args, **kwargs)
  File "/home/zhouyuhua/.local/lib/python3.8/site-packages/ddparser/parser/model.py", line 201, in epoch_predict
    arc_probs = nn.index_sample(layers.softmax(s_arc, -1), layers.unsqueeze(arc_preds, -1))
  File "/home/zhouyuhua/.conda/envs/paddle/lib/python3.8/site-packages/paddle/fluid/layers/nn.py", line 1337, in softmax
    return _C_ops.softmax(input, 'axis', axis, 'use_cudnn', use_cudnn)
ValueError: (InvalidArgument) softmax(): argument (position 4) must be bool, but got int (at /paddle/paddle/fluid/pybind/op_function.h:260)

Yuhuajoe avatar Dec 21 '21 10:12 Yuhuajoe

降低版本后问题解决了 降低后的版本为 paddlepaddle-gpu==2.1.0.post112 及ddparser==1.05

Yuhuajoe avatar Dec 22 '21 08:12 Yuhuajoe

ddparser1.0.6可以先使用paddle2.1.x版本,paddle2.2.x会在近期兼容。

zhangyimi avatar Dec 23 '21 06:12 zhangyimi