HIT-SCIR / ltp

Language Technology Platform
http://ltp.ai
4.98k stars 1.04k forks source link

AttributeError: module 'ltp_core.models' has no attribute 'processors' #666

Closed RyanBin0126 closed 1 year ago

RyanBin0126 commented 1 year ago

When specifying the use of the local model, an error occurred: AttributeError: module 'ltp_core.models' has no attribute 'processors'.

Upon inspection, I found that the configuration in the uncompressed model files' config.json was incorrect. The original configuration was as follows:

"processor": { "cws": { "_ltptarget": "ltp_core.models.processors.TokenOnly" }, "pos": { "_ltptarget": "ltp_core.models.processors.WordsOnly" }, "ner": { "_ltptarget": "ltp_core.models.processors.WordsOnly" }, "srl": { "_ltptarget": "ltp_core.models.processors.WordsOnly" }, "dep": { "_ltptarget": "ltp_core.models.processors.WordsWithHead" }, "sdp": { "_ltptarget": "ltp_core.models.processors.WordsWithHead" } }

The problem is that all instances of "processor" were mistakenly written as "processors." The correct configuration should be "processor," not "processors." Once corrected, it should work correctly.