File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -142,8 +142,15 @@ Error HFTokenizer::load(const std::string& path) {
142142
143143 // Pull out the token strings
144144 try {
145- const std::string bos_token = parsed_config_json.at (" bos_token" );
146- const std::string eos_token = parsed_config_json.at (" eos_token" );
145+ const std::string bos_token =
146+ parsed_config_json.contains (" bos_token" ) && !parsed_config_json[" bos_token" ].is_null ()
147+ ? parsed_config_json[" bos_token" ].get <std::string>()
148+ : " " ;
149+
150+ const std::string eos_token =
151+ parsed_config_json.contains (" eos_token" ) && !parsed_config_json[" eos_token" ].is_null ()
152+ ? parsed_config_json[" eos_token" ].get <std::string>()
153+ : " " ;
147154 const auto bos_res = special_token_map_->tryGetInteger (bos_token);
148155 const auto eos_res = special_token_map_->tryGetInteger (eos_token);
149156 if (!bos_res) {
You can’t perform that action at this time.
0 commit comments