Skip to content

Commit

Permalink
More tests (loading dense tensors)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbogunowicz authored Apr 19, 2024
1 parent 23b4b10 commit 26192e9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_utils/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,13 @@ def test_load_compressed_sparse(tmp_path, tensors_and_config_sparse):
loaded_tensors = load_compressed(tmp_path / "model.safetensors", compression_config)
for key in tensors:
assert torch.allclose(tensors[key], loaded_tensors[key])


def test_load_compressed_dense(tmp_path, tensors_dense):
save_compressed(
tensors_dense,
save_path=tmp_path / "model.safetensors",
)
loaded_tensors = load_compressed(tmp_path / "model.safetensors")
for key in tensors_dense:
assert torch.allclose(tensors_dense[key], loaded_tensors[key])

0 comments on commit 26192e9

Please sign in to comment.