diff --git a/src/config.cpp b/src/config.cpp index 39341f5b5..9fa32b82d 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -397,7 +397,7 @@ struct RootObject_Element : JSON::Element { JSON::Element& t_; }; -void ParseConfig(const std::filesystem::path& filename, Config& config) { +void ParseConfig(const std::experimental::filesystem::path& filename, Config& config) { std::ifstream file(filename, std::ios::binary | std::ios::ate); if (!file.is_open()) { throw std::runtime_error("Error opening " + filename.string()); @@ -421,7 +421,7 @@ void ParseConfig(const std::filesystem::path& filename, Config& config) { } } -Config::Config(const std::filesystem::path& path) : config_path{path} { +Config::Config(const std::experimental::filesystem::path& path) : config_path{path} { ParseConfig(path / "genai_config.json", *this); if (model.context_length == 0) diff --git a/src/config.h b/src/config.h index b94e05ca0..464782255 100644 --- a/src/config.h +++ b/src/config.h @@ -6,9 +6,9 @@ namespace Generators { struct Config { Config() = default; - Config(const std::filesystem::path& path); + Config(const std::experimental::filesystem::path& path); - std::filesystem::path config_path; // Path of the config directory + std::experimental::filesystem::path config_path; // Path of the config directory using ProviderOption = std::pair; struct ProviderOptions { diff --git a/src/generators.h b/src/generators.h index e6ad6f0e1..e45e333d7 100644 --- a/src/generators.h +++ b/src/generators.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include "span.h" #include diff --git a/src/logging.cpp b/src/logging.cpp index 6c334f50a..99e9626f0 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -44,7 +44,7 @@ void SetLogString(std::string_view name, std::string_view value) { if (value.empty()) gp_logfile.reset(); else { - std::filesystem::path filename{value}; + std::experimental::filesystem::path filename{value}; gp_logfile = std::make_unique(filename); } diff --git a/src/models/model.cpp b/src/models/model.cpp index 35a9b4ad4..65378ab6e 100644 --- a/src/models/model.cpp +++ b/src/models/model.cpp @@ -297,7 +297,7 @@ void Model::CreateSessionOptions() { } if (options.enable_profiling.has_value()) { - std::filesystem::path profile_file_prefix{options.enable_profiling.value()}; + std::experimental::filesystem::path profile_file_prefix{options.enable_profiling.value()}; ort_options.EnableProfiling(profile_file_prefix.c_str()); } diff --git a/src/tokenizer/c_api/tfmtok_c.cc b/src/tokenizer/c_api/tfmtok_c.cc index 02c57ce65..c8de10dff 100644 --- a/src/tokenizer/c_api/tfmtok_c.cc +++ b/src/tokenizer/c_api/tfmtok_c.cc @@ -2,7 +2,7 @@ // Licensed under the MIT License. #include -#include +#include #include #include "tfmtok.h" @@ -117,7 +117,7 @@ tfmError_t TFM_API_CALL TfmCreateTokenizer(TfmTokenizer** tokenizer, return kTfmErrorInvalidArgument; } - if (!std::filesystem::is_directory(tokenizer_path)) { + if (!std::experimental::filesystem::is_directory(tokenizer_path)) { last_error_message = std::string("Cannot find the directory of ") + tokenizer_path; return kTfmErrorInvalidArgument; } diff --git a/src/tokenizer/config.cc b/src/tokenizer/config.cc index dbc0908cf..dc6bd9471 100644 --- a/src/tokenizer/config.cc +++ b/src/tokenizer/config.cc @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include "config.h" @@ -68,8 +68,8 @@ TfmStatus TokenConfig::LoadJson(const std::string& json_path) { simdjson::dom::parser parser; simdjson::dom::element root; - if (!std::filesystem::exists( - std::filesystem::path(json_path).lexically_normal())) { + if (!std::experimental::filesystem::exists( + std::experimental::filesystem::path(json_path))) { return {kTfmErrorInvalidFile, std::string(json_path) + " not found"}; } std::string json_text = PatchJsonText(json_path); diff --git a/src/tokenizer/tokenizer.cc b/src/tokenizer/tokenizer.cc index b2a0622e7..fc11f5f35 100644 --- a/src/tokenizer/tokenizer.cc +++ b/src/tokenizer/tokenizer.cc @@ -1,7 +1,7 @@ #include "token_bpe.h" #include "token_rwkv.h" -#include +#include #include namespace tfm { @@ -30,7 +30,7 @@ TfmStatus CreateBPETokenizer(const std::string& tokenizer_path, if (type.empty()) { if (BPETokenizer::IsSupportedModel(GetModelName(token_cfg->tokenizer_class_))) { type = "BPE"; - } else if (std::filesystem::exists(tokenizer_path + "/tokenizer.model")) { + } else if (std::experimental::filesystem::exists(tokenizer_path + "/tokenizer.model")) { // if 'tokenizer.model exists in the tokenizer_path, then it is a sentencepiece model type = "SPM"; } else { @@ -42,7 +42,8 @@ TfmStatus CreateBPETokenizer(const std::string& tokenizer_path, token_ptr = std::make_unique(); } /* else if (type == "SPM") { token_ptr = std::make_unique(); - } */ else { + } */ + else { status = TfmStatus(kTfmErrorInvalidArgument, "Unknown tokenizer_type, (BPE, SPM, RKWV) are supported."); }