We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
代码:
from pycorrector import MacBertCorrector model_path = 'model/macbert4csc-base-chinese' bert_model = MacBertCorrector(model_name_or_path=model_path) bert_model.correct_batch(sentences=['标准皮鞋码哈运动鞋码40选39码'], max_length=50, batch_size=4, threshold=0.75)
运行结果:
File "/home/root/miniconda3/envs/py310/lib/python3.10/site-packages/pycorrector/macbert/macbert_corrector.py", line 97, in correct_batch sents = self._predict( │ └ <function MacBertCorrector._predict at 0x7fef50b83a30> └ <pycorrector.macbert.macbert_corrector.MacBertCorrector object at 0x7fefcae47d30> File "/home/root/miniconda3/envs/py310/lib/python3.10/site-packages/pycorrector/macbert/macbert_corrector.py", line 57, in _predict if probs[i + 1] >= threshold: │ │ └ 0.75 │ └ 15 └ array([0.90520966, 1. , 0.9999956 , 0.9994678 , 0.9999119 , 0.99893886, 0.97873324, 0.9999783 , 0.99998116, 0.9... IndexError: index 16 is out of bounds for axis 0 with size 16
调试了一下发现模型预测结果是: ['码', '标', '准', '皮', '鞋', '码', '哈', '运', '动', '鞋', '码', '40', '选', '39', '码', '码'] 明显是错误的,其它句子有时也会出现这种情况。
The text was updated successfully, but these errors were encountered:
模型预测错误,错位了。
Sorry, something went wrong.
请问如何解决这个问题呢?
No branches or pull requests
代码:
运行结果:
调试了一下发现模型预测结果是:
['码', '标', '准', '皮', '鞋', '码', '哈', '运', '动', '鞋', '码', '40', '选', '39', '码', '码']
明显是错误的,其它句子有时也会出现这种情况。
The text was updated successfully, but these errors were encountered: