Skip to content

Commit 330fcee

Browse files
NeonJarbasJarbasAl
andauthored
ocp pipeline (#396)
feat/liked tracks intents fix/MediaEntry_Playlist SEI handling typing ocp_entities no bumping utils to 0.1.0 :tada: unify locale folders rm unused files Co-authored-by: JarbasAi <jarbasai@mailfence.com>
1 parent b8404ca commit 330fcee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1610364
-11
lines changed

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
strategy:
3535
max-parallel: 3
3636
matrix:
37-
python-version: [ 3.7, 3.8, 3.9]
37+
python-version: [ 3.8, 3.9]
3838
runs-on: ubuntu-latest
3939
timeout-minutes: 15
4040
steps:

mycroft/deprecated/audio/services/simple/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ def _stop_running_process(self):
230230
self.process.kill()
231231
self.process = None
232232

233+
# mandatory abstract methods
234+
def get_track_length(self) -> int:
235+
return 0
236+
237+
def get_track_position(self) -> int:
238+
return 0
239+
240+
def set_track_position(self, milliseconds):
241+
pass
242+
233243

234244
def load_service(base_config, bus):
235245
backends = base_config.get('backends', [])

ovos_core/intent_services/__init__.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,33 @@
1414
#
1515
from collections import namedtuple
1616

17-
from ovos_config.config import Configuration
18-
from ovos_config.locale import setup_locale, get_valid_languages, get_full_lang_code
19-
2017
from ovos_bus_client.message import Message
2118
from ovos_bus_client.session import SessionManager
19+
from ovos_bus_client.util import get_message_lang
20+
from ovos_config.config import Configuration
21+
from ovos_config.locale import setup_locale, get_valid_languages, get_full_lang_code
2222
from ovos_core.intent_services.adapt_service import AdaptService
2323
from ovos_core.intent_services.commonqa_service import CommonQAService
2424
from ovos_core.intent_services.converse_service import ConverseService
25-
from ovos_core.intent_services.stop_service import StopService
2625
from ovos_core.intent_services.fallback_service import FallbackService
2726
from ovos_core.intent_services.padacioso_service import PadaciosoService
27+
from ovos_core.intent_services.stop_service import StopService
2828
from ovos_core.transformers import MetadataTransformersService, UtteranceTransformersService
29-
from ovos_workshop.intents import open_intent_envelope
3029
from ovos_utils.log import LOG, deprecated, log_deprecation
31-
from ovos_bus_client.util import get_message_lang
3230
from ovos_utils.metrics import Stopwatch
31+
from ovos_workshop.intents import open_intent_envelope
3332

3433
try:
3534
from ovos_core.intent_services.padatious_service import PadatiousService, PadatiousMatcher
3635
except ImportError:
3736
from ovos_core.intent_services.padacioso_service import PadaciosoService as PadatiousService
3837

38+
try:
39+
from ovos_core.intent_services.ocp_service import OCPPipelineMatcher
40+
except ImportError:
41+
LOG.warning("OCPPipelineMatcher unavailable, please install ovos-utils >= 0.1.0")
42+
OCPPipelineMatcher = None
43+
3944
# Intent match response tuple containing
4045
# intent_service: Name of the service that matched the intent
4146
# intent_type: intent name (used to call intent handler over the message bus)
@@ -73,6 +78,10 @@ def __init__(self, bus):
7378
self.converse = ConverseService(bus)
7479
self.common_qa = CommonQAService(bus)
7580
self.stop = StopService(bus)
81+
if OCPPipelineMatcher is not None:
82+
self.ocp = OCPPipelineMatcher(bus)
83+
else:
84+
self.ocp = None
7685
self.utterance_plugins = UtteranceTransformersService(bus, config=config)
7786
self.metadata_plugins = MetadataTransformersService(bus, config=config)
7887
# connection SessionManager to the bus,
@@ -210,7 +219,8 @@ def get_pipeline(self, skips=None, session=None):
210219
# TODO - from plugins
211220
if self.padatious_service is None:
212221
if any("padatious" in p for p in session.pipeline):
213-
LOG.warning("padatious is not available! using padacioso in it's place")
222+
LOG.warning("padatious is not available! using padacioso in it's place, "
223+
"intent matching will be extremely slow in comparison")
214224
padatious_matcher = self.padacioso_service
215225
else:
216226
from ovos_core.intent_services.padatious_service import PadatiousMatcher
@@ -233,8 +243,14 @@ def get_pipeline(self, skips=None, session=None):
233243
"padatious_low": padatious_matcher.match_low,
234244
"padacioso_low": self.padacioso_service.match_low,
235245
"adapt_low": self.adapt_service.match_low,
236-
"fallback_low": self.fallback.low_prio
246+
"fallback_low": self.fallback.low_prio,
247+
"adapt": self.adapt_service.match_medium # DEPRECATED - compat only TODO remove before stable, was only in alphas
237248
}
249+
if self.ocp is not None:
250+
matchers.update({
251+
"ocp_high": self.ocp.match_high,
252+
"ocp_medium": self.ocp.match_medium,
253+
"ocp_fallback": self.ocp.match_fallback})
238254
skips = skips or []
239255
pipeline = [k for k in session.pipeline if k not in skips]
240256
return [matchers[k] for k in pipeline]
@@ -291,7 +307,7 @@ def handle_utterance(self, message):
291307

