Skip to content

Fix issues when loadmodel from model file which contains Unicode #153

Open
leti367 wants to merge 2 commits intomicrosoft:masterfrom
leti367:dev/leti/loadmodelunicode
Open

Fix issues when loadmodel from model file which contains Unicode #153
leti367 wants to merge 2 commits intomicrosoft:masterfrom
leti367:dev/leti/loadmodelunicode

Conversation

@leti367
Copy link
Member

@leti367 leti367 commented Jul 19, 2022

This issue happens when there are Unicode characters exist in model file name. To test it I simply modified the nuget test project, updates the model file name from "bert_base_tok.bin" to "bert_base_tok★.bin". Then when we run the test we got the exception:
"
Model File Name is: ./bin/Debug/net6.0/bert_base_tokΓÿà.bin
Unhandled exception. System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
at BlingFire.BlingFireUtils.LoadModel(Byte[] modelName)
"

setlocale(LC_ALL, ".UTF8") fixes this issue. I've tested it on x64-windows ,arm64-windows, osx-arm64. will do more testes on other platforms.

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

Successfully merging this pull request may close these issues.

2 participants