Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

update cli energy report

eugene324d471c1661
diff --git a/apps/playground/Sources/Extensions/ReplyStatsFormat.swift b/apps/playground/Sources/Extensions/ReplyStatsFormat.swift
index 0c2ee6434..f5da3f677 100644
--- a/apps/playground/Sources/Extensions/ReplyStatsFormat.swift
+++ b/apps/playground/Sources/Extensions/ReplyStatsFormat.swift
@@ -9,12 +9,11 @@ enum ReplyStatsFormat {
}
static func energyPerToken(_ stats: ChatReplyJoulesPerToken) -> String {
- let total = formattedNumber(stats.total())
switch stats {
- case .total:
- return "\(total) J/tok"
- case let .components(cpu, gpu, ane, dram):
- return "CPU \(formattedNumber(cpu)), GPU \(formattedNumber(gpu)), ANE \(formattedNumber(ane)), DRAM \(formattedNumber(dram)), total \(total) J/tok"
+ case let .total(total):
+ "total \(formattedNumber(total)) J/tok"
+ case let .components(cpu, gpu, _, dram):
+ "CPU+GPU+DRAM \(formattedNumber(cpu + gpu + dram)) J/tok"
}
}
diff --git a/crates/legacy/shoji/src/types/session/chat/reply/stats.rs b/crates/legacy/shoji/src/types/session/chat/reply/stats.rs
index 22c375217..1d90593a6 100644
--- a/crates/legacy/shoji/src/types/session/chat/reply/stats.rs
+++ b/crates/legacy/shoji/src/types/session/chat/reply/stats.rs
@@ -122,17 +122,16 @@ impl Display for ChatReplyJoulesPerToken {
&self,
formatter: &mut fmt::Formatter<'_>,
) -> fmt::Result {
- let total = self.total();
match self {
Self::Total {
- ..
- } => write!(formatter, "{total:.3} J/tok"),
+ total,
+ } => write!(formatter, "total {total:.2} J/tok"),
Self::Components {
cpu,
gpu,
- ane,
dram,
- } => write!(formatter, "CPU {cpu:.3}, GPU {gpu:.3}, ANE {ane:.3}, DRAM {dram:.3}, total {total:.3} J/tok"),
+ ..
+ } => write!(formatter, "CPU+GPU+DRAM {:.2} J/tok", cpu + gpu + dram),
}
}
}