292308
# Get utterance utterance_plugins additional context
293309
message = self._handle_transformers(message)
294-
310+
295311
if message.context.get("canceled"):
296312
# TODO - play dedicated sound
297313
LOG.info("utterance canceled, cancel_word:" + message.context.get("cancel_word"))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
search
2+
read
3+
play
4+
start
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
resume
3+
unpause
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
audio only
2+
no video
3+
only audio
4+
only sound
5+
sound only
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
I'm not sure how to play {{phrase}}
3+
Sorry, I don't know how to play {{phrase}}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(open|show|display) (featured|) {media} (catalog|collection|playlist)
2+
(open|show|display) featured {media}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Give me a moment
2+
Just a second
3+
Just one moment while I look for that
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
i like (that|this|it)
2+
i like (that|this)(song|music|track|jam|sound)
3+
(good|nice|great|amazing|awesome|cool) (song|music|track|jam|sound)
4+
(that|this|it) is a (good|nice|great|amazing|awesome|cool) (song|music|track|jam|sound)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
stop
2+
stop (playback|media|media playback|music|movie|movies|noise)
3+
stop everything
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(next|skip)
2+
(next|skip) (music|song|track|video|media)
3+
(play|go to) next (music|song|track|video|media)
4+
play next
5+
next
6+
next (song|track|music|movie|video|tune)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
open (OCP|O C P|common|ovos|open voice os) (player|media player)
2+
open (OCP|O C P|ovos common play|common play|ovos media player|open voice os player) (home screen|home page|homescreen|homepage|menu)
3+
open (OCP|O C P|ovos common play|open voice os common play|common play)
4+
open (media|music|gui|video) (player|catalog|skills|menu|playback)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pause
2+
pause (music|song|track|video|media|playback)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(play|start) {{query}}
2+
search (common play|ocp|ovos common play|O C P) for {{query}}
3+
search (ovos|open voice os) media for {{query}}
4+
search {{query}} (in|on) (common play|ocp|ovos common play|O C P)
5+
search {{query}} (in|on) (ovos|open voice os) media
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
What should i play next?
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(play|start) my (favorite|liked) (tracks|song|songs|music|jam|jams)
2+
(play|start) (favorite|liked) (tracks|song|songs|music|jam|jams)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(play previous|go back one) (music|song|track|video|media)
2+
(play previous|previous) (music|song|track|video|media)
3+
(play previous|previous|go back)
4+
previous
5+
previous (song|track|music|movie|video|tune)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
read (book|audiobook|audio book) {{query}}
2+
read {{query}}
3+
read {{query}} (book|audiobook|audio book)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(unpause|resume)
2+
(unpause|resume|continue|restart) (music|song|track|video|media|playback)
3+
play
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
do not cast to audio
2+
don't cast to audio
3+
no audio player
4+
only video
5+
video only
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Binary Classifier
2+
3+
labels: OCP, other
4+
5+
| pipeline | language | accuracy | params | size (MB) |
6+
|----------------------------|----------|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|
7+
| binary_ocp_cv2_kw_medium * | en | 0.9931496867494176 | {'penalty': None, 'l1_ratio': 0.15, 'early_stopping': False, 'alpha': 0.07} | 0.01 |
8+
| binary_ocp_cv2_small | en | 0.9888979130544839 | {'penalty': None, 'l1_ratio': 0.9, 'early_stopping': False, 'alpha': 0.005} | 2.166 |
9+
| binary_ocp_kw_small | all | 0.9326234280627232 | {'solver': 'adam', 'learning_rate': 'invscaling', 'hidden_layer_sizes': (120, 20, 80), 'early_stopping': True, 'alpha': 0.006, 'activation': 'tanh'} | 2.373 |
10+
| binary_ocp_kw_tiny | all | 0.8919135638508334 | {'penalty': None, 'l1_ratio': 0.7, 'early_stopping': True, 'alpha': 0.02} | 0.01 |
11+
12+
`*` requires `binary_ocp_cv2_small`
13+
14+
# Playback Classifier
15+
16+
labels: audio, video, external
17+
18+
| pipeline | language | accuracy | params | size (MB) |
19+
|------------------------------|----------|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|
20+
| playback_ocp_cv2_kw_medium * | en | 0.9491247659281933 | {'penalty': None, 'l1_ratio': 0.5, 'early_stopping': False, 'alpha': 0.07} | 0.021 |
21+
| playback_ocp_kw_small | all | 0.9017183438359262 | {'solver': 'adam', 'learning_rate': 'invscaling', 'hidden_layer_sizes': (114, 101, 36), 'early_stopping': False, 'alpha': 0.0485, 'activation': 'tanh'} | 3.904 |
22+
| playback_ocp_kw_tiny | all | 0.8325265234776467 | {'penalty': None, 'l1_ratio': 0.9, 'early_stopping': False, 'alpha': 0.0001} | 0.021 |
23+
24+
`*` requires `playback_ocp_cv2_small`
25+
26+
# Media Classifier
27+
28+
labels: movie, music, audiobook, podcast ....
29+
30+
| pipeline | language | accuracy | params | size (MB) |
31+
|---------------------------|----------|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------|-----------|
32+
| media_ocp_cv2_kw_medium * | en | 0.9054523222627585 | {'penalty': None, 'l1_ratio': 0.3, 'early_stopping': False, 'alpha': 0.05} | 0.186 |
33+
| media_ocp_cv2_medium | en | 0.8683117027695156 | {'penalty': None, 'l1_ratio': 0.5, 'early_stopping': False, 'alpha': 0.01} | 54.841 |
34+
| media_ocp_kw_small | all | 0.8558702042868357 | {'solver': 'adam', 'learning_rate': 'constant', 'hidden_layer_sizes': (63, 38), 'early_stopping': False, 'alpha': 0.006, 'activation': 'relu'} | 1.468 |
35+
| media_ocp_kw_tiny | all | 0.8136730385986041 | {'penalty': None, 'l1_ratio': 0.5, 'early_stopping': False, 'alpha': 0.005} | 0.154 |
36+
37+
`*` requires `media_ocp_cv2_medium`
38+
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)