From 4f9d80dd0ba2f66cd11eb726a6011e7d5d671121 Mon Sep 17 00:00:00 2001 From: Loc Huynh Date: Mon, 21 Oct 2024 18:41:51 -0700 Subject: [PATCH] fix None metrics for cpu/mem --- guidance/models/_model.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/guidance/models/_model.py b/guidance/models/_model.py index 6891f7f2c..7eda690d4 100644 --- a/guidance/models/_model.py +++ b/guidance/models/_model.py @@ -132,17 +132,9 @@ async def _emit(self): time_elapsed = time_end - time_start self._renderer.update(MetricMessage(name="wall time", value=time_elapsed)) - self._renderer.update( - MetricMessage( - name="cpu", value=self._monitor.get_metric(MonitoringMetric.CPU_USAGE) - ) - ) + self._renderer.update(MetricMessage(name="cpu", value=cpu_percent)) - self._renderer.update( - MetricMessage( - name="ram", value=self._monitor.get_metric(MonitoringMetric.MEM_USAGE) - ) - ) + self._renderer.update(MetricMessage(name="ram", value=mem_percent)) self._renderer.update(MetricMessage(name="gpu", value=gpu_percent)) @@ -251,7 +243,7 @@ def _msg_recv(self, message: GuidanceMessage) -> None: self.renderer.update( ExecutionCompletedOutputMessage( trace_id=last_trace_id, - text=self.tokenizer.decode(tokens).decode("utf-8"), + text=self.tokenizer.decode(tokens).decode("utf-8"), tokens=processed_gen_tokens, ) )