Skip to content

Commit

Permalink
fix the json_pointer warnings within its latest release
Browse files Browse the repository at this point in the history
  • Loading branch information
wenbingl committed Mar 4, 2025
1 parent 2cba60c commit eeb8093
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions operators/tokenizer/bpe_kernels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,16 @@ void JsonFastTokenizer::LoadSpmModelParams(const json& tok_json) {
for (const auto& step : *decoders_node) {
std::string type = step.value("type", "");
if (type == "Replace") {
std::string target = step.value("/pattern/String"_json_pointer, "");
std::string target = "";
if (step.contains("pattern")) {
target = step["pattern"].value("String", "");
}
if (target == spm_escaped_space) {
json_conf_.spm_model_ = true;
}
}
else if (type == "Strip") {
std::string content = step.value("/content"_json_pointer, "");
std::string content = step.value("content", "");
if (content == " ") {
json_conf_.add_dummy_prefix_ = true;
}
Expand Down
1 change: 0 additions & 1 deletion operators/tokenizer/tokenizer_jsconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class TokenJsonConfig final {
TokenJsonConfig() {}
~TokenJsonConfig() {}
using json = nlohmann::json;
using json_pointer = nlohmann::json_pointer<std::string>;
std::shared_ptr<json> added_tokens_decoder;

public:
Expand Down

0 comments on commit eeb8093

Please sign in to comment.