ltp icon indicating copy to clipboard operation
ltp copied to clipboard

分词时报错Weights only load failed

Open Macedonialapadian opened this issue 10 months ago • 0 comments

Error initializing LTP (model path: 'base'): Weights only load failed. In PyTorch 2.6, we changed the default value of the weights_only argument in torch.load from False to True. Re-running torch.load with weights_only set to False will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source. Please file an issue with the following so that we can make weights_only=True compatible with your use case: WeightsUnpickler error: Unsupported operand 118

Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html. Please ensure LTP models are correctly downloaded and paths are correct. You might need to run ltp.LTP() once to download default models, or specify a correct path.

Macedonialapadian avatar May 28 '25 17:05 Macedonialapadian