Archived
radiance 1.11.0
New models: - GLM-5.3-Flash reads pictures: its vision tower and processor (--image-tokens sets the budget), with decode kernels for a few rows and the DSA indexer split over the ranks - Sage-A1.5 (fp8 and MXFP4) with its vision tower and a DFlash2 drafter - Unlimited-OCR (bf16) - Gemma 4 31B with z-lab's DFlash and RedHatAI's DFlash2 drafters; at four cards its all-reduces are fused with the junctions, overlapped with the compute and sent compressed - Ornith-1.5-35B-A3B w4a8 compose files Speed: - Block drafters (DFlash, DFlash2) accept their drafts on the card, and the next step is issued ahead - The four-rank all-reduce is faster for every --tp 4 model - qwen35_w8a8: the norms and SiLU write the int8 linears' operands directly - --attn-prefill-fp8 off|qk|pv|both: fp8 QK and PV legs for the h256 prefill attention (about +20% prefill on a 221K-token prompt for the 27B MXFP4 at TP2); lossy, off by default Features: - Control vectors: --control-vector off|on|disabled (disabled by default), a per-request switch, and the published Qwen3.8-Flash-Next refusal-direction vector (its license is in NOTICE) - Krea 2: the `rebalance` request field, as ComfyUI's ConditioningKrea2Rebalance - Cards with a small PCI BAR run, with kernel arguments kept in host memory - Dashboard: live acceptance figures; statsdump rotates its file at a size cap - KV caches every rank holds whole (GLM-5.3's latent and index caches) take one host-tier slot Fixes: - Long conversations taking turns no longer fall back to an early snapshot: a host-tier restore makes room as memory pressure does and waits a step for the previous turn's release (two conversations of 142K and 147K tokens sent back to back: 31.3 s per turn before, 2.8 s now) - Kernels before Linux 6.16 (amdgpu below 3.64) no longer hang at startup: virtual memory management is turned off there, with a warning - Gemma 4 dense scales its token embeddings as Hugging Face does (bf16), which changes its output - The four-rank all-reduce fences prefill-sized messages, for a rare divergence after a fresh start - GLM-5.3: every refusal names the setting and the reason; its template keeps string content - Several pictures in one request no longer refuse processors that take one image at a time Changes: Plugin ABI 26: out-of-tree plugins must be rebuilt. The environment switches the PRs added are fixed rules or flags now (R4D_ATTN_FP8 is --attn-prefill-fp8).
This commit is contained in:
commit
9eaf10da6e
210 files changed
+14363
-2138
No files matched your search
+129
-16
@@ -240,7 +240,8 @@ const char* kAcceptedCommon[] = {
|
||||
"dry_sequence_breakers", "samplers",
|
||||
"grammar", "json_schema", "priority", "logprobs", "ignore_eos",
|
||||
"timings_per_token", "return_progress", "session_id", "n_probs",
|
||||
"control_vector", "experimental_speed_projection",
|
||||
"control_vector",
|
||||
"ngram_ban_n", "ngram_window", "ngram_whitelist", "no_repeat_ngram_whitelist",
|
||||
};
|
||||
|
||||
const char* kAcceptedChat[] = {
|
||||
@@ -250,6 +251,8 @@ const char* kAcceptedChat[] = {
|
||||
"thinking_token_budget", "thinking_budget", "thinking_budget_tokens",
|
||||
"reasoning_budget_tokens", "reasoning_format", "continue_final_message",
|
||||
"functions", "function_call",
|
||||
/* Unlimited-OCR's picture modes: which of the checkpoint's two a request's pictures get. */
|
||||
"images_config",
|
||||
};
|
||||
|
||||
/* `preserved_tokens` is llama-server's: control tokens a raw completion's text keeps. On chat the
|
||||
@@ -843,19 +846,12 @@ static int parse_sampling(const json& b, const OaiLimits& lim, OaiRequest* r, Ap
|
||||
/* ignore_eos: generate to max_tokens whatever the model emits. See Request::ignore_eos. */
|
||||
if (!get_bool(b, "ignore_eos", &r->ignore_eos, err)) return RAD_E_INVAL;
|
||||
|
||||
/* The control vector (core/cvec.h): an opt-in per request, and the only place an API client
|
||||
* turns it on when the deployment's default is off. `control_vector` is the field's name;
|
||||
* `experimental_speed_projection` is Strata's spelling of the same switch, kept as an alias so
|
||||
* a client written against that reports what it means -- and read only when the request did not
|
||||
* send the field itself, so the field wins when a body carries both. A JSON null is "not sent",
|
||||
* as everywhere else in this parser. */
|
||||
for (const char* key : { "control_vector", "experimental_speed_projection" }) {
|
||||
const auto it = b.find(key);
|
||||
if (it == b.end() || it->is_null()) continue;
|
||||
/* The control vector (core/cvec.h), per request: absent or null takes the deployment's
|
||||
* default. */
|
||||
if (const auto it = b.find("control_vector"); it != b.end() && !it->is_null()) {
|
||||
bool on = false;
|
||||
if (!get_bool(b, key, &on, err)) return RAD_E_INVAL;
|
||||
if (!get_bool(b, "control_vector", &on, err)) return RAD_E_INVAL;
|
||||
r->control_vector = on ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* stop: a string or an array of strings. Bounded in count and length because every stop
|
||||
@@ -907,6 +903,95 @@ static int parse_sampling(const json& b, const OaiLimits& lim, OaiRequest* r, Ap
|
||||
auto sid = b.find("session_id");
|
||||
if (sid != b.end() && sid->is_string()) r->session_label = session_label_of(sid->get<std::string>());
|
||||
|
||||
/* The windowed no-repeat-ngram ban (core/sample/sampler.h): `ngram_ban_n` is the banned
|
||||
* n-gram's length and `ngram_window` how far back it looks; the checkpoint's own generation
|
||||
* config asks for 35 and 128 (Unlimited-OCR). The reference spells them
|
||||
* no_repeat_ngram_size and no_repeat_ngram_window_size; both are taken. */
|
||||
i64 = r->sp.ngram_ban_n;
|
||||
if (!get_any(b, { "ngram_ban_n", "no_repeat_ngram_size" }, &i64, nullptr, err))
|
||||
return RAD_E_INVAL;
|
||||
if (i64 < 0 || i64 > 256) {
|
||||
*err = err_bad("ngram_ban_n", "must be in [0, 256]");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
r->sp.ngram_ban_n = (int)i64;
|
||||
i64 = r->sp.ngram_window;
|
||||
if (!get_any(b, { "ngram_window", "no_repeat_ngram_window_size" }, &i64, nullptr, err))
|
||||
return RAD_E_INVAL;
|
||||
if (i64 < 0 || i64 > 131072) {
|
||||
/* The reference's negative window spelling belongs to generation_config, where it is
|
||||
* normalized to 0; a request states the whole-sequence form as 0, matching the sampler's
|
||||
* admission check (check_request refuses a negative window). */
|
||||
*err = err_bad("ngram_window", "must be 0 (search the whole sequence) or a count of at "
|
||||
"most 131072 history tokens");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
r->sp.ngram_window = (int)i64;
|
||||
|
||||
/* The ban's whitelist (the reference's `whitelist_token_ids`, which is removed from the
|
||||
* banned set before the -inf writes): token ids the ban must never touch. An array of
|
||||
* non-negative integers; absent, empty or null is off, the reference's empty whitelist and
|
||||
* the form the model's generation_config ships. */
|
||||
auto nwl = b.find("ngram_whitelist");
|
||||
if (nwl == b.end()) nwl = b.find("no_repeat_ngram_whitelist");
|
||||
if (nwl != b.end() && !nwl->is_null()) {
|
||||
if (!nwl->is_array()) {
|
||||
*err = err_bad("ngram_whitelist", "expected an array of integer token ids");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
std::vector<int32_t> wl;
|
||||
for (const auto& v : *nwl) {
|
||||
int32_t id = 0;
|
||||
if (!token_id(v, &id)) {
|
||||
*err = err_bad("ngram_whitelist",
|
||||
"expected token ids in [0, " + std::to_string(INT32_MAX) + "]");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
if (wl.size() >= (size_t)1 << 20) {
|
||||
*err = err_bad("ngram_whitelist", "at most 1048576 ids");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
wl.push_back(id);
|
||||
}
|
||||
r->sp.ngram_whitelist = std::move(wl);
|
||||
}
|
||||
|
||||
/* `images_config`: Unlimited-OCR's two picture modes. A string names one ("gundam" for a
|
||||
* single picture -- the global view plus crops --, "base" for a page of a multi-page
|
||||
* document); an object carries the reference runner's own dict. */
|
||||
auto ic = b.find("images_config");
|
||||
if (ic != b.end() && !ic->is_null()) {
|
||||
if (ic->is_string()) {
|
||||
const std::string m = ic->get<std::string>();
|
||||
if (m == "gundam") r->image_mode = 1;
|
||||
else if (m == "base") r->image_mode = 2;
|
||||
else if (!m.empty()) {
|
||||
*err = err_bad("images_config", "expected \"gundam\" or \"base\", got \"" + m +
|
||||
"\"");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
} else if (ic->is_object()) {
|
||||
const json& o = *ic;
|
||||
int64_t bs = 0, is = 0;
|
||||
if (!get_int(o, "base_size", &bs, err)) return RAD_E_INVAL;
|
||||
if (!get_int(o, "image_size", &is, err)) return RAD_E_INVAL;
|
||||
bool crop = true;
|
||||
if (!get_bool(o, "crop_mode", &crop, err)) return RAD_E_INVAL;
|
||||
if (bs < 0 || bs > 65536 || is < 0 || is > 65536) {
|
||||
*err = err_bad("images_config", "base_size and image_size must be in [0, 65536]");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
r->image_mode = crop ? 1 : 2;
|
||||
r->image_base_size = (int32_t)bs;
|
||||
r->image_size = (int32_t)is;
|
||||
} else {
|
||||
*err = err_bad("images_config",
|
||||
"expected \"gundam\", \"base\", or an object with base_size, "
|
||||
"image_size and crop_mode");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
}
|
||||
|
||||
RAD_TRY(apply_sampler_order(b, &r->sp, err));
|
||||
|
||||
auto so = b.find("stream_options");
|
||||
@@ -1488,6 +1573,15 @@ int tokenize_with_media(const std::string& rendered, const OaiDeps& d,
|
||||
out->text = rendered;
|
||||
auto pm = std::make_shared<mm::PromptMedia>();
|
||||
const std::string marker = RAD_MEDIA_MARKER;
|
||||
/* Whether the request carries several pictures: a processor with a multi-page mode picks it
|
||||
* for a picture whose mode the request did not name (mm::ImageMode::several). */
|
||||
size_t n_images = 0;
|
||||
for (const auto& m : media) n_images += m.first == MediaKind::Image ? 1 : 0;
|
||||
auto opts_for = [&](MediaKind k) {
|
||||
MediaOpts mo = opts;
|
||||
if (k == MediaKind::Image) mo.several_pictures = n_images > 1;
|
||||
return mo;
|
||||
};
|
||||
size_t pos = 0, mi = 0;
|
||||
for (;;) {
|
||||
size_t at = rendered.find(marker, pos);
|
||||
@@ -1507,7 +1601,8 @@ int tokenize_with_media(const std::string& rendered, const OaiDeps& d,
|
||||
}
|
||||
std::shared_ptr<mm::Item> item;
|
||||
std::string why;
|
||||
const int s = d.mm->prepare(media[mi].first, media[mi].second, opts, &item, &why);
|
||||
const int s = d.mm->prepare(media[mi].first, media[mi].second, opts_for(media[mi].first),
|
||||
&item, &why);
|
||||
if (s < 0 || !item) {
|
||||
*err = err_bad("messages[].content[]", "the media could not be used: " +
|
||||
(why.empty() ? std::string(rad_strerror(s))
|
||||
@@ -2069,12 +2164,30 @@ int parse_chat_request(const std::string& body, const OaiDeps& d, const OaiLimit
|
||||
|
||||
PromptInput p;
|
||||
if (media.empty()) {
|
||||
/* add_special is false: the template renders the model's special tokens, BOS included;
|
||||
* another would shift every position. */
|
||||
/* add_special is false: the template renders the model's special tokens; BOS is placed
|
||||
* below. */
|
||||
p.tokens = d.tok->encode(rendered, false, /*parse_special=*/true);
|
||||
p.text = rendered;
|
||||
} else {
|
||||
RAD_TRY(tokenize_with_media(rendered, d, media, MediaOpts{}, &p, err));
|
||||
MediaOpts mo;
|
||||
mo.image_mode = out->image_mode;
|
||||
mo.image_base_size = out->image_base_size;
|
||||
mo.image_size = out->image_size;
|
||||
RAD_TRY(tokenize_with_media(rendered, d, media, mo, &p, err));
|
||||
}
|
||||
/* A tokenizer that states add_bos gets exactly one BOS in front. The render drops a BOS the
|
||||
* template writes when add_bos is set (ChatTemplate, as llama.cpp's chat does, which leaves it
|
||||
* to the tokenizer), and some templates never write one, so it is added here unless the
|
||||
* prompt already starts with it. A media run's placeholders shift by one with it. */
|
||||
{
|
||||
const ITokenizer::VocabInfo vi = d.tok->vocab_info();
|
||||
if (vi.add_bos && vi.bos >= 0 && (p.tokens.empty() || p.tokens.front() != vi.bos)) {
|
||||
p.tokens.insert(p.tokens.begin(), vi.bos);
|
||||
if (p.media) {
|
||||
for (auto& pl : p.media->items) pl.tok += 1;
|
||||
p.media->layout();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p.tokens.empty()) {
|
||||
*err = err_bad("messages", "the rendered prompt tokenised to nothing");
|
||||
|
||||
Reference in new issue
Block a user