Download code/readiness_check/test_schema.py from ndaly/Voxtral-Mini-4B-Realtime-2602: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/ndaly/Voxtral-Mini-4B-Realtime-2602/resolve/main/code/readiness_check/test_schema.py
- Command line
-
hf download hf://ndaly/Voxtral-Mini-4B-Realtime-2602/code/readiness_check/test_schema.py
-
curl -L -o test_schema.py https://huggingface.co/ndaly/Voxtral-Mini-4B-Realtime-2602/resolve/main/code/readiness_check/test_schema.py
1.13 kB
| # SPDX-FileCopyrightText: © 2026 Tenstorrent USA, Inc. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| import torch | |
| from readiness_check.schema import FORMAT_VERSION, load_reference | |
| def test_load_reference_uses_weights_only(monkeypatch, tmp_path): | |
| payload = { | |
| "format_version": FORMAT_VERSION, | |
| "k": 2, | |
| "hf_model_id": "unit-test", | |
| "token_ids_meta": {}, | |
| "entries": [ | |
| { | |
| "prompt_text": "prompt", | |
| "prompt_tokens": torch.tensor([[1, 2]], dtype=torch.int64), | |
| "generated_tokens": torch.tensor([[3]], dtype=torch.int64), | |
| "topk_tokens": torch.tensor([[3, 4]], dtype=torch.int32), | |
| "tf_prompt_len": 2, | |
| } | |
| ], | |
| } | |
| def fake_load(path, *, weights_only): | |
| assert path == tmp_path / "reference.refpt" | |
| assert weights_only is True | |
| return payload | |
| monkeypatch.setattr(torch, "load", fake_load) | |
| reference = load_reference(tmp_path / "reference.refpt") | |
| assert reference.hf_model_id == "unit-test" | |
| assert reference.entries[0].generated_tokens.tolist() == [[3]] | |