Download code/models/common/tests/utils.py from tt-hous/clef: direct link, hf CLI and curl.
- Browser
- Download file 682 Bytes
-
https://huggingface.co/tt-hous/clef/resolve/main/code/models/common/tests/utils.py
- Command line
-
hf download hf://tt-hous/clef/code/models/common/tests/utils.py
-
curl -L -o utils.py https://huggingface.co/tt-hous/clef/resolve/main/code/models/common/tests/utils.py
682 Bytes
| # SPDX-FileCopyrightText: © 2026 Tenstorrent USA, Inc. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| """Shared helpers for models/common tests.""" | |
| from __future__ import annotations | |
| import zlib | |
| def stable_model_seed(model_name: str) -> int: | |
| """Stable 32-bit seed derived from model name. | |
| Python's built-in hash is randomized per process, which breaks reproducibility | |
| across runs and can mismatch on-disk cached weights. Use CRC32 instead. | |
| NOTE: Avoid a single hardcoded global seed (e.g., 1234) for all models; a | |
| per-model stable seed keeps caches distinct and reduces correlated RNG paths. | |
| """ | |
| return zlib.crc32(model_name.encode("utf-8")) & 0xFFFFFFFF | |