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) {
142
142
143
143
// Pull out the token strings
144
144
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
+ : " " ;
147
154
const auto bos_res = special_token_map_->tryGetInteger (bos_token);
148
155
const auto eos_res = special_token_map_->tryGetInteger (eos_token);
149
156
if (!bos_res) {
You can’t perform that action at this time.
0 commit comments