Select native macOS model builds

This commit is contained in:
firat
2026-08-03 18:57:55 +02:00
parent 822cf3b2a3
commit fa14ec90f4
2 changed files with 34 additions and 2 deletions
+20 -1
View File
@@ -176,6 +176,9 @@ class Download(Local):
class InstallProgram(Local):
def setUp(self):
super().setUp()
# These fixtures are Ubuntu release archives. Keep checking that path
# on every host, including the Mac that checks the macOS backend.
self.patch_attr(sys, "platform", "linux")
# Built once, because the release listing has to publish its checksum
# and a tarball is not the same bytes twice.
self.archive = tarball({
@@ -216,6 +219,23 @@ class InstallProgram(Local):
ggml.install_program(ggml.WHISPER)
self.assertIn("this machine", str(caught.exception))
def test_a_mac_does_not_install_an_ubuntu_archive_for_the_same_architecture(self):
self.patch_attr(sys, "platform", "darwin")
self.patch_attr(ggml, "_arch", lambda: "arm64")
listing = self.release("whisper-bin-ubuntu-arm64.tar.gz")
with fake_urlopen(listing):
with self.assertRaises(ggml.LocalError) as caught:
ggml.install_program(ggml.WHISPER)
self.assertIn("brew install whisper-cpp", str(caught.exception))
def test_a_mac_uses_the_native_llama_archive_instead_of_ubuntu(self):
self.patch_attr(sys, "platform", "darwin")
self.patch_attr(ggml, "_arch", lambda: "arm64")
self.assertEqual(
ggml._wanted_assets(ggml.LLAMA),
("bin-macos-arm64.tar.gz",),
)
def test_what_was_installed_is_remembered(self):
path, _ = self.install("whisper-bin-ubuntu-x64.tar.gz")
self.assertEqual(ggml.installed_program(ggml.WHISPER), path)
@@ -661,4 +681,3 @@ class Sizes(DikteTest):
self.assertEqual(ggml.human_size(512), "512 B")
self.assertEqual(ggml.human_size(574041195), "547.4 MB")
self.assertEqual(ggml.human_size(3_095_033_483), "2.9 GB")