From e2e576c2abb35f200c9b97b06ddbecd0a278bfff Mon Sep 17 00:00:00 2001 From: Alireza Kenarsari Date: Tue, 21 May 2024 11:20:50 -0700 Subject: [PATCH] rev --- recipes/llm-voice-assistant/README.md | 2 +- recipes/llm-voice-assistant/python/README.md | 2 +- recipes/llm-voice-assistant/python/main.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/recipes/llm-voice-assistant/README.md b/recipes/llm-voice-assistant/README.md index ef7c508..958d7ac 100644 --- a/recipes/llm-voice-assistant/README.md +++ b/recipes/llm-voice-assistant/README.md @@ -6,7 +6,7 @@ Hands-free voice assistant powered by a large language model (LLM), all voice re - [Porcupine Wake Word](https://picovoice.ai/docs/porcupine/) - [Cheetah Streaming Speech-to-Text](https://picovoice.ai/docs/cheetah/) -- [picoLLM Inference Engine]() +- [picoLLM Inference Engine](https://github.com/Picovoice/picollm) - [Orca Streaming Text-to-Speech](https://picovoice.ai/docs/orca/) ## Implementations diff --git a/recipes/llm-voice-assistant/python/README.md b/recipes/llm-voice-assistant/python/README.md index 9081ce6..d8bb6de 100644 --- a/recipes/llm-voice-assistant/python/README.md +++ b/recipes/llm-voice-assistant/python/README.md @@ -1,7 +1,7 @@ ## Compatibility - Python 3.8+ -- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64), and Raspberry Pi (5, 4, and 3). +- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64), and Raspberry Pi (5 and 4). ## AccessKey diff --git a/recipes/llm-voice-assistant/python/main.py b/recipes/llm-voice-assistant/python/main.py index fb8803a..75b04cd 100644 --- a/recipes/llm-voice-assistant/python/main.py +++ b/recipes/llm-voice-assistant/python/main.py @@ -25,10 +25,10 @@ def __init__(self, sample_rate: int) -> None: self._tick_sec = 0. def tick(self) -> None: - self._tick_sec = time.time() + self._tick_sec = time.perf_counter() def tock(self, audio: Optional[Sequence[int]] = None) -> None: - self._compute_sec += time.time() - self._tick_sec + self._compute_sec += time.perf_counter() - self._tick_sec self._audio_sec += (len(audio) / self._sample_rate) if audio is not None else 0. def rtf(self) -> float: @@ -45,12 +45,12 @@ def __init__(self) -> None: def tock(self) -> None: if self._start_sec == 0.: - self._start_sec = time.time() + self._start_sec = time.perf_counter() else: self._num_tokens += 1 def tps(self) -> float: - tps = self._num_tokens / (time.time() - self._start_sec) + tps = self._num_tokens / (time.perf_counter() - self._start_sec) self._num_tokens = 0 self._start_sec = 0. return tps @@ -102,7 +102,7 @@ def buffer_pcm(x: Optional[Sequence[int]]) -> None: if x is not None: pcm_buffer.extend(x) if delay_sec[0] == -1: - delay_sec[0] = time.time() - utterance_end_sec + delay_sec[0] = time.perf_counter() - utterance_end_sec while True: if synthesize and len(texts) > 0: @@ -294,7 +294,7 @@ def handler(_, __) -> None: print(partial_transcript, end='', flush=True) user_request += partial_transcript if endpoint_reached: - utterance_end_sec = time.time() + utterance_end_sec = time.perf_counter() cheetah_profiler.tick() remaining_transcript = cheetah.flush() cheetah_profiler.tock()