Archived
radiance 1.10.0
LoRA for image and video generators: - civitai and Hugging Face adapter files as published: kohya, ComfyUI and diffusers/PEFT key names; LoRA, LoCon, LoHa, LoKr and full-weight diffs; DoRA, OFT and Tucker are refused by name - stacked per request with a strength each, through the `loras` field or <lora:name:strength> tags in the prompt; --lora-dir serves every file in a directory, GET /v1/loras lists them, and --max-loras / --max-lora-rank size the slots on the card (generators default to rank 64) - Krea 2, Qwen-Image 2.1, FLUX.3 [klein], MiniMax H3, LTX-2.5, Anima and SDXL New models: - Anima (base, aesthetic and turbo): Cosmos-Predict2 DiT with the Qwen3-0.6B text encoder and the Qwen-Image VAE, on one card - Stable Diffusion XL and its single-file finetunes (Illustrious, NoobAI including V-Pred, Pony), read as civitai ships them, with the Euler, Euler a and DPM++ 2M samplers Recipes: - q38-27b-mxfp4-df2: any bf16 Qwen3.8-27B or finetune at MXFP4 with the DFlash2 drafter - Krea 2 finetunes from civitai: scripts/krea2_native.py reads Krea's own key names, and krea-2-fp8-unscaled keeps a plain-fp8 file's codes exactly Changes: --max-num-batched-tokens defaults to 2048 (was 8192). Plugin ABI 25: out-of-tree plugins must be rebuilt.
This commit is contained in:
1 parent
685ec5bd85
commit
4246a1dd04
124 files changed
+14326
-387
No files matched your search
+25
-16
@@ -23,6 +23,7 @@
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace rad {
|
||||
|
||||
@@ -103,13 +104,20 @@ static const Flag g_flags[] = {
|
||||
" or host memory (default 3600). 0 keeps it until the memory\n"
|
||||
" is wanted" },
|
||||
|
||||
{ "--lora", "ADAPTER", "NAME=PATH: serve a PEFT LoRA adapter beside the base model,\n"
|
||||
" as model NAME (repeatable). The base stays as it is; each\n"
|
||||
" request picks its adapter by `model`"},
|
||||
{ "--lora", "ADAPTER", "NAME=PATH: serve a LoRA adapter beside the base model\n"
|
||||
" (repeatable). A text model takes a PEFT directory and\n"
|
||||
" serves it as model NAME; an image or video generator takes\n"
|
||||
" a .safetensors file (kohya, ComfyUI, PEFT, LyCORIS) that\n"
|
||||
" a request names in `loras`. The base stays as it is"},
|
||||
{ "--lora-dir", "DIR", "image and video generators: a request may name any\n"
|
||||
" NAME.safetensors under DIR in `loras`, opened when first\n"
|
||||
" asked for"},
|
||||
{ "--max-loras", "N", "adapter slots resident at once (default: the number of\n"
|
||||
" --lora). Each slot holds one adapter's A/B on the card"},
|
||||
{ "--max-lora-rank", "R", "the rank each slot is sized for (default 16); a smaller\n"
|
||||
" adapter is zero-padded, a larger one refused"},
|
||||
" --lora, 2 with --lora-dir alone). A text model's slot holds\n"
|
||||
" one adapter, a generator's one request's combination"},
|
||||
{ "--max-lora-rank", "R", "the rank each slot is sized for (default 16 for a text\n"
|
||||
" model, 64 for a generator); a text model's larger adapter is\n"
|
||||
" refused, a generator's larger combination truncated"},
|
||||
{ "--lora-target-modules", "LIST", "comma-separated HF module leaf names adapters may\n"
|
||||
" target (q_proj,k_proj,...). Default: what the --lora\n"
|
||||
" adapters target. Needed with --max-loras and no --lora"},
|
||||
@@ -520,6 +528,7 @@ int config_parse(int argc, char** argv, Config* c) {
|
||||
}
|
||||
c->lora.adapters.emplace_back(std::string(v, eq), std::string(eq + 1));
|
||||
}
|
||||
else if (S("--lora-dir")) { if (!(v = need(i))) return RAD_E_INVAL; c->lora.dir = v; }
|
||||
else if (S("--max-loras")) { if (!num(0, 64, &c->lora.max_loras)) return RAD_E_INVAL; }
|
||||
else if (S("--max-lora-rank")) { if (!num(1, 512, &c->lora.max_rank)) return RAD_E_INVAL; }
|
||||
else if (S("--lora-target-modules")) {
|
||||
@@ -881,21 +890,18 @@ int config_parse(int argc, char** argv, Config* c) {
|
||||
RAD_ERR("--lora names the adapter '%s' twice", name.c_str());
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
if (L.max_loras > 0 && L.max_loras < (int)L.adapters.size()) {
|
||||
RAD_ERR("--max-loras %d holds fewer adapters than the %zu that --lora names",
|
||||
L.max_loras, L.adapters.size());
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
const bool rank_given = c->given.count("--max-lora-rank") != 0;
|
||||
if (!L.enabled() && (rank_given || !L.targets.empty())) {
|
||||
RAD_ERR("%s sizes runtime LoRA slots, and there are none: give --lora or --max-loras",
|
||||
rank_given ? "--max-lora-rank" : "--lora-target-modules");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
if (L.adapters.empty() && L.max_loras > 0 && L.targets.empty()) {
|
||||
RAD_ERR("--max-loras with no --lora names no module an adapter may target; give "
|
||||
"--lora-target-modules (q_proj,k_proj,v_proj,o_proj,...)");
|
||||
return RAD_E_INVAL;
|
||||
if (!L.dir.empty()) {
|
||||
struct stat sb{};
|
||||
if (stat(L.dir.c_str(), &sb) != 0 || !S_ISDIR(sb.st_mode)) {
|
||||
RAD_ERR("--lora-dir '%s' is not a directory", L.dir.c_str());
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
}
|
||||
if (!c->kld_lora.empty() && !c->kld()) {
|
||||
RAD_ERR("--kld-lora scores through an adapter in KL mode; give --kld-record or "
|
||||
@@ -1019,9 +1025,12 @@ const ShowRow kShow[] = {
|
||||
std::string o;
|
||||
for (const auto& [n, p] : c.lora.adapters) o += (o.empty() ? "" : ", ") + n + "=" + p;
|
||||
return o.empty() ? std::string("none") : o; } },
|
||||
{ "--lora-dir", [](const Config& c) {
|
||||
return c.lora.dir.empty() ? std::string("none") : c.lora.dir; } },
|
||||
{ "--max-loras", [](const Config& c) {
|
||||
return c.lora.enabled() ? num(c.lora.slots()) : std::string("0 (off)"); } },
|
||||
{ "--max-lora-rank", [](const Config& c) { return num(c.lora.max_rank); } },
|
||||
{ "--max-lora-rank", [](const Config& c) {
|
||||
return c.lora.max_rank > 0 ? num(c.lora.max_rank) : std::string("auto (16 text, 64 generator)"); } },
|
||||
{ "--lora-target-modules", [](const Config& c) {
|
||||
std::string o;
|
||||
for (const std::string& t : c.lora.targets) o += (o.empty() ? "" : ",") + t;
|
||||
|
||||
Reference in new issue
Block a user