Skip to content

Commit f61b5fc

Browse files
committed
dsv41 dspark: import os for the unseeded SpecSampler seed
cd274fb dropped the module's os import with the pread Engram path; an unseeded sampled request (the serving default at temperature > 0) then raised NameError in the engine loop. Test covers the unseeded sampler.
1 parent a9206f3 commit f61b5fc

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎jang-tools/jang_tools/dsv41/dspark.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
from __future__ import annotations
2929

30+
import os
3031
import time
3132
from pathlib import Path
3233
from types import SimpleNamespace

‎jang-tools/jang_tools/dsv41/tests/test_spec_sampler.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,11 @@ def test_control_biased_sampler_is_detected():
121121
p = exact()
122122
d = tv(run(Biased, False), p)
123123
assert d > 0.08, d
124+
125+
126+
def test_unseeded_sampler_draws_its_own_seed():
127+
"""A served request without a seed (the app's default at temperature > 0) gets a random per-request seed."""
128+
from jang_tools.dsv41.dspark import SpecSampler
129+
a, b = SpecSampler(1.0), SpecSampler(1.0)
130+
assert isinstance(a.seed, int) and isinstance(b.seed, int)
131+
assert SpecSampler(0.7, top_p=0.9, top_k=20, seed=None).seed >= 0

0 commit comments

Comments
 (0)