Datasets:
Download tile_kernels_src/tests/pytest_random_plugin.py from CLIWorks/Spider-FLEXITOKENS-FP8: direct link, hf CLI and curl.
- Browser
- Download file 401 Bytes
-
https://huggingface.co/datasets/CLIWorks/Spider-FLEXITOKENS-FP8/resolve/main/tile_kernels_src/tests/pytest_random_plugin.py
- Command line
-
hf download hf://datasets/CLIWorks/Spider-FLEXITOKENS-FP8/tile_kernels_src/tests/pytest_random_plugin.py
-
curl -L -o pytest_random_plugin.py https://huggingface.co/datasets/CLIWorks/Spider-FLEXITOKENS-FP8/resolve/main/tile_kernels_src/tests/pytest_random_plugin.py
401 Bytes
| import hashlib | |
| import pytest | |
| import torch | |
| def pytest_addoption(parser): | |
| parser.addoption('--seed', type=int, default=0) | |
| def seed(request): | |
| base = request.config.getoption('--seed') | |
| node_hash = int(hashlib.sha256( | |
| request.node.nodeid.encode() | |
| ).hexdigest(), 16) % (2**31) | |
| seed = base + node_hash | |
| torch.manual_seed(seed) | |
| return seed | |