Archived
serve: /v1/models reports max_model_len, the context the server runs with
The model list carried only the id, so a client had no way to read the context the server was started with and guessed it from the model's name. Carry the field vLLM's model card does: the server's max_ctx (--max-model-len, else the container's trained length), on both /v1/models and /v1/models/:id, and leave it out when the length is unknown.
This commit is contained in:
1 parent
7fd2cd7fa6
commit
86128c2e75
6 files changed
+33
-5
No files matched your search
+14
-1
@@ -343,7 +343,7 @@ struct Fixture {
|
||||
FakeGrammar gram;
|
||||
std::unique_ptr<Server> srv;
|
||||
|
||||
explicit Fixture(bool with_tools = true) {
|
||||
explicit Fixture(bool with_tools = true, int64_t max_ctx = 0) {
|
||||
Deps d;
|
||||
d.sched = &sched;
|
||||
d.tok = &tok;
|
||||
@@ -356,6 +356,7 @@ struct Fixture {
|
||||
o.model_id = "test-model";
|
||||
o.default_max_tokens = 32;
|
||||
o.max_seqs = 4;
|
||||
o.max_ctx = max_ctx;
|
||||
srv.reset(new Server(d, o));
|
||||
}
|
||||
|
||||
@@ -2521,6 +2522,18 @@ TEST(models_and_health_answer) {
|
||||
CHECK(json::parse(h.body)["status"].get<std::string>() == "ok");
|
||||
}
|
||||
|
||||
TEST(the_model_entry_carries_the_context_length_the_server_was_started_with) {
|
||||
/* Both routes a client sizes its window from: the list, and the entry it fetches by id. */
|
||||
Fixture f(true, 262144);
|
||||
for (const char* path : {"/v1/models", "/v1/models/test-model"}) {
|
||||
HttpResponse r = f.get(path);
|
||||
CHECK_EQ(r.status, 200);
|
||||
CHECK_EQ(json::parse(r.body)["data"][0].value("max_model_len", (int64_t)0), (int64_t)262144);
|
||||
}
|
||||
Fixture unknown;
|
||||
CHECK(!json::parse(unknown.get("/v1/models").body)["data"][0].contains("max_model_len"));
|
||||
}
|
||||
|
||||
TEST(embeddings_without_an_embedder_is_501_not_an_empty_200) {
|
||||
Fixture f;
|
||||
HttpResponse r = f.post("/v1/embeddings", R"({"input":"hi"})");
|
||||
|
||||
Reference in new issue
Block a user