| 115 | #ifdef __linux__ |
| 116 | |
| 117 | void LoadOneEmbedding(const std::string& model_path, const Device& device) { |
| 118 | const std::string one_embedding_info_name("one_embedding_options.json"); |
| 119 | const std::string one_embedding_info_save_path( |
| 120 | oneflow::JoinPath(model_path, one_embedding_info_name)); |
| 121 | if (oneflow::embedding::PosixFile::FileExists(one_embedding_info_save_path)) { |
| 122 | std::ifstream one_embedding_info_file(one_embedding_info_save_path); |
| 123 | auto one_embedding_json = nlohmann::json::parse(one_embedding_info_file); |
| 124 | for (auto& it : one_embedding_json["embedding"]) { |
| 125 | const std::string snapshot_path = it["snapshot"]; |
| 126 | auto kv_options_json = it["kv_options"]; |
| 127 | std::string embedding_name = embedding::CreateKeyValueStore(kv_options_json.dump(), |
| 128 | /*local_rank_id=*/0, |
| 129 | /*rank_id=*/0, |
| 130 | /*world_size=*/1); |
| 131 | embedding::LoadSnapshot(snapshot_path, embedding_name, /*local_rank_id=*/0, |
| 132 | /*rank_id=*/0); |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | #endif // __linux__ |
| 138 |
no test coverage detected