Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit f7b3df6

Browse files
authored
Update sentencepiece.cpp
perform ls for debug only when loading tokenizer model fails
1 parent 8195034 commit f7b3df6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tokenizer/sentencepiece.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ void SPTokenizer::load(const std::string& tokenizer_path) {
3737
fprintf(stderr, "Tokenizer already initialized.\n");
3838
return;
3939
}
40-
// Execute 'ls -al' on the tokenizer path
41-
std::string command = "ls -al " + tokenizer_path;
42-
int ret = system(command.c_str());
43-
if (ret != 0) {
44-
fprintf(stderr, "Failed to execute 'ls -al' in path: %s\n", tokenizer_path.c_str());
45-
}
4640
// read in the file
4741
const auto status = _processor->Load(tokenizer_path);
4842
if (!status.ok()) {
43+
// Execute 'ls -al' on the tokenizer path
44+
std::string command = "ls -al " + tokenizer_path;
45+
int ret = system(command.c_str());
46+
if (ret != 0) {
47+
fprintf(stderr, "Failed to execute 'ls -al' on path: %s\n", tokenizer_path.c_str());
48+
}
4949
fprintf(stderr, "Could not load `%s`.\n If this tokenizer artifact is for llama3, please pass `-l 3`.", tokenizer_path.c_str());
5050
exit(EXIT_FAILURE);
5151
}

0 commit comments

Comments
 (0)