Download code/models/common/tests/test_weight_cache_checkpoint_name.py from tt-hous/clef: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/tt-hous/clef/resolve/main/code/models/common/tests/test_weight_cache_checkpoint_name.py
- Command line
-
hf download hf://tt-hous/clef/code/models/common/tests/test_weight_cache_checkpoint_name.py
-
curl -L -o test_weight_cache_checkpoint_name.py https://huggingface.co/tt-hous/clef/resolve/main/code/models/common/tests/test_weight_cache_checkpoint_name.py
1.49 kB
| # SPDX-FileCopyrightText: © 2026 Tenstorrent USA, Inc. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| """checkpoint_name() must give one name for every way a checkpoint is addressed. | |
| The warm weight-cache marker records ``model_name``; the demo seeds it from the HF id while vLLM | |
| (under HF_HUB_OFFLINE) hands over the resolved hub snapshot directory. If the two spell the name | |
| differently the vLLM server never sees the marker and cold-loads the full checkpoint every start. | |
| """ | |
| import pytest | |
| from models.common.weight_cache import checkpoint_name | |
| HUB = "/mnt/MLPerf/huggingface/hub" | |
| def test_checkpoint_name(model_path, expected): | |
| assert checkpoint_name(model_path) == expected | |
| def test_hf_id_and_hub_snapshot_agree(): | |
| hf_id = "google/gemma-4-31B-it" | |
| snapshot = f"{HUB}/models--google--gemma-4-31B-it/snapshots/842da37" | |
| assert checkpoint_name(hf_id) == checkpoint_name(snapshot) | |