@@ -56,7 +56,7 @@ Error HFTokenizer::load(const std::string& path) {
56
56
json parsed_json;
57
57
try {
58
58
parsed_json = json::parse (contents);
59
- } catch (const json ::exception& e) {
59
+ } catch (const std ::exception& e) {
60
60
TK_LOG (Error, " Error parsing json file: %s" , e.what ());
61
61
return Error::LoadFailure;
62
62
}
@@ -76,7 +76,7 @@ Error HFTokenizer::load(const std::string& path) {
76
76
77
77
// Store for future use.
78
78
special_token_map_.emplace (std::move (special_token_map));
79
- } catch (const json::out_of_range & e) {
79
+ } catch (const std::exception & e) {
80
80
TK_LOG (Info, " Could not parse special tokens: %s" , e.what ());
81
81
return Error::LoadFailure;
82
82
}
@@ -96,7 +96,7 @@ Error HFTokenizer::load(const std::string& path) {
96
96
97
97
auto token_map = TK_UNWRAP (detail::build_token_map (std::move (token_pairs)));
98
98
token_map_.emplace (std::move (token_map));
99
- } catch (const json::out_of_range & e) {
99
+ } catch (const std::exception & e) {
100
100
TK_LOG (Info, " Could not parse tokens: %s" , e.what ());
101
101
return Error::LoadFailure;
102
102
}
@@ -114,7 +114,7 @@ Error HFTokenizer::load(const std::string& path) {
114
114
} else {
115
115
TK_LOG (Info, " Normalizer field is null, skipping" );
116
116
}
117
- } catch (const json::out_of_range & e) {
117
+ } catch (const std::exception & e) {
118
118
// No "Normalizer" field found
119
119
TK_LOG (
120
120
Info,
@@ -129,7 +129,7 @@ Error HFTokenizer::load(const std::string& path) {
129
129
.parse_json (parsed_json.at (" pre_tokenizer" ))
130
130
.create ();
131
131
TK_LOG (Info, " Pretokenizer set up" );
132
- } catch (const json::out_of_range & e) {
132
+ } catch (const std::exception & e) {
133
133
TK_LOG (Info, " Could not parse pre_tokenizer: %s" , e.what ());
134
134
return Error::LoadFailure;
135
135
}
@@ -138,7 +138,7 @@ Error HFTokenizer::load(const std::string& path) {
138
138
try {
139
139
_decoder =
140
140
TokenDecoderConfig ().parse_json (parsed_json.at (" decoder" )).create ();
141
- } catch (const json::out_of_range &) {
141
+ } catch (const std::exception &) {
142
142
// No decoder specified
143
143
}
144
144
@@ -192,7 +192,7 @@ Error HFTokenizer::load(const std::string& path) {
192
192
" Built merge ranks map with %" PRId64 " entries" ,
193
193
static_cast <int64_t >(merge_ranks.size ()));
194
194
merge_ranks_.emplace (std::move (merge_ranks));
195
- } catch (const json::out_of_range & e) {
195
+ } catch (const std::exception & e) {
196
196
TK_LOG (Error, " Could not parse merges: %s" , e.what ());
197
197
return Error::LoadFailure;
198
198
}
@@ -211,7 +211,7 @@ Error HFTokenizer::load(const std::string& path) {
211
211
json parsed_config_json;
212
212
try {
213
213
parsed_config_json = json::parse (config_contents);
214
- } catch (const json ::exception& e) {
214
+ } catch (const std ::exception& e) {
215
215
TK_LOG (Error, " Error parsing model config json json file: %s" , e.what ());
216
216
return Error::LoadFailure;
217
217
}
@@ -239,7 +239,7 @@ Error HFTokenizer::load(const std::string& path) {
239
239
}
240
240
bos_tok_ = *bos_res;
241
241
eos_tok_ = *eos_res;
242
- } catch (const json::out_of_range & e) {
242
+ } catch (const std::exception & e) {
243
243
TK_LOG (Error, " Could not eos/bos from tokenizer config: %s" , e.what ());
244
244
return Error::LoadFailure;
245
245
}
0 commit comments