class ModelDescription(structseq[Any], tuple[int, int, Scalar, int, CPUClass | None, GPUClass | None, int, int]) uform.Model.load_ram(path) and uform.Model.load_vram(path, devices=[0]) copy a safetensors checkpoint into host memory or onto GPUs, and load_ram_buffer and load_vram_buffer take the checkpoint’s bytes instead.
Each takes quantization, Scalar.BF16 as stored or Scalar.E4M3 quantized at load, an optional executor the load runs on, and a progress handler.
The RAM loads take a cpu_class pin and the VRAM loads a gpu_class pin, and a class the hardware cannot run raises UnsupportedError. model.describe() answers a uform.ModelDescription of dimensions, context, quantization, memory_usage, cpu_class, gpu_class, token_width and choice_temperature_groups.
API
ClassModelDescriptionWhat a loaded model reports about itself, as uform_model_description_t holds it.8
dimensionsScalars per embedding row; Matryoshka prefixes of it are embeddings too.
dimensions: int contextTokens one item may span before it is truncated.
context: int quantizationThe scalar the transformer blocks run in.
quantization: Scalar memory_usageBytes the model holds; activations are the executor's.
memory_usage: int cpu_classThe class a RAM model was packed for, or None for a VRAM model.
cpu_class: CPUClass | None gpu_classThe class every replica of a VRAM model runs as, or None for a RAM model.
gpu_class: GPUClass | None token_widthScalars per token vector; 0 when the checkpoint carries no token head.
token_width: int choice_temperature_groupsQuestion types text_choose was calibrated over: 0 without the byte decoder, 1 when uncalibrated.
choice_temperature_groups: int ClassModelA loaded encoder serving every modality it was trained on; the receiver chooses where its verbs run.14
class Model load_ramCopies a checkpoint into host memory.
@classmethod
def load_ram(
path: _PathLike,
/,
*,
memory_domains: Sequence[int] | None = None,
cpu_class: CPUClass | None = None,
executor: Executor | None = None,
quantization: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
) -> Model Calls uform_model_load_ram.
load_ram_bufferCopies a checkpoint held in memory into host memory.
@classmethod
def load_ram_buffer(
buffer: Buffer,
/,
*,
memory_domains: Sequence[int] | None = None,
cpu_class: CPUClass | None = None,
executor: Executor | None = None,
quantization: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
) -> Model Calls uform_model_load_ram_buffer.
load_vramCopies a checkpoint onto the named GPUs.
@classmethod
def load_vram(
path: _PathLike,
/,
*,
devices: Sequence[int] | None = None,
gpu_class: GPUClass | None = None,
executor: Executor | None = None,
quantization: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
) -> Model Calls uform_model_load_vram.
load_vram_bufferCopies a checkpoint held in host memory onto the named GPUs.
@classmethod
def load_vram_buffer(
buffer: Buffer,
/,
*,
devices: Sequence[int] | None = None,
gpu_class: GPUClass | None = None,
executor: Executor | None = None,
quantization: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
) -> Model Calls uform_model_load_vram_buffer.
onA receiver whose verbs block on executor.
deferredA receiver whose verbs submit to executor and answer a Deferred.
describeThe model's geometry and placement.
text_encodeEncodes UTF-8 texts, a byte per token.
def text_encode(
texts: _Texts,
arena: Arena,
/,
*,
outputs: Outputs = ...,
outputs_scalar: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
stats: TextEncodeStats | None = None,
) -> Encoded Calls uform_text_encode.
image_encodeDecodes and encodes JPEG, PNG or WebP files.
def image_encode(
files: _Files,
arena: Arena,
/,
*,
outputs: Outputs = ...,
outputs_scalar: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
stats: ImageEncodeStats | None = None,
) -> Encoded Calls uform_image_encode.
image_encode_pixelsEncodes [height, width, 3] uint8 images.
def image_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 Calls uform_image_encode_pixels.
video_encodeDecodes and encodes MP4 or WebM clips.
def video_encode(
files: _Files,
arena: Arena,
/,
*,
outputs: Outputs = ...,
outputs_scalar: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
stats: VideoEncodeStats | None = None,
) -> Encoded Calls uform_video_encode.
audio_encodeDecodes and encodes WAV, FLAC, MP3 or Opus recordings.
def audio_encode(
files: _Files,
arena: Arena,
/,
*,
outputs: Outputs = ...,
outputs_scalar: Scalar = ...,
progress: _Progress | None = None,
progress_steps: int = 0,
stats: AudioEncodeStats | None = None,
) -> Encoded Calls uform_audio_encode.
audio_encode_samplesEncodes 1-D float32 mono recordings.
def audio_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 Calls uform_audio_encode_samples.
text_chooseScores each text's single-byte choices, one probability each.
def 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 Calls uform_text_choose.