baidu / DDParser

百度开源的依存句法分析系统
Apache License 2.0
973 stars 163 forks source link

GPU版本的ddp.parse报错 #57

Open Yuhuajoe opened 2 years ago

Yuhuajoe commented 2 years ago

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

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 "", line 1, in 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 commented 2 years ago

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

zhangyimi commented 2 years ago

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