ImportError: cannot import name ‘KConditionalRandomField‘ from ‘kashgari.layers‘

Take over the previous NER code, using the kashgari package, after installing kashgari 1.1.4 and TensorFlow 1.15, execute the code:

from kashgari.embeddings import BertEmbedding
from kashgari.layers import L, KConditionalRandomField

报错:
ImportError: cannot import name ‘BertEmbedding’ from ‘kashgari.embeddings’ (miniconda3/envs/lib/python3.7/site-packages/kashgari/embeddings/__init__.py)

ImportError: cannot import name ‘KConditionalRandomField’ from ‘kashgari.layers’ (miniconda3/envs/lib/python3.7/site-packages/kashgari/layers/__init__.py)

solution

Install kashgari version 2.0 and above:

pip install 'kashgari>=2.0.0'

Welcome to follow

Artificial Intelligence Technology AnalysisArtificial
IntelligenceMachine LearningDeep LearningAIThree
Elements of Artificial Intelligence: Data, Computing Power and AlgorithmsComputer
Vision (CV) Task Introduction: Classification, Detection, Segmentation, Super-resolution, Keypoint Recognition, Image Generation, Metric LearningAbout
me
Genesis: A New Beginning

The official account continues to update original content, welcome to subscribe.

AI artificial intelligence and big data
Alt

Guess you like

Origin blog.csdn.net/guanxs/article/details/115679281