From cb1f049e710cf8704ae29811b3058142c7f64840 Mon Sep 17 00:00:00 2001 From: Onur Gündüz Date: Sun, 14 Jun 2026 16:06:18 +0200 Subject: all: add Qwen3-Embedding-4B + fix terminal token --- embed_cli.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'embed_cli.c') diff --git a/embed_cli.c b/embed_cli.c index 06b40de..74071f0 100644 --- a/embed_cli.c +++ b/embed_cli.c @@ -647,7 +647,14 @@ int main(int argc, char *argv[]) e.dim = config->hidden_size; } e.append_terminal_token = config->append_terminal_token; - e.terminal_token_id = config->terminal_token_id; + /* The appended terminal token is the tokenizer's <|endoftext|>, resolved + * like the contextual separator: a vocab that defines it (test models) + * wins; otherwise the released-model family constant applies. */ + if (e.append_terminal_token) { + int eot = qwen_tokenizer_token_id(tok, "<|endoftext|>"); + e.terminal_token_id = + eot >= 0 ? eot : EMBED_CONTEXT_SEPARATOR_TOKEN_ID; + } if (verbose >= 1) fprintf(stderr, "Model: %d-dim, %.0f ms%s\n", e.dim, now_ms() - t0, -- cgit v1.3.1