Files
zeekayandHanzo Dev 6a363f7ee3 merge: upstream main ddf1b879 and the aarch64 repack branch 35d7ae7c
Three-way per file through the rename: base 39355c6c91, theirs the upstream
merge of main with 35d7ae7c (via 7ef6a694d), ours origin/main.

Lands the barrier thread pool, runtime CPU feature dispatch, aarch64 and x86
repacked quantized kernels (indexed_gemv, gemv_fused_shared_lhs), quantized
embedding on CPU/Metal/CUDA, paged flash-attn kernels, cutile fused MoE, the
in-place op aliasing API, parking_lot storage locks, Metal buffer builders and
debug labels, safetensors 0.8, hf-hub 1.0, tokenizers 0.23.

Ours keeps ROCm, Vulkan, wgpu, the IQ/MXFP4/NVFP4/TQ dtypes, and the i-quant
weight/activation block split in matmul. Our backends ride InplaceOpN and the
quantized embedding; Metal get_rows gains the IQ kernels. ug leaves, as upstream.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-15 15:52:28 -07:00
..
2026-01-16 12:30:55 -08:00

hanzo-ml-distilbert

DistilBert is a distiled version of the Bert model.

Sentence embeddings

DistilBert is used to compute the sentence embeddings for a prompt. The model weights are downloaded from the hub on the first run.

$ cargo run --example distilbert --release -- --prompt "Here is a test sentence"

> [[[ 0.5109,  0.1280, -0.2635, ...,  0.3462, -1.0434,  0.1441],
>   [ 0.1735,  0.0818, -0.5549, ...,  0.3472, -0.8264, -0.0244],
>   [ 0.0702, -0.1311, -0.4914, ...,  0.3483, -0.6194,  0.1829],
>   ...
>   [ 0.2993, -0.0106, -0.4640, ...,  0.2844, -0.6732,  0.0042],
>   [ 0.1066, -0.0081, -0.4299, ...,  0.3435, -0.7729,  0.0190],
>   [ 0.8903,  0.2055, -0.2541, ...,  0.3208, -0.6585,  0.0586]]]
> Tensor[[1, 7, 768], f32]

Masked Token

DistilBert is used to compute the top K choices for a masked token.

$ cargo run --example distilbert -- --prompt "The capital of France is [MASK]." --top-k 10

> Input: The capital of France is [MASK].
> Predictions for [MASK] at position 6:
>   1: marseille       (probability: 12.14%)
>   2: paris           (probability: 10.84%)
>   3: toulouse        (probability: 8.57%)
>   4: lyon            (probability: 7.61%)
>   5: montpellier     (probability: 5.18%)
>   6: bordeaux        (probability: 4.88%)
>   7: nantes          (probability: 4.82%)
>   8: lille           (probability: 4.07%)
>   9: strasbourg      (probability: 3.12%)
>   10: cannes          (probability: 3.04%)