MCPcopy
hub / github.com/jundot/omlx / test_fp4_load_packed_roundtrip

Method test_fp4_load_packed_roundtrip

tests/test_oq.py:2043–2051  ·  view source on GitHub ↗
(self, tmp_path)

Source from the content-addressed store, hash-verified

2041 assert mx.array_equal(scales, ref).item()
2042
2043 def test_fp4_load_packed_roundtrip(self, tmp_path):
2044 path = str(tmp_path / "fp4.safetensors")
2045 tensors = {}
2046 qw, scales = _write_fp4_pair(tensors, "experts.0.w1", 8, 64)
2047 _write_safetensors(path, tensors)
2048 idx = _LazyTensorIndex([path])
2049 packed, sc = idx._load_packed("experts.0.w1.weight")
2050 assert mx.array_equal(packed, qw).item()
2051 assert mx.array_equal(sc, scales).item()
2052
2053 def test_reshape_astype_replay(self, tmp_path):
2054 path = str(tmp_path / "w.safetensors")

Callers

nothing calls this directly

Calls 4

_LazyTensorIndexClass · 0.90
_write_fp4_pairFunction · 0.85
_load_packedMethod · 0.80
_write_safetensorsFunction · 0.70

Tested by

no test coverage detected