fxsjy / jieba

结巴中文分词
MIT License
33.06k stars 6.72k forks source link

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. #916

Open DachuanZhao opened 3 years ago

DachuanZhao commented 3 years ago
pip install jieba -U
pip install paddlepaddle -U
import jieba
jieba.enable_paddle()

目前jieba和lac不兼容,需要修改。 相关issue : https://github.com/fxsjy/jieba/issues/901

sinhang commented 2 years ago

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()