Skip to content

Commit

Permalink
fix: select linux arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
sangjanai committed Dec 23, 2024
1 parent 51e7aef commit ac00448
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
3 changes: 2 additions & 1 deletion engine/e2e-test/test_api_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def test_engines_install_llamacpp_specific_version_and_null_variant(self):
# engines uninstall
@pytest.mark.asyncio
async def test_engines_install_uninstall_llamacpp_should_be_successful(self):
response = requests.post("http://localhost:3928/v1/engines/llama-cpp/install")
data = {"version": "v0.1.43"}
response = requests.post("http://localhost:3928/v1/engines/llama-cpp/install", json=data)
assert response.status_code == 200
await wait_for_websocket_download_success_event(timeout=None)
time.sleep(30)
Expand Down
3 changes: 2 additions & 1 deletion engine/e2e-test/test_api_engine_install_nightly.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def setup_and_teardown(self):
stop_server()

def test_engines_install_llamacpp_should_be_successful(self):
response = requests.post("http://localhost:3928/v1/engines/llama-cpp/install")
data = {"version": "v0.1.43"}
response = requests.post("http://localhost:3928/v1/engines/llama-cpp/install", json=data)
assert response.status_code == 200

def test_engines_install_llamacpp_specific_version_and_variant(self):
Expand Down
5 changes: 4 additions & 1 deletion engine/e2e-test/test_api_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ async def test_model_pull_with_direct_url_should_have_desired_name(self):
],
)

@pytest.mark.asyncio
async def test_models_start_stop_should_be_successful(self):
print("Install engine")
response = requests.post("http://localhost:3928/v1/engines/llama-cpp/install")
# TODO(sang) Remove version after marking 0.1.43 as stable
data = {"version": "v0.1.43"}
response = requests.post("http://localhost:3928/v1/engines/llama-cpp/install", json=data)
assert response.status_code == 200
await wait_for_websocket_download_success_event(timeout=None)
# TODO(sang) need to fix for cuda download
Expand Down
13 changes: 13 additions & 0 deletions engine/test/components/test_engine_matcher_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class EngineMatcherUtilsTestSuite : public ::testing::Test {
"cortex.llamacpp-0.1.25-25.08.24-linux-amd64-noavx-cuda-12-0.tar.gz",
"cortex.llamacpp-0.1.25-25.08.24-linux-amd64-noavx.tar.gz",
"cortex.llamacpp-0.1.25-25.08.24-linux-amd64-vulkan.tar.gz",
"cortex.llamacpp-0.1.43-linux-arm64.tar.gz",
"cortex.llamacpp-0.1.25-25.08.24-mac-amd64.tar.gz",
"cortex.llamacpp-0.1.25-25.08.24-mac-arm64.tar.gz",
"cortex.llamacpp-0.1.25-25.08.24-windows-amd64-avx-cuda-11-7.tar.gz",
Expand Down Expand Up @@ -134,6 +135,18 @@ TEST_F(EngineMatcherUtilsTestSuite, TestValidate) {
EXPECT_EQ(variant,
"cortex.llamacpp-0.1.25-25.08.24-windows-amd64-avx2.tar.gz");
}

{
auto os{"linux"};
auto cpu_arch{"arm64"};
auto suitable_avx{""};
auto cuda_version{""};

auto variant = engine_matcher_utils::Validate(
cortex_llamacpp_variants, os, cpu_arch, suitable_avx, cuda_version);

EXPECT_EQ(variant, "cortex.llamacpp-0.1.43-linux-arm64.tar.gz");
}
}

TEST_F(EngineMatcherUtilsTestSuite, TestGetVersionAndArch) {
Expand Down
5 changes: 5 additions & 0 deletions engine/utils/engine_matcher_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ inline std::string Validate(const std::vector<std::string>& variants,
if (os == "mac" && !os_and_arch_compatible_list.empty())
return os_and_arch_compatible_list[0];

if (os == "linux" && cpu_arch == "arm64" &&
!os_and_arch_compatible_list.empty()) {
return os_and_arch_compatible_list[0];
}

std::vector<std::string> avx_compatible_list;

std::copy_if(os_and_arch_compatible_list.begin(),
Expand Down

0 comments on commit ac00448

Please sign in to comment.