Archived
nomicbert: architecture plugin for nomic-embed-text-v2-moe
Post-norm encoder with fused Wqkv and biases, NeoX rotary, non-causal attention, a dense MLP on even layers and a top-2 of 8 expert MLP on odd layers, mean pooling into the pooled f32 buffer for /v1/embeddings. The checkpoint is f32; data/recipes/nomic-embed-v2-moe-bf16.recipe casts the linears, the token embedding and the token-type table to bf16 (the device kernels read bf16), norms and biases stay f32. The checkpoint's shared experts.bias is not applied: against a llama.cpp run of the same checkpoint at Q8_0 the variant without it matches best (cosine 0.9994; the others 0.9990 to 0.9993), and llama.cpp's own nomic-bert-moe does not carry it. Verified on a gfx1201 card and on libavx/libref against a pure-float32 torch reference: mean cosine 0.99995, min 0.99983 over 20 texts. Unit tests declare and lint a cut-down model. Not verified: inputs above 512 tokens against a reference on the device, other quantisations.
This commit is contained in:
1 parent
4853db97db
commit
fd40bb430c
8 files changed
+865
-4
No files matched your search
+11
-3
@@ -281,6 +281,7 @@ and runs.
|
||||
| `gemma4_bf16` | Gemma 4 dense in bf16, with its vision tower |
|
||||
| `lfm2_bf16` | LiquidAI LFM2 and LFM2-VL in bf16, including d1 (§5.13) |
|
||||
| `embgemma2` | EmbeddingGemma 2, an embedding model (§5.6) |
|
||||
| `nomicbert` | nomic-embed-text-v2-moe, an embedding model (§5.6) |
|
||||
| `qwenimage21` | Qwen-Image 2.1 and 2.1-Turbo, an image model (§5.6) |
|
||||
| `krea2` | Krea 2 Raw and Turbo, an image model from text (§5.6) |
|
||||
| `anima` | Anima Base, Aesthetic and Turbo, an anime and illustration image model from text (§5.6) |
|
||||
@@ -2233,9 +2234,16 @@ token ids mixed, with its `add_special` and `parse_special` and their defaults);
|
||||
returns `tokens` as llama-server does, as `{id, piece}` objects with `with_pieces`. `/detokenize`
|
||||
returns the text as both `prompt` (vLLM) and `content` (llama-server).
|
||||
|
||||
**An embedding model** (EmbeddingGemma 2) serves `/v1/embeddings` only; completions and chat answer
|
||||
501. One input is one vector and must fit one step (`--max-num-batched-tokens`); a longer one is
|
||||
refused with `context_length_exceeded`.
|
||||
**An embedding model** (EmbeddingGemma 2, nomic-embed-text-v2-moe) serves `/v1/embeddings` only;
|
||||
completions and chat answer 501. One input is one vector and must fit one step
|
||||
(`--max-num-batched-tokens`); a longer one is refused with `context_length_exceeded`.
|
||||
|
||||
nomic-embed-text-v2-moe is converted from its f32 checkpoint with `rad-convert <checkpoint dir>
|
||||
--recipe data/recipes/nomic-embed-v2-moe-bf16.recipe -o nomic-embed-v2-moe-bf16.rad` (959 MB);
|
||||
the directory must contain `tokenizer.json`. The `search_query: ` and `search_document: ` prefixes
|
||||
are the client's text and the engine adds neither; the checkpoint's prompt names work through
|
||||
`prompt_name`. The checkpoint's shared `experts.bias` tensors are not applied and stay in the
|
||||
checkpoint.
|
||||
|
||||
```sh
|
||||
# text, a batch of texts, or token ids
|
||||
|
||||
Reference in new issue
Block a user