Skip to content

Commit

Permalink
rev
Browse files Browse the repository at this point in the history
  • Loading branch information
kenarsa committed May 21, 2024
1 parent f4598b5 commit e2e576c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion recipes/llm-voice-assistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion recipes/llm-voice-assistant/python/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 6 additions & 6 deletions recipes/llm-voice-assistant/python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit e2e576c

Please sign in to comment.