Skip to content

armgit / PS5LM

Public Imported from GitHub
0

llama.cpp on a jailbroken PS5: run any GGUF model natively on the console, starting with Qwen 3.8

App: a decision model's speed as time per decision

Mert Cobanovb4ca329dc27e
diff --git a/ps5/app/activity.cpp b/ps5/app/activity.cpp
index b8079bc..e925ad8 100644
--- a/ps5/app/activity.cpp
+++ b/ps5/app/activity.cpp
@@ -167,7 +167,8 @@ void ps5lm_activity_begin(int id, const char * method, const char * path, const
return;
}
const json j = json::parse(body, body + body_len, nullptr, false);
- g_sink->activity_begin(id, remote ? remote : "", path ? path : "", one_line(asked_from(path ? path : "", j), 400));
+ const int questions = j.is_object() && j.contains("questions") && j["questions"].is_object() ? (int) j["questions"].size() : 0;
+ g_sink->activity_begin(id, remote ? remote : "", path ? path : "", one_line(asked_from(path ? path : "", j), 400), questions);
}
void ps5lm_activity_data(int id, const char * data, size_t len) {
diff --git a/ps5/app/dashboard.cpp b/ps5/app/dashboard.cpp
index 27c5a17..cbd94a7 100644
--- a/ps5/app/dashboard.cpp
+++ b/ps5/app/dashboard.cpp
@@ -1077,9 +1077,19 @@ void Dashboard::draw_home(gfx::DrawList & l) const {
big = std::max(0.0f, live_.load_progress) * 100.0f;
unit = "% on the GPU";
} else if (decision) {
- big = live_.prompt_tps; // as measured, once a second: an eased number flickers on a TV
- unit = "tokens read per second";
- known = live_.prompt_tps > 0;
+ // Time per decision (one question answered) over the latest requests:
+ // what a decision model is judged by, as Ollaya reports it.
+ double seconds = 0;
+ int decisions = 0;
+ for (const auto & e : live_.activity) {
+ if (e.status == 200 && e.questions > 0) {
+ seconds += e.seconds;
+ decisions += e.questions;
+ }
+ }
+ big = decisions ? (float) (1000.0 * seconds / decisions) : 0;
+ unit = "ms per decision";
+ known = decisions > 0;
} else {
big = live_.gen_tps;
unit = "tokens per second";
diff --git a/ps5/app/preview_main.cpp b/ps5/app/preview_main.cpp
index 943e09b..55dd9d2 100644
--- a/ps5/app/preview_main.cpp
+++ b/ps5/app/preview_main.cpp
@@ -187,12 +187,12 @@ ps5lm::Live sample(float seconds, bool generating) {
L.free_gib = 8.6;
L.activity.clear();
ps5lm::Exchange a;
- a.id = 130; a.client = "192.168.1.40"; a.path = "/v1/systemone"; a.status = 200; a.seconds = 0.3;
+ a.id = 130; a.client = "192.168.1.40"; a.path = "/v1/systemone"; a.status = 200; a.seconds = 0.3; a.questions = 3;
a.asked = "3 questions: {\"from\": \"[email protected]\", \"subject\": \"URGENT: you won a free iPhone!!!\"}";
a.answered = "spam yes 1.00, intent sell, urgency 1.02";
L.activity.push_back(a);
a.id = 131; a.asked = "7 questions, 1 image"; a.answered = "text no 0.01, color black, ad no 0.01, people no 0.00, mood 1.00";
- a.seconds = 2.9; L.activity.push_back(a);
+ a.seconds = 2.9; a.questions = 7; L.activity.push_back(a);
}
if (g_empty) {
L.state = ps5lm::ServerState::no_model;
diff --git a/ps5/app/stats.cpp b/ps5/app/stats.cpp
index 483b0d6..902d864 100644
--- a/ps5/app/stats.cpp
+++ b/ps5/app/stats.cpp
@@ -265,13 +265,14 @@ double steady_s() {
} // namespace
-void StatsCollector::activity_begin(int id, std::string client, std::string path, std::string asked) {
+void StatsCollector::activity_begin(int id, std::string client, std::string path, std::string asked, int questions) {
std::lock_guard<std::mutex> lock(mutex_);
Exchange e;
e.id = id;
e.client = std::move(client);
e.path = std::move(path);
e.asked = std::move(asked);
+ e.questions = questions;
e.started = steady_s();
live_.activity.push_back(std::move(e));
if (live_.activity.size() > 6) {
diff --git a/ps5/app/stats.hpp b/ps5/app/stats.hpp
index 7e5c9e5..876f588 100644
--- a/ps5/app/stats.hpp
+++ b/ps5/app/stats.hpp
@@ -32,6 +32,7 @@ struct Exchange {
std::string path; // "/v1/chat/completions"
std::string asked; // the last user message, a decision's state, or the prompt
std::string answered; // the text answered so far
+ int questions = 0; // a decision request's questions, each one decision
int status = 0; // the HTTP status once done, 0 while it runs
double seconds = 0; // how long it took, once done
double started = 0; // steady clock, seconds
@@ -129,7 +130,7 @@ class StatsCollector {
void set_state(ServerState s);
void set_scratch(double gib);
// From llama-server's HTTP threads, through activity.cpp.
- void activity_begin(int id, std::string client, std::string path, std::string asked);
+ void activity_begin(int id, std::string client, std::string path, std::string asked, int questions);
void activity_text(int id, const std::string & text);
void activity_end(int id, int status);