Archived
- 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
63 lines
2.0 KiB
C++
63 lines
2.0 KiB
C++
/* iface.cpp -- CLI plumbing shared by the tools.
|
|
*
|
|
* The plugin loader and declare phase stay in core/build/startup.h, shared with the engine: a
|
|
* second copy could disagree on hierarchy order, which decides the layout baked into a container.
|
|
*/
|
|
#include "iface.h"
|
|
#include "util/kernel_list.h"
|
|
|
|
#include <cerrno>
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
|
|
namespace rad {
|
|
|
|
/* Same fallback as the engine (core/config.cpp): RAD_DEFAULT_HOME. Do not derive it from the
|
|
* install prefix; the home is a directory below it, so the tools would find a different plugin
|
|
* tree. */
|
|
std::string rad_home() {
|
|
if (const char* e = std::getenv("RADIANCE_HOME")) if (*e) return e;
|
|
#ifdef RAD_DEFAULT_HOME
|
|
return RAD_DEFAULT_HOME;
|
|
#else
|
|
return ".";
|
|
#endif
|
|
}
|
|
|
|
std::vector<std::string> rad_split_list(const std::string& s) { return rad_split_kernel_list(s); }
|
|
|
|
std::vector<std::string> rad_hierarchy_from_env() {
|
|
const char* e = std::getenv("RADIANCE_KERNELS");
|
|
return (e && *e) ? rad_split_list(e) : std::vector<std::string>{};
|
|
}
|
|
|
|
bool rad_parse_int(const char* text, int64_t lo, int64_t hi, int64_t* out, std::string* why) {
|
|
char* end = nullptr;
|
|
errno = 0;
|
|
const long long n = text ? std::strtoll(text, &end, 10) : 0;
|
|
if (!text || !*text || !end || *end || errno == ERANGE) {
|
|
if (why) *why = fmt("takes a whole number, not '%s'", text ? text : "");
|
|
return false;
|
|
}
|
|
if (n < lo || n > hi) {
|
|
if (why) *why = hi == INT64_MAX ? fmt("must be >= %lld, not %lld", (long long)lo, n)
|
|
: fmt("must be in [%lld, %lld], not %lld", (long long)lo,
|
|
(long long)hi, n);
|
|
return false;
|
|
}
|
|
*out = n;
|
|
return true;
|
|
}
|
|
|
|
int64_t rad_flag_int(const char* tool, const char* flag, const char* text, int64_t lo, int64_t hi) {
|
|
int64_t v = 0;
|
|
std::string why;
|
|
if (!rad_parse_int(text, lo, hi, &v, &why)) {
|
|
std::fprintf(stderr, "%s: %s %s\n", tool, flag, why.c_str());
|
|
std::exit(2);
|
|
}
|
|
return v;
|
|
}
|
|
|
|
} /* namespace rad */
|