Archived
radiance 2.0.0
Radiance becomes a multi-model engine: one process serves several models behind one port, loads each when a request names it, parks it in host memory or restores it from its container, and shares the cards between them (docs/MULTIMODEL.md). The configuration is one YAML file; the command line flags are gone (`radiance --config FILE`, hot reload on SIGHUP). Formats. IQ8R (rotated int8) and IQR-V4 replace FP8 and MXFP4 as whole-model formats, with an int8 KV cache (`kv-cache-dtype: i8`) in place of the fp8 one. Containers whose weights are block FP8, MXFP4, M2XFP4, NVFP4 or ParoQuant are refused at startup by the name of the first such weight. Not served until they have int8 containers: GLM-5.3-Flash, Ornith-1.5, Sage-A1.5, Nemotron-3.5-Bolt-74B, Ling-3.0-flash, drama-3 and Anima's FP8 container; Nemotron-3.5-Bolt-E4B, the Gemma 4 31B DFlash containers and MiniCPM5-2B bf16 serve without their drafter. 1.17.0 serves all of them. Speed. Chained launches for Qwen3.8-27B, Gemma 4, Gemma 3 and the small bf16 models, a new Qwen3.8-Flash-Next container (IQR-V4 experts, int8 trunk) with its decode step and prefill reworked, and a reworked adaptive draft window. Deployment. deploy/compose has two fleet files, tp1.yaml and tp2.yaml, each with its configuration beside it, in place of the per-model files. `host-pool-mib` is a model's host pool in all, split among its ranks. The dashboard is rebuilt: an hour of history kept by the server, each accelerator's memory by model, model states over time. Merged since 1.17.0: Nemotron-3.5-Bolt-74B-A9B by keptn42 (#339); GLM-5.3-Flash on four cards by AnimusNull (#397); chained launches for Flash-Next's decode step (#396) and preempted requests keeping their prefix and place (#405) by mici81; --prefill-interleave auto by Code000 (#410); eight more libr3d kernels and the w4a4 reference by RikshaDriver (#403, #407, #408); libr3d large-BAR and E4M3 decode fixes by neuromanMD (#438, #439); int4/int5 decode tiles by Kezi (#426); attention for Nanbeige 4.3 33B by everplays (#417); expert_stats_report.py by baKon (#431). Fixed: #398, #402, #419, #437 (dschmitz's patch); added the metrics of #392, and multi-model serving as asked for in #367 and #109. Plugin ABI 39: out-of-tree plugins need to be rebuilt. Thanks to @keptn42, @AnimusNull, @mici81, @Code000, @RikshaDriver, @neuromanMD, @Kezi, @everplays, @baKon and @dschmitz.
This commit is contained in:
1 parent
b4c04b6042
commit
ddcb9c69bb
696 files changed
+120770
-56596
No files matched your search
Vendored
+151
-71
@@ -2,12 +2,12 @@
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "util/json.h"
|
||||
|
||||
#include <string>
|
||||
#include <regex>
|
||||
|
||||
using json = nlohmann::ordered_json;
|
||||
using json = rad::Json;
|
||||
|
||||
enum common_json_stack_element_type {
|
||||
COMMON_JSON_STACK_ELEMENT_OBJECT,
|
||||
@@ -36,84 +36,164 @@ bool common_json_parse(
|
||||
const std::string & healing_marker,
|
||||
common_json & out)
|
||||
{
|
||||
// // https://json.nlohmann.me/features/parsing/sax_interface/
|
||||
struct json_error_locator : public nlohmann::json_sax<json> {
|
||||
std::size_t position;
|
||||
bool found_error;
|
||||
std::string last_token;
|
||||
std::string exception_message;
|
||||
// What the healing below needs from a failed parse: where it stopped and which
|
||||
// containers (and object key) were still open there. This was a SAX walk
|
||||
// before the DOM swap; a small scanner over the (usually truncated) input produces the
|
||||
// same stack and cut point. It only ever runs on text json::parse has already refused,
|
||||
// and every healing candidate is re-parsed before it is believed, so the scanner tracks
|
||||
// structure, not validity in the small (number and literal spellings are consumed, not
|
||||
// checked).
|
||||
struct json_error_locator {
|
||||
std::size_t position = 0;
|
||||
bool found_error = false;
|
||||
std::vector<common_json_stack_element> stack;
|
||||
|
||||
json_error_locator() : position(0), found_error(false) {}
|
||||
|
||||
bool parse_error(std::size_t position, const std::string & last_token, const json::exception & ex) override { // NOLINT
|
||||
this->position = position - 1;
|
||||
this->found_error = true;
|
||||
this->last_token = last_token;
|
||||
this->exception_message = ex.what();
|
||||
return false;
|
||||
}
|
||||
void close_value() {
|
||||
if (!stack.empty() && (stack.back().type == COMMON_JSON_STACK_ELEMENT_KEY)) {
|
||||
stack.pop_back();
|
||||
}
|
||||
}
|
||||
bool null() override { // NOLINT
|
||||
close_value();
|
||||
return true;
|
||||
}
|
||||
bool boolean(bool) override { // NOLINT
|
||||
close_value();
|
||||
return true;
|
||||
}
|
||||
bool number_integer(number_integer_t) override { // NOLINT
|
||||
close_value();
|
||||
return true;
|
||||
}
|
||||
bool number_unsigned(number_unsigned_t) override { // NOLINT
|
||||
close_value();
|
||||
return true;
|
||||
}
|
||||
bool number_float(number_float_t, const string_t &) override { // NOLINT
|
||||
close_value();
|
||||
return true;
|
||||
}
|
||||
bool string(string_t &) override { // NOLINT
|
||||
close_value();
|
||||
return true;
|
||||
}
|
||||
bool binary(binary_t &) override { // NOLINT
|
||||
close_value();
|
||||
return true;
|
||||
}
|
||||
bool start_object(std::size_t) override { // NOLINT
|
||||
stack.push_back({COMMON_JSON_STACK_ELEMENT_OBJECT, ""});
|
||||
return true;
|
||||
}
|
||||
bool end_object() override {
|
||||
GGML_ASSERT(!stack.empty() && stack.back().type == COMMON_JSON_STACK_ELEMENT_OBJECT);
|
||||
stack.pop_back();
|
||||
close_value();
|
||||
return true;
|
||||
}
|
||||
bool key(string_t & key) override { // NOLINT
|
||||
stack.push_back({COMMON_JSON_STACK_ELEMENT_KEY, key});
|
||||
return true;
|
||||
}
|
||||
bool start_array(std::size_t) override { // NOLINT
|
||||
stack.push_back({COMMON_JSON_STACK_ELEMENT_ARRAY, ""});
|
||||
return true;
|
||||
}
|
||||
bool end_array() override {
|
||||
GGML_ASSERT(!stack.empty() && stack.back().type == COMMON_JSON_STACK_ELEMENT_ARRAY);
|
||||
stack.pop_back();
|
||||
close_value();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
json_error_locator err_loc;
|
||||
auto start = it;
|
||||
json::sax_parse(it, end, &err_loc);
|
||||
{
|
||||
const std::string text(it, end);
|
||||
const char * s = text.data();
|
||||
const size_t n = text.size();
|
||||
size_t i = 0;
|
||||
struct scan_stop {};
|
||||
auto fail = [&](size_t at) {
|
||||
err_loc.found_error = true;
|
||||
err_loc.position = at;
|
||||
throw scan_stop{};
|
||||
};
|
||||
std::function<void()> skip_ws = [&]() {
|
||||
while (i < n && (s[i] == ' ' || s[i] == '\n' || s[i] == '\r' || s[i] == '\t')) {
|
||||
++i;
|
||||
}
|
||||
};
|
||||
std::function<bool()> scan_string = [&]() {
|
||||
++i; // opening quote
|
||||
while (true) {
|
||||
if (i >= n) fail(n);
|
||||
const char c = s[i];
|
||||
if (c == '"') {
|
||||
++i;
|
||||
return true;
|
||||
}
|
||||
if (c == '\\') {
|
||||
++i;
|
||||
if (i >= n) fail(n);
|
||||
if (s[i] == 'u') {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
++i;
|
||||
if (i >= n || !std::isxdigit((unsigned char) s[i])) fail(i >= n ? n : i);
|
||||
}
|
||||
}
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if ((unsigned char) c < 0x20) fail(i);
|
||||
++i;
|
||||
}
|
||||
};
|
||||
std::function<void(int)> scan_value = [&](int depth) {
|
||||
if (depth > 512) fail(i);
|
||||
skip_ws();
|
||||
if (i >= n) fail(n);
|
||||
const char c = s[i];
|
||||
if (c == '{') {
|
||||
++i;
|
||||
err_loc.stack.push_back({COMMON_JSON_STACK_ELEMENT_OBJECT, ""});
|
||||
skip_ws();
|
||||
if (i < n && s[i] == '}') {
|
||||
++i;
|
||||
err_loc.stack.pop_back();
|
||||
err_loc.close_value();
|
||||
return;
|
||||
}
|
||||
while (true) {
|
||||
skip_ws();
|
||||
if (i >= n) fail(n);
|
||||
if (s[i] != '"') fail(i);
|
||||
scan_string();
|
||||
err_loc.stack.push_back({COMMON_JSON_STACK_ELEMENT_KEY, ""});
|
||||
skip_ws();
|
||||
if (i >= n) fail(n);
|
||||
if (s[i] != ':') fail(i);
|
||||
++i;
|
||||
scan_value(depth + 1);
|
||||
skip_ws();
|
||||
if (i >= n) fail(n);
|
||||
if (s[i] == ',') {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if (s[i] == '}') {
|
||||
++i;
|
||||
err_loc.stack.pop_back();
|
||||
err_loc.close_value();
|
||||
return;
|
||||
}
|
||||
fail(i);
|
||||
}
|
||||
}
|
||||
if (c == '[') {
|
||||
++i;
|
||||
err_loc.stack.push_back({COMMON_JSON_STACK_ELEMENT_ARRAY, ""});
|
||||
skip_ws();
|
||||
if (i < n && s[i] == ']') {
|
||||
++i;
|
||||
err_loc.stack.pop_back();
|
||||
err_loc.close_value();
|
||||
return;
|
||||
}
|
||||
while (true) {
|
||||
scan_value(depth + 1);
|
||||
skip_ws();
|
||||
if (i >= n) fail(n);
|
||||
if (s[i] == ',') {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if (s[i] == ']') {
|
||||
++i;
|
||||
err_loc.stack.pop_back();
|
||||
err_loc.close_value();
|
||||
return;
|
||||
}
|
||||
fail(i);
|
||||
}
|
||||
}
|
||||
if (c == '"') {
|
||||
scan_string();
|
||||
err_loc.close_value();
|
||||
return;
|
||||
}
|
||||
if (c == '-' || (c >= '0' && c <= '9')) {
|
||||
while (i < n && (std::isdigit((unsigned char) s[i]) || s[i] == '-' || s[i] == '+' ||
|
||||
s[i] == '.' || s[i] == 'e' || s[i] == 'E')) {
|
||||
++i;
|
||||
}
|
||||
err_loc.close_value();
|
||||
return;
|
||||
}
|
||||
if (std::isalpha((unsigned char) c)) {
|
||||
while (i < n && std::isalpha((unsigned char) s[i])) {
|
||||
++i;
|
||||
}
|
||||
err_loc.close_value();
|
||||
return;
|
||||
}
|
||||
fail(i);
|
||||
};
|
||||
try {
|
||||
scan_value(0);
|
||||
skip_ws();
|
||||
if (i < n) fail(i);
|
||||
} catch (const scan_stop &) {
|
||||
}
|
||||
}
|
||||
|
||||
if (err_loc.found_error) {
|
||||
it = start;
|
||||
@@ -318,7 +398,7 @@ bool common_json_parse(
|
||||
}
|
||||
return false;
|
||||
}
|
||||
out.json = json::parse(it, end);
|
||||
out.json = json::parse(std::string(it, end));
|
||||
it = end;
|
||||
return true;
|
||||
}
|
||||
Reference in new issue
Block a user