Archived
radiance 1.7.0
- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves every shipped container - Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime - /v1/messages works with Claude Code as it ships (gearwave00001) - a long agent conversation keeps its cached history when the client rewrites its last turn (manueloverride) - a stream's first event goes out with the first token, so llama-benchy measures prefill right - opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42) - four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b) - NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA adapters (baKon) - many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool arguments and the CPU's vision and audio encoders - plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt
This commit is contained in:
1 parent
b068190326
commit
1e968f6e1d
739 files changed
+128447
-84632
No files matched your search
+41
-31
@@ -1,20 +1,20 @@
|
||||
/* gen_config_test.cpp -- the sampling a checkpoint states for itself.
|
||||
*
|
||||
* WHAT THIS IS HOLDING DOWN. SamplingParams' defaults are an untruncated sampler, and a model
|
||||
* tuned against a truncated tail served that way draws, now and then, a token from far down its
|
||||
* distribution. End-of-turn is one of those tokens, so the symptom is not prose that reads badly
|
||||
* -- it is a reply that ends early, which from outside the server is indistinguishable from a
|
||||
* dropped request. Nothing about a wrong sampler default announces itself, which is exactly why
|
||||
* the reading of it is a component with a test rather than a helper inside the engine.
|
||||
* SamplingParams' defaults are an untruncated sampler. A model tuned with a truncated tail and
|
||||
* served that way occasionally draws a token from far down its distribution; end-of-turn is one
|
||||
* such token, so the symptom is a reply that ends early and looks like a dropped request. A wrong
|
||||
* default is silent, hence a tested component.
|
||||
*
|
||||
* No model and no container: the three sources are a string, a file and a key lookup, and all
|
||||
* three are reachable directly.
|
||||
* No model and no container: the three sources (a string, a file and a key lookup) are reached
|
||||
* directly.
|
||||
*/
|
||||
#include "rad_test.h"
|
||||
|
||||
#include "gen_config.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
@@ -22,8 +22,8 @@ using namespace rad;
|
||||
|
||||
namespace {
|
||||
|
||||
/* The container's metadata table as gen_sampling_from_kv sees it: bare field names, and every
|
||||
* value a string, which is how rad-convert writes free-form metadata. */
|
||||
/* The container's metadata table as gen_sampling_from_kv sees it: bare field names and string
|
||||
* values, as rad-convert writes free-form metadata. */
|
||||
std::function<const char*(const char*)> kv_of(const std::map<std::string, std::string>& m) {
|
||||
return [&m](const char* k) -> const char* {
|
||||
auto it = m.find(k);
|
||||
@@ -32,7 +32,7 @@ std::function<const char*(const char*)> kv_of(const std::map<std::string, std::s
|
||||
}
|
||||
|
||||
std::string write_temp(const char* name, const std::string& body) {
|
||||
std::string path = std::string("/tmp/radiance_gen_config_test_") + name + ".json";
|
||||
const std::string path = radtest::tmp_path(std::string(name) + ".json");
|
||||
FILE* f = std::fopen(path.c_str(), "w");
|
||||
if (!f) return std::string();
|
||||
std::fwrite(body.data(), 1, body.size(), f);
|
||||
@@ -40,7 +40,7 @@ std::string write_temp(const char* name, const std::string& body) {
|
||||
return path;
|
||||
}
|
||||
|
||||
/* Qwen3.8-Flash-Next's, verbatim -- the shape this was built for. */
|
||||
/* Qwen3.8-Flash-Next's generation_config.json, verbatim. */
|
||||
const char* const kQwenGenConfig = R"({
|
||||
"bos_token_id": 248044,
|
||||
"do_sample": true,
|
||||
@@ -59,20 +59,19 @@ TEST(gen_config_reads_a_real_generation_config) {
|
||||
CHECK_NEAR(g.temp, 1.0f, 1e-6);
|
||||
CHECK_EQ(g.top_k, 20);
|
||||
CHECK_NEAR(g.top_p, 0.95f, 1e-6);
|
||||
CHECK_NEAR(g.min_p, -1.0f, 1e-6); /* the file does not say, so nothing is claimed */
|
||||
CHECK_NEAR(g.min_p, -1.0f, 1e-6); /* not in the file, so not claimed */
|
||||
|
||||
/* Overlaid on the built-in defaults it truncates the tail, which is the whole point: the
|
||||
* untruncated sampler is what lets an early end-of-turn be drawn at all. */
|
||||
/* Overlaid on the built-in defaults, it truncates the tail. */
|
||||
const SamplingParams sp = g.onto(SamplingParams{});
|
||||
CHECK_NEAR(sp.temp, 1.0f, 1e-6);
|
||||
CHECK_EQ(sp.top_k, 20);
|
||||
CHECK_NEAR(sp.top_p, 0.95f, 1e-6);
|
||||
CHECK_NEAR(sp.min_p, 0.0f, 1e-6); /* untouched, so still the struct's own */
|
||||
CHECK_NEAR(sp.min_p, 0.0f, 1e-6); /* untouched: the struct's default */
|
||||
CHECK(!sp.greedy());
|
||||
}
|
||||
|
||||
/* A FIELD A SOURCE DID NOT STATE MUST NOT BE CLAIMED, or the sources cannot stack: a sidecar that
|
||||
* sets only top_k would otherwise wipe the temperature underneath it. */
|
||||
/* A field a source did not state is not claimed, so sources stack: a sidecar that sets only
|
||||
* top_k keeps the temperature underneath it. */
|
||||
TEST(gen_config_claims_only_what_a_source_states) {
|
||||
GenSampling g;
|
||||
CHECK(gen_sampling_parse(R"({"top_k": 40})", "test", &g));
|
||||
@@ -99,10 +98,10 @@ TEST(gen_config_reads_do_sample_false_as_greedy) {
|
||||
CHECK(gen_sampling_parse(R"({"do_sample": false, "temperature": 0.7, "top_k": 20})",
|
||||
"test", &g));
|
||||
CHECK_NEAR(g.temp, 0.0f, 1e-6);
|
||||
CHECK_EQ(g.top_k, -1); /* not taken: greedy does not have one */
|
||||
CHECK_EQ(g.top_k, -1); /* not claimed under greedy */
|
||||
CHECK(g.onto(SamplingParams{}).greedy());
|
||||
|
||||
/* do_sample true is the ordinary case and says nothing by itself. */
|
||||
/* do_sample true claims nothing by itself. */
|
||||
GenSampling t;
|
||||
CHECK(gen_sampling_parse(R"({"do_sample": true, "temperature": 0.7})", "test", &t));
|
||||
CHECK_NEAR(t.temp, 0.7f, 1e-6);
|
||||
@@ -115,12 +114,25 @@ TEST(gen_config_translates_top_k_minus_one_to_off) {
|
||||
CHECK_EQ(g.top_k, 0);
|
||||
}
|
||||
|
||||
/* A VALUE OUT OF RANGE IS DROPPED, NOT REFUSED, and it drops alone: these arrive with the model,
|
||||
* and one implausible entry is not a reason to serve the rest wrongly or not at all. */
|
||||
/* The startup line names what top_k 0 does: the sampler draws from its 1024 most likely
|
||||
* candidates, which is neither "off" nor the whole vocabulary. */
|
||||
TEST(the_sampling_line_says_what_top_k_zero_samples_from) {
|
||||
SamplingParams sp;
|
||||
sp.top_k = 0;
|
||||
const std::string zero = GenSampling::describe(sp);
|
||||
CHECK(has(zero, "top_k 0 (the 1024 most likely tokens"));
|
||||
CHECK(!has(zero, "(off)"));
|
||||
sp.top_k = 20;
|
||||
const std::string twenty = GenSampling::describe(sp);
|
||||
CHECK(has(twenty, "top_k 20, top_p"));
|
||||
}
|
||||
|
||||
/* An out-of-range value is dropped on its own, not refused: the config ships with the model,
|
||||
* and one implausible entry should not discard the rest. */
|
||||
TEST(gen_config_drops_an_out_of_range_field_and_keeps_the_rest) {
|
||||
GenSampling g;
|
||||
CHECK(gen_sampling_parse(R"({"temperature": 9.0, "top_p": 0.95, "top_k": 20})", "test", &g));
|
||||
CHECK(g.temp < 0.0f); /* 9.0 is not a temperature; nothing was claimed */
|
||||
CHECK(g.temp < 0.0f); /* 9.0 is out of range, so not claimed */
|
||||
CHECK_NEAR(g.top_p, 0.95f, 1e-6);
|
||||
CHECK_EQ(g.top_k, 20);
|
||||
|
||||
@@ -140,9 +152,8 @@ TEST(gen_config_survives_text_that_is_not_a_config) {
|
||||
CHECK(!g.any());
|
||||
}
|
||||
|
||||
/* The container's copy and the original file must resolve to the same sampler: rad-convert
|
||||
* flattens every value to a string, and two readings of one schema is how the two come to
|
||||
* disagree about a checkpoint. */
|
||||
/* The container's copy, where rad-convert flattened every value to a string, and the original
|
||||
* file resolve to the same sampler. */
|
||||
TEST(gen_config_reads_the_container_table_as_the_file) {
|
||||
GenSampling from_file;
|
||||
CHECK(gen_sampling_parse(kQwenGenConfig, "test", &from_file));
|
||||
@@ -177,17 +188,16 @@ TEST(gen_config_reads_a_file_and_treats_absence_as_silence) {
|
||||
GenSampling g;
|
||||
CHECK(gen_sampling_from_file(path, /*required=*/false, &g));
|
||||
CHECK_EQ(g.top_k, 20);
|
||||
std::remove(path.c_str());
|
||||
|
||||
/* A checkpoint that ships no generation config is served from whatever lies underneath, not
|
||||
* refused -- so a missing file takes nothing and reports nothing taken. */
|
||||
/* A checkpoint without a generation config is served from the layers underneath, not
|
||||
* refused: a missing file claims nothing and returns false. */
|
||||
GenSampling missing;
|
||||
CHECK(!gen_sampling_from_file("/nonexistent/generation_config.json", false, &missing));
|
||||
CHECK(!missing.any());
|
||||
}
|
||||
|
||||
/* The sidecar is the container's path with its extension replaced, and the extension is the LAST
|
||||
* dot in the basename -- a directory with a dot in its name must not eat it. */
|
||||
/* The sidecar is the container's path with its extension replaced. The extension starts at the
|
||||
* last dot in the basename, so a dot in a directory name is not one. */
|
||||
TEST(gen_config_derives_the_sidecar_path) {
|
||||
CHECK_EQ(gen_sidecar_path("/m/q38-flashnext-unc-w4-mtp.rad"),
|
||||
std::string("/m/q38-flashnext-unc-w4-mtp.generation.json"));
|
||||
|
||||
Reference in new issue
Block a user