Skip to content
New issue

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

关于mengzi-gpt-neo-base某些字无法正常显示的问题 #53

Open
chn-lee-yumi opened this issue Jan 10, 2023 · 0 comments
Open

关于mengzi-gpt-neo-base某些字无法正常显示的问题 #53

chn-lee-yumi opened this issue Jan 10, 2023 · 0 comments

Comments

@chn-lee-yumi
Copy link

例句:“Linux ⁇ 能和Windows相比,其支持的 ⁇ 能较低,但是 ⁇ 能很低。”

这里的“性”字变成了问号。经过我的排查,我发现vocab里面没有这个文字,而是变成了“xing”。这个我猜测是不是训练素材里面把所有的字都给转换了。。。

目前我自己的临时解决办法如下:

wget https://raw.githubusercontent.com/google/sentencepiece/master/src/sentencepiece_model.proto
protoc --python_out=. sentencepiece_model.proto
import sentencepiece_model_pb2 as model

m = model.ModelProto()
m.ParseFromString(open('mengzi_gpt.model', 'rb').read())

for i in m.pieces:
    if i.piece=="xing":
        i.piece="性"
        print("modified")
        break

with open('new.model', 'wb') as f:
    f.write(m.SerializeToString())

望早日修复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant