Build and test python package on Windows CI (#3049)
This commit is contained in:
@@ -1618,6 +1618,11 @@ class TestArray(mlx_tests.MLXTestCase):
|
||||
self.assertEqual(mv_mx.format, "Q", f"{mlx_dtype}{np_dtype}")
|
||||
elif np_dtype == np.int64:
|
||||
self.assertEqual(mv_mx.format, "q", f"{mlx_dtype}{np_dtype}")
|
||||
# for windows long is 32bit and numpy returns L/l.
|
||||
elif np_dtype == np.uint32 and platform.system() == "Windows":
|
||||
self.assertEqual(mv_mx.format, "I", f"{mlx_dtype}{np_dtype}")
|
||||
elif np_dtype == np.int32 and platform.system() == "Windows":
|
||||
self.assertEqual(mv_mx.format, "i", f"{mlx_dtype}{np_dtype}")
|
||||
else:
|
||||
self.assertEqual(
|
||||
mv_mx.format, mv_np.format, f"{mlx_dtype}{np_dtype}"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright © 2023 Apple Inc.
|
||||
|
||||
import os
|
||||
import platform
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
@@ -126,6 +127,7 @@ class TestLoad(mlx_tests.MLXTestCase):
|
||||
mx.array_equal(load_dict["test"], save_dict["test"])
|
||||
)
|
||||
|
||||
@unittest.skipIf(platform.system() == "Windows", "GGUF is disabled on Windows")
|
||||
def test_save_and_load_gguf(self):
|
||||
if not os.path.isdir(self.test_dir):
|
||||
os.mkdir(self.test_dir)
|
||||
@@ -186,6 +188,7 @@ class TestLoad(mlx_tests.MLXTestCase):
|
||||
out = mx.load(f)["tensor"]
|
||||
self.assertTrue(mx.allclose(mx.from_fp8(out), expected))
|
||||
|
||||
@unittest.skipIf(platform.system() == "Windows", "GGUF is disabled on Windows")
|
||||
def test_save_and_load_gguf_metadata_basic(self):
|
||||
if not os.path.isdir(self.test_dir):
|
||||
os.mkdir(self.test_dir)
|
||||
@@ -218,6 +221,7 @@ class TestLoad(mlx_tests.MLXTestCase):
|
||||
self.assertTrue("meta" in meta_load_dict)
|
||||
self.assertEqual(meta_load_dict["meta"], "data")
|
||||
|
||||
@unittest.skipIf(platform.system() == "Windows", "GGUF is disabled on Windows")
|
||||
def test_save_and_load_gguf_metadata_arrays(self):
|
||||
if not os.path.isdir(self.test_dir):
|
||||
os.mkdir(self.test_dir)
|
||||
@@ -253,6 +257,7 @@ class TestLoad(mlx_tests.MLXTestCase):
|
||||
metadata = {"meta": arr}
|
||||
mx.save_gguf(save_file_mlx, save_dict, metadata)
|
||||
|
||||
@unittest.skipIf(platform.system() == "Windows", "GGUF is disabled on Windows")
|
||||
def test_save_and_load_gguf_metadata_mixed(self):
|
||||
if not os.path.isdir(self.test_dir):
|
||||
os.mkdir(self.test_dir)
|
||||
@@ -396,6 +401,9 @@ class TestLoad(mlx_tests.MLXTestCase):
|
||||
aload = mx.load(save_file)["a"]
|
||||
self.assertTrue(mx.array_equal(a, aload))
|
||||
|
||||
if platform.system() == "Windows":
|
||||
return
|
||||
|
||||
save_file = os.path.join(self.test_dir, "a.gguf")
|
||||
mx.save_gguf(save_file, {"a": a})
|
||||
aload = mx.load(save_file)["a"]
|
||||
|
||||
@@ -18,8 +18,8 @@ class TestMemory(mlx_tests.MLXTestCase):
|
||||
self.assertEqual(mx.set_cache_limit(old_limit), old_limit)
|
||||
|
||||
old_limit = mx.set_memory_limit(10)
|
||||
self.assertTrue(mx.set_memory_limit(old_limit), 10)
|
||||
self.assertTrue(mx.set_memory_limit(old_limit), old_limit)
|
||||
self.assertEqual(mx.set_memory_limit(old_limit), 10)
|
||||
self.assertEqual(mx.set_memory_limit(old_limit), old_limit)
|
||||
|
||||
# Query active and peak memory
|
||||
a = mx.zeros((4096,))
|
||||
|
||||
Reference in New Issue
Block a user