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

RuntimeError: CUDA error: device-side assert triggered! Solve!!! #43

Open
fangshuiyun opened this issue Sep 24, 2023 · 0 comments
Open

Comments

@fangshuiyun
Copy link

fangshuiyun commented Sep 24, 2023

出现这个问题是因为计算损失时,label超出模型输出的类别数造成的。
运行完python gen_vocab.py会生成自定义的vocab.txt(假如有100类),之后运行python init_custdata_model.py初始化模型等权重,确实将模型最后的分类层改成了100(自己print(model)看一下就知道了),初始化之后的vocab.json也确实是100类,但是tokenizer.json还是原来的11318类,所以在train.pyvocab = processor.tokenizer.get_vocab() 所获得的词表还是11318,那么自定义的词表中某个字符的标签就可能不是0-99,而是0-11317,做交叉熵损失时,模型输出100类,你的标签是1000,所以会发生错误!
解决方法:将生成好的cust-data/weights/vocab.json,替换weights/vocab.json,再重新跑一遍python init_custdata_model.py,得到正确的tokenizer.json文件!

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