Skip to content

Commit ef995ba

Browse files
authored
bugfix: properly detect tokenizer.json and activate fast_tokenizer in DiTModelLoader. (#436)
1 parent 67a55c1 commit ef995ba

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

xllm/core/framework/dit_model_loader.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ bool DiTFolderLoader::load_tokenizer_args(
174174
JsonReader tokenizer_reader;
175175
const std::string tokenizer_args_file_path =
176176
model_weights_path_ + "/tokenizer_config.json";
177+
178+
// check if tokenizer.json exists, if exists, set the tokenizer type to fast
179+
const std::string tokenizer_json_path =
180+
model_weights_path + "/tokenizer.json";
181+
if (std::filesystem::exists(tokenizer_json_path)) {
182+
tokenizer_args_.tokenizer_type() = "fast";
183+
tokenizer_args_.vocab_file() = tokenizer_json_path;
184+
}
185+
177186
if (!std::filesystem::exists(tokenizer_args_file_path)) {
178187
return true;
179188
}

0 commit comments

Comments
 (0)