class Mood(IntEnum) Values
PARKED | 0 | |
|---|---|---|
SPINNING | 1 |
A receiver carries what every C argument structure puts before its inputs: the executor and the completion.
The model runs a verb on the calling thread, model.on(executor) answers a uform.On whose verbs block on that executor, and model.deferred(executor) answers a uform.DeferredOn whose verbs submit there and answer a uform.Deferred.
The receiver’s type alone chooses the completion, so all three offer the same verbs with the same arguments.
In a coroutine, await a deferred call; anywhere else, wait() blocks the thread with its state detached:
call = model.deferred(executor).image_encode(files, uform.Arena(executor))
encoded = await call # or: call.wait()call.status polls without waiting, reading Status.DEFERRED until the call is final.
Dropping a Deferred waits for its call first, since the library still reads the inputs it holds.
A trainer runs step and save blocking on the executor it was created on, and trainer.on(...) and trainer.deferred(...) choose another completion.
MoodWhat an executor does once it goes idle, valued as uform_mood_t: sleep, or keep polling.DeferredA call a DeferredOn submitted: await it, or wait() for it; dropping it waits.4class Deferred[AnswerT] __class_getitem__Names what wait() answers, as Deferred[Encoded].def __class_getitem__(item: Any, /) -> GenericAlias waitBlocks until the call is final, then answers or raises.__await__Runs wait() on the running event loop's default executor, suspending the task meanwhile.def __await__() -> Generator[Any, None, AnswerT] statusStatus.DEFERRED until the call is final, then the final one.OnA model or trainer bound to the executor its verbs block on, as model.on(executor) answers it.6class On[TargetT] __class_getitem__Names the target the receiver addresses, as On[Model].def __class_getitem__(item: Any, /) -> GenericAlias *× 6*_encode× 8def text_encode(
texts: _Texts,
arena: Arena,
/,
*,
outputs: Outputs = ...,
outputs_scalar: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
stats: TextEncodeStats | None = None,
) -> Encoded | Symbol |
|---|
text_encode |
image_encode |
video_encode |
audio_encode |
text_encode |
image_encode |
video_encode |
audio_encode |
image_encode_*_encode_pixels× 2def image_encode__encode_pixels(
pixels: Sequence[Buffer],
arena: Arena,
/,
*,
outputs: Outputs = ...,
outputs_scalar: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
stats: ImageEncodeStats | None = None,
) -> Encoded audio_encode_*_encode_samples× 2def audio_encode__encode_samples(
samples: Sequence[Buffer] | _Tape,
sample_rate: int,
arena: Arena,
/,
*,
outputs: Outputs = ...,
outputs_scalar: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
stats: AudioEncodeStats | None = None,
) -> Encoded text_*_choose× 2def text__choose(
texts: _Texts,
choices: _Texts,
arena: Arena,
/,
*,
temperature_groups: _Words | None = None,
progress: _Progress | None = None,
progress_steps: int = 0,
stats: TextEncodeStats | None = None,
) -> RowsTape DeferredOnA model or trainer bound to the executor its verbs submit to, each answering a Deferred at once.1class DeferredOn[TargetT] __class_getitem__Names the target the receiver addresses, as DeferredOn[Model].def __class_getitem__(item: Any, /) -> GenericAlias