Skip to content

Commit

Permalink
Add timing metrics for minerva testing (#175)
Browse files Browse the repository at this point in the history
# Description
Add `get_stt` timing metric for audio input

# Issues
NeonGeckoCom/neon-minerva#3

# Other Notes
Includes patch for microsoft/onnxruntime#17631
Updates license tests for dependency with undefined MIT license

---------

Co-authored-by: Daniel McKnight <daniel@neon.ai>
  • Loading branch information
NeonDaniel and Daniel McKnight committed Oct 3, 2023
1 parent 1aa200b commit add84ac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/license_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ on:
jobs:
license_tests:
uses: neongeckocom/.github/.github/workflows/license_tests.yml@master
with:
packages-exclude: '^(precise-runner|fann2|tqdm|bs4|ovos-phal-plugin|ovos-skill|neon-core|nvidia|neon-phal-plugin|bitstruct|audioread).*'
9 changes: 7 additions & 2 deletions neon_speech/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from neon_utils.file_utils import decode_base64_string_to_file
from ovos_utils.log import LOG
from neon_utils.configuration_utils import get_neon_user_config
from neon_utils.metrics_utils import Stopwatch
from neon_utils.user_utils import apply_local_user_profile_updates
from ovos_bus_client import Message
from ovos_config.config import update_mycroft_config
Expand Down Expand Up @@ -79,6 +80,8 @@ def on_started():


class NeonSpeechClient(OVOSDinkumVoiceService):
_stopwatch = Stopwatch("get_stt")

def __init__(self, ready_hook=on_ready, error_hook=on_error,
stopping_hook=on_stopping, alive_hook=on_alive,
started_hook=on_started, watchdog=lambda: None,
Expand Down Expand Up @@ -372,10 +375,12 @@ def build_context(msg: Message):
wav_file_path = message.data.get("audio_file")
lang = message.data.get("lang")
try:
_, parser_data, transcriptions = \
self._get_stt_from_file(wav_file_path, lang)
with self._stopwatch:
_, parser_data, transcriptions = \
self._get_stt_from_file(wav_file_path, lang)
message.context["audio_parser_data"] = parser_data
context = build_context(message)
context['timing']['get_stt'] = self._stopwatch.time
data = {
"utterances": transcriptions,
"lang": message.data.get("lang", "en-us")
Expand Down
2 changes: 2 additions & 0 deletions requirements/docker.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ovos-stt-plugin-vosk~=0.1
neon-stt-plugin-nemo~=0.0.2
onnxruntime!=1.16.0 # TODO: Patching https://github.com/microsoft/onnxruntime/issues/17631

# Load alternative WW plugins so they are available
ovos-ww-plugin-pocketsphinx~=0.1
ovos-ww-plugin-precise-lite~=0.1
Expand Down
3 changes: 2 additions & 1 deletion requirements/test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ ovos-stt-plugin-server~=0.0.3
pytest
mock~=4.0
pydub~=0.23
SpeechRecognition~=3.8
SpeechRecognition~=3.8
onnxruntime!=1.16.0 # TODO: Patching https://github.com/microsoft/onnxruntime/issues/17631

0 comments on commit add84ac

Please sign in to comment.