jieba AssertionError: In PaddlePaddle 2.x, we turn on dynamic graph mode by default, and 'data()' is only supported in static graph mode. So if you want to use this api, please call 'paddle.enable_static()' before this api to enter static graph mode.

xj3cbfub  于 2022-10-22  发布在  其他
关注(0)|答案(1)|浏览(277)
pip install jieba -U
pip install paddlepaddle -U
import jieba
jieba.enable_paddle()

目前jieba和lac不兼容,需要修改。
相关issue : #901

btxsgosb

btxsgosb1#

def paddle(self): paddle.enable_static() jieba.enable_paddle() seg_list = jieba.cut("我来到北京清华大学", cut_all=False) print("Default Mode: " + "/ ".join(seg_list)) # 精确模式

加入:就可以了。
paddle.enable_static()

相关问题