Views
No views yet
buckets-64-128-256-512.mlpackage # seq_64, seq_128, seq_256, seq_512
tokenizer.json
config.json
1_Pooling/config.json(input_ids, attention_mask) -> last_hidden_state) is in
CoreML; tokenization, prefixing, mean pooling and L2 normalization stay in the host
application. Output matches the reference f32 path to fp16 rounding — measured
1 - cosine of 5.2e-6 (median over Japanese and English texts up to 512 tokens).macOS15 / iOS 18 opsets.--features coreml.
Earlier versions look for seq-<N>.mlpackage and will not find anything here.1kohagi --device coreml --coreml-model-id takahashim/ruri-v3-130m-coreml \
2 --prefix "検索文書: " < texts.jsonl~/Library/Caches/kohagi/coreml, so later
runs start in well under a second.kohagi --device coreml converts cl-nagoya/ruri-v3-130m itself and caches the result. This repo
is the shortcut — 260 MB of converted model against 503 MB of safetensors plus a
20-second conversion.input_ids and attention_mask ([1, N] int32) and returns
hidden ([1, N, 512] fp16). Pick the function by name and pad to its length.1import coremltools as ct, numpy as np
2m = ct.models.MLModel("buckets-64-128-256-512.mlpackage", function_name="seq_128")
3ids = np.zeros((1, 128), np.int32); ids[0, :n] = token_ids
4mask = np.zeros((1, 128), np.int32); mask[0, :n] = 1
5hidden = m.predict({"input_ids": ids, "attention_mask": mask})["hidden"][0] # (128, 512)
6vec = (hidden * mask[0, :, None]).sum(0) / mask.sum()
7vec /= np.linalg.norm(vec)"検索文書: " for documents, "検索クエリ: " for
queries — prepended to the text before tokenizing.CPU_AND_NE.cl-nagoya/ruri-v3-130m
(revision e3114c6).coreml-convert).