Skip to content

Commit

Permalink
Update lib search to right loc (octoml#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen authored May 20, 2023
1 parent f3e1b39 commit 4ce3022
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions cpp/cli_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ struct LLMChatModule {

std::optional<std::filesystem::path> TryInferMLCChatConfig(const std::string& artifact_path,
const std::string& local_id) {
return FindFile({artifact_path + "/" + local_id + "/params", //
artifact_path + "/prebuilt/" + local_id}, //
{"mlc-chat-config"}, //
return FindFile({artifact_path + "/prebuilt/" + local_id, //
artifact_path + "/" + local_id + "/params"}, //
{"mlc-chat-config"}, //
{".json"});
}

Expand Down Expand Up @@ -317,10 +317,10 @@ ModelPaths ModelPaths::Find(const std::string& artifact_path, const std::string&
std::filesystem::path lib_path;
if (auto path = FindFile(
{
artifact_path + "/" + lib_local_id, // Usually this is the candidate
artifact_path + "/" + lib_local_id + "/lib/",
artifact_path + "/prebuilt/lib/", // prebuild lib
artifact_path + "/prebuilt/" + lib_local_id, // For prebuilts
artifact_path + "/prebuilt/" + lib_local_id + "/lib/",
artifact_path + "/" + lib_local_id, // Usually this is the candidate
artifact_path + "/" + lib_local_id + "/lib/",
},
{
lib_name,
Expand All @@ -329,9 +329,8 @@ ModelPaths ModelPaths::Find(const std::string& artifact_path, const std::string&
GetLibSuffixes())) {
lib_path = path.value();
} else {
std::cerr << "Cannot find library \"" << lib_name << GetLibSuffixes().back()
<< "\" and other library candidate in " << artifact_path << "/" << local_id
<< std::endl;
std::cerr << "Cannot find library \"" << lib_name << GetLibSuffixes().back() << "\" in "
<< artifact_path << "/prebuilt/lib or other search paths" << std::endl;
exit(1);
}
std::cout << "Use model library: " << lib_path << std::endl;
Expand Down

0 comments on commit 4ce3022

Please sign in to comment.