Skip to content

Commit 479a90e

Browse files
committed
Improve error message
Summary: Example error message: ``` couldn't load runner/third-party/tokenizers/test/resources/test_sentencepiece.model. Error message: model file path should not be empty. It is likely that the tokenizer artifact is broken or of a different format. ``` Test Plan: Reviewers: Subscribers: Tasks: Tags:
1 parent 08e3cfa commit 479a90e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sentencepiece.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ Error SPTokenizer::load(const std::string &tokenizer_path) {
3838
const auto status = _processor->Load(tokenizer_path);
3939
if (!status.ok()) {
4040
fprintf(stderr,
41-
"couldn't load %s\n. It is likely that the tokenizer artifact is "
41+
"couldn't load %s. \nError message: \n%s\n"
42+
"It is likely that the tokenizer artifact is "
4243
"broken or of a different format.",
43-
tokenizer_path.c_str());
44+
tokenizer_path.c_str(), status.error_message());
4445
return Error::LoadFailure;
4546
}
4647
// load vocab_size, bos_tok, eos_tok

0 commit comments

Comments
 (0)