Python · Quickstart

Quickstart

4.0.0-rc.1 · 3ee5e534

import numpy as np
import uform

executor = uform.Executor.for_ram()  # The threads every receiver names
arena = uform.Arena(executor)  # The memory outputs land in, made where the executor computes
model = uform.Model.load_ram("model.safetensors", quantization=uform.Scalar.BF16)

encoded = model.on(executor).text_encode(["a cat on a mat", "a dog in the fog"], arena)
embeddings = np.asarray(encoded.embeddings)  # (2, dimensions) float32, zero-copy
assert embeddings.shape == (2, model.describe().dimensions)