Archived
server: a control_vector request field, its admin switch and the Model-view panel
The field is per request, with the deployment's runtime default when absent, and a deployment with no vector refuses 'true' by name rather than serving the stock model. Strata's `experimental_speed_projection` is accepted as an alias. The dashboard's Model view carries a "Control vectors" panel with the switch for that default; GET/POST /admin/control-vector is its endpoint, behind the API key like every other route. The state is in /stats and /server_info. Nothing here reloads the model: the directions are uploaded once and each step carries a per-request mask. The panel stays visible when the page has no API key, with the reason, instead of disappearing -- a control that vanishes because the page has not signed in reads exactly like a build without the feature.
This commit is contained in:
1 parent
66c6d71254
commit
6f26cdb5f4
7 files changed
+312
-3
No files matched your search
@@ -204,6 +204,12 @@ void Server::register_routes() {
|
||||
router_.get ("/stats", [this](const HttpRequest& q) { return handle_stats(q); });
|
||||
router_.get ("/graph", [this](const HttpRequest& q) { return handle_graph(q); });
|
||||
router_.get ("/sessions", [this](const HttpRequest& q) { return handle_sessions(q); });
|
||||
/* The control vector's switch, for the dashboard's Model view and for automation: a
|
||||
* deployment with no vector found answers 404 here. */
|
||||
router_.get ("/admin/control-vector",
|
||||
[this](const HttpRequest& q) { return handle_control_vector(q); });
|
||||
router_.post("/admin/control-vector",
|
||||
[this](const HttpRequest& q) { return handle_control_vector(q); });
|
||||
}
|
||||
|
||||
/* Workers beyond the admission ceiling. A generation holds its connection's worker for its whole
|
||||
@@ -460,6 +466,25 @@ int Server::submit_all(const OaiRequest& r, std::vector<Generation>* gens, ApiEr
|
||||
}
|
||||
}
|
||||
|
||||
/* The control vector: the request's own choice, else the deployment's runtime default. A
|
||||
* deployment with no vector refuses the on state by name -- serving the stock model while the
|
||||
* client believes it asked for the vector would be a silent lie about what produced the text.
|
||||
* (Naming: `control_vector` is the field, `experimental_speed_projection` its alias.) */
|
||||
bool projection_on = false;
|
||||
{
|
||||
const bool named = r.control_vector >= 0;
|
||||
projection_on = named
|
||||
? (r.control_vector == 1)
|
||||
: (deps_.control_vector.get_default && deps_.control_vector.get_default());
|
||||
if (projection_on &&
|
||||
!(deps_.control_vector.available && deps_.control_vector.available())) {
|
||||
*err = err_bad("control_vector",
|
||||
"this deployment found no control vector for its model; the stock model "
|
||||
"is what it serves");
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int idx = 0;
|
||||
std::vector<Request> rqs;
|
||||
rqs.reserve(r.prompts.size() * (size_t)r.n);
|
||||
@@ -482,6 +507,7 @@ int Server::submit_all(const OaiRequest& r, std::vector<Generation>* gens, ApiEr
|
||||
Request rq;
|
||||
rq.prompt = r.prompts[p].tokens;
|
||||
rq.sp = r.sp;
|
||||
rq.sp.use_control_vector = projection_on;
|
||||
/* Distinct seeds per choice, or `n` identical completions. An offset suffices: the
|
||||
* sampler's stream is seeded, not chained. */
|
||||
rq.sp.seed = r.sp.seed + (uint64_t)k;
|
||||
|
||||
Reference in new issue
Block a user