tests/pytest_random_plugin.py: --seed does not seed Python's `random` module
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 92/100
Research direction
Start in tests/pytest_random_plugin.py at the autouse seed fixture and compare its seeding behavior with tile_kernels/testing/generator.py:94, where generate_rand_float uses Python's random module. Verify the fix with tests/quant/test_per_block_cast_lossless.py and confirm repeated seeded runs produce the same generated inputs.
Written by the indexing model from the issue text.
Description
The autouse seed fixture in tests/pytest_random_plugin.py calls
torch.manual_seed(seed) but does not call random.seed(seed).
tile_kernels/testing/generator.py:94 (generate_rand_float) picks the
magnitude exponent via random.randint(-110, 126). So the input scale
used by tests like tests/quant/test_per_block_cast_lossless.py varies
across runs even when the user passes --seed. That defeats the
plugin's stated purpose.
Reproduction
A torch-free reproduction (the entropy source in question is pure
Python stdlib):
import hashlib, random
def fixture(node_id, base=0):
h = int(hashlib.sha256(node_id.encode()).hexdigest(), 16) % (2**31)
return base + h # plugin currently seeds torch here, not random
node = 'tests/quant/test_per_block_cast_lossless.py::test[num_tokens=4001-hidden=2048]'
fixture(node, base=0)
run1 = [random.randint(-110, 126) for _ in range(8)]
fixture(node, base=0)
run2 = [random.randint(-110, 126) for _ in range(8)]
print(run1); print(run2)
Three back-to-back invocations on this machine produced three different
exponent sequences, e.g. [97, -60, 98, -69, 102, -84, 119, 2] then
[80, -68, -47, 94, 0, 33, -74, 77].
Suggested fix
Add random.seed(seed) immediately after torch.manual_seed(seed) in
the fixture (and import random at the top). PR follows.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 163
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from deepseek-ai/TileKernels
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
deepseek-ai/TileKernels#24 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
deepseek-ai/TileKernels#8 · 2 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
deepseek-ai/TileKernels#6 · 2 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
deepseek-ai/TileKernels#4 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
deepseek-ai/TileKernels#28 · 1 comment ·
All issues in deepseek-ai/TileKernels
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100