EvSys

_AsyncToSyncSampler

Sync :class:~evsys_sdk.protocols.InferenceClient over an async :class:~evsys_sdk.training.backend.SamplingClient.

.generate(prompt=...) is called sequentially by :meth:Benchmark.score from a worker thread; we route the awaited sample_async call back to the main event loop via :func:asyncio.run_coroutine_threadsafe so the inner async work runs on the loop that owns the live training client.

Exposes _tokenizer so :class:ChatTemplatedInference can wrap this client without further plumbing - same shape :class:TinkerInference exposes.

Attributes

attributenamestr
= 'in_loop_sampler'

Functions

func__init__(self, sampler, tokenizer, loop) -> None
paramself
paramsamplerAny
paramtokenizerAny
paramloopasyncio.AbstractEventLoop

Returns

None
funcgenerate(self, *, prompt, max_tokens=256, temperature=0.0, stop=None) -> str
paramself
parampromptstr
parammax_tokensint
= 256
paramtemperaturefloat
= 0.0
paramstoplist[str] | None
= None

Returns

str
func_decode(self, response) -> str
paramself
paramresponseAny

Returns

str

On this page