From ed51fe3aedb0e3149b101e05aef8f75dbf18eb42 Mon Sep 17 00:00:00 2001 From: "Reza (Pouya) Rostam" <42750891+mrrostam@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:29:14 -0800 Subject: [PATCH] Python release with RPI5 support (#775) --- .github/workflows/python-demos.yml | 4 ++- .github/workflows/python.yml | 2 +- demo/python/README.md | 2 +- demo/python/requirements.txt | 4 +-- demo/python/setup.py | 8 +++--- sdk/python/README.md | 2 +- sdk/python/requirements.txt | 4 +-- sdk/python/setup.py | 6 ++--- sdk/python/test_util.py | 41 ++++++++++++++++++++++-------- 9 files changed, 47 insertions(+), 26 deletions(-) diff --git a/.github/workflows/python-demos.yml b/.github/workflows/python-demos.yml index e2b87b3d3..afd3628c3 100644 --- a/.github/workflows/python-demos.yml +++ b/.github/workflows/python-demos.yml @@ -65,7 +65,7 @@ jobs: strategy: matrix: - machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, jetson, beaglebone] + machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson, beaglebone] include: - machine: rpi2 platform: raspberry-pi @@ -77,6 +77,8 @@ jobs: platform: raspberry-pi - machine: rpi4-64 platform: raspberry-pi + - machine: rpi5-64 + platform: raspberry-pi - machine: jetson platform: jetson - machine: beaglebone diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index fd5776788..828ef7da7 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -63,7 +63,7 @@ jobs: strategy: matrix: - machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, jetson, beaglebone] + machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson, beaglebone] steps: - uses: actions/checkout@v3 diff --git a/demo/python/README.md b/demo/python/README.md index e6cdaa17e..ffca8fd58 100644 --- a/demo/python/README.md +++ b/demo/python/README.md @@ -19,7 +19,7 @@ similar to Alexa and Google. But it entirely runs 100% on-device. Picovoice is ## Compatibility -* Python 3.5+ +* Python 3.7+ * Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (all variants), NVIDIA Jetson (Nano), and BeagleBone. ## Installation diff --git a/demo/python/requirements.txt b/demo/python/requirements.txt index 806df6381..154ad2b2a 100644 --- a/demo/python/requirements.txt +++ b/demo/python/requirements.txt @@ -1,2 +1,2 @@ -picovoice==3.0.1 -pvrecorder==1.2.1 +picovoice==3.0.2 +pvrecorder==1.2.2 diff --git a/demo/python/setup.py b/demo/python/setup.py index dcff73d11..ed73ea05b 100644 --- a/demo/python/setup.py +++ b/demo/python/setup.py @@ -1,5 +1,5 @@ # -# Copyright 2020-2023 Picovoice Inc. +# Copyright 2020-2024 Picovoice Inc. # # You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE" # file accompanying this source. @@ -39,7 +39,7 @@ setuptools.setup( name="picovoicedemo", - version="3.0.1", + version="3.0.2", author="Picovoice Inc.", author_email="hello@picovoice.ai", description="Picovoice demos.", @@ -47,7 +47,7 @@ long_description_content_type="text/markdown", url="https://github.com/Picovoice/picovoice", packages=["picovoicedemo"], - install_requires=["picovoice==3.0.1", "pvrecorder==1.2.1"], + install_requires=["picovoice==3.0.2", "pvrecorder==1.2.2"], include_package_data=True, classifiers=[ "Development Status :: 5 - Production/Stable", @@ -63,6 +63,6 @@ 'picovoice_demo_mic=picovoicedemo.picovoice_demo_mic:main', ], ), - python_requires='>=3.5', + python_requires='>=3.7', keywords="wake word, voice control, speech recognition, voice recognition, natural language understanding", ) diff --git a/sdk/python/README.md b/sdk/python/README.md index 63b698fb4..92c9797d5 100644 --- a/sdk/python/README.md +++ b/sdk/python/README.md @@ -14,7 +14,7 @@ similar to Alexa and Google. But it entirely runs 100% on-device. Picovoice is ## Compatibility -* Python 3.5+ +* Python 3.7+ * Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (all variants), NVIDIA Jetson (Nano), and BeagleBone. ## Installation diff --git a/sdk/python/requirements.txt b/sdk/python/requirements.txt index cfdf66f5b..e7f976d2a 100644 --- a/sdk/python/requirements.txt +++ b/sdk/python/requirements.txt @@ -1,4 +1,4 @@ parameterized -pvporcupine==3.0.1 -pvrhino==3.0.1 +pvporcupine==3.0.2 +pvrhino==3.0.2 setuptools \ No newline at end of file diff --git a/sdk/python/setup.py b/sdk/python/setup.py index 06e9b2534..8792b9a57 100644 --- a/sdk/python/setup.py +++ b/sdk/python/setup.py @@ -33,7 +33,7 @@ setuptools.setup( name="picovoice", - version="3.0.1", + version="3.0.2", author="Picovoice Inc.", author_email="hello@picovoice.ai", description="Picovoice is an end-to-end platform for building voice products on your terms.", @@ -41,7 +41,7 @@ long_description_content_type="text/markdown", url="https://github.com/Picovoice/picovoice", packages=["picovoice"], - install_requires=["pvporcupine==3.0.1", "pvrhino==3.0.1"], + install_requires=["pvporcupine==3.0.2", "pvrhino==3.0.2"], include_package_data=True, classifiers=[ "Development Status :: 5 - Production/Stable", @@ -51,6 +51,6 @@ "Programming Language :: Python :: 3", "Topic :: Multimedia :: Sound/Audio :: Speech" ], - python_requires='>=3.5', + python_requires='>=3.7', keywords="wake word, voice control, speech recognition, voice recognition, natural language understanding", ) diff --git a/sdk/python/test_util.py b/sdk/python/test_util.py index 6f491cc06..d32468b1c 100644 --- a/sdk/python/test_util.py +++ b/sdk/python/test_util.py @@ -28,7 +28,8 @@ def _pv_linux_machine(machine): elif machine in ['armv7l', 'armv6l']: arch_info = '' else: - raise NotImplementedError("Unsupported CPU architecture: '%s'" % machine) + raise NotImplementedError( + "Unsupported CPU architecture: '%s'" % machine) cpu_info = '' try: @@ -36,7 +37,8 @@ def _pv_linux_machine(machine): cpu_part_list = [x for x in cpu_info.split('\n') if 'CPU part' in x] cpu_part = cpu_part_list[0].split(' ')[-1].lower() except Exception as error: - raise RuntimeError("Failed to identify the CPU with '%s'\nCPU info: %s" % (error, cpu_info)) + raise RuntimeError( + "Failed to identify the CPU with '%s'\nCPU info: %s" % (error, cpu_info)) if '0xb76' == cpu_part: return 'arm11' + arch_info @@ -48,6 +50,8 @@ def _pv_linux_machine(machine): return 'cortex-a57' + arch_info elif '0xd08' == cpu_part: return 'cortex-a72' + arch_info + elif "0xd0b" == cpu_part: + return "cortex-a76" + arch_info elif '0xc08' == cpu_part: return 'beaglebone' + arch_info elif machine == 'armv7l': @@ -74,7 +78,15 @@ def _pv_platform(): _PV_SYSTEM, _PV_MACHINE = _pv_platform() -_RASPBERRY_PI_MACHINES = {'arm11', 'cortex-a7', 'cortex-a53', 'cortex-a72', 'cortex-a53-aarch64', 'cortex-a72-aarch64'} +_RASPBERRY_PI_MACHINES = { + "arm11", + "cortex-a7", + "cortex-a53", + "cortex-a72", + "cortex-a76", + "cortex-a53-aarch64", + "cortex-a72-aarch64", + "cortex-a76-aarch64"} _JETSON_MACHINES = {'cortex-a57-aarch64'} @@ -109,7 +121,8 @@ def __append_language(s, language): def context_path(context, language): system = platform.system() - contexts_root = __append_language('../../resources/rhino/resources/contexts', language) + contexts_root = __append_language( + '../../resources/rhino/resources/contexts', language) if system == 'Darwin': return os.path.join(os.path.dirname(__file__), contexts_root, 'mac', '%s_mac.rhn' % context) @@ -119,13 +132,16 @@ def context_path(context, language): else: cpu_info = '' try: - cpu_info = subprocess.check_output(['cat', '/proc/cpuinfo']).decode() - cpu_part_list = [x for x in cpu_info.split('\n') if 'CPU part' in x] + cpu_info = subprocess.check_output( + ['cat', '/proc/cpuinfo']).decode() + cpu_part_list = [x for x in cpu_info.split( + '\n') if 'CPU part' in x] cpu_part = cpu_part_list[0].split(' ')[-1].lower() except Exception as error: - raise RuntimeError("Failed to identify the CPU with '%s'\nCPU info: %s" % (error, cpu_info)) + raise RuntimeError( + "Failed to identify the CPU with '%s'\nCPU info: %s" % (error, cpu_info)) - if '0xb76' == cpu_part or '0xc07' == cpu_part or '0xd03' == cpu_part or '0xd08' == cpu_part: + if cpu_part in ('0xb76', '0xc07', '0xd03', '0xd08', '0xd0b'): return os.path.join(os.path.dirname(__file__), contexts_root, 'raspberry-pi', '%s_raspberry-pi.rhn' % context) elif '0xd07' == cpu_part: @@ -146,7 +162,8 @@ def pv_keyword_paths_by_language(language): keyword_files_root = __append_language('resources/keyword_files', language) relative = '../../resources/porcupine' keyword_files_dir = \ - os.path.join(os.path.dirname(__file__), relative, keyword_files_root, pv_keyword_files_subdir()) + os.path.join(os.path.dirname(__file__), relative, + keyword_files_root, pv_keyword_files_subdir()) res = dict() for x in os.listdir(keyword_files_dir): @@ -162,13 +179,15 @@ def pv_rhino_model_path_by_language(language): def pv_porcupine_model_path_by_language(language): - model_path_subdir = __append_language('lib/common/porcupine_params', language) + model_path_subdir = __append_language( + 'lib/common/porcupine_params', language) model_path_subdir = '%s.pv' % model_path_subdir return os.path.join(os.path.dirname(__file__), '../../resources/porcupine', model_path_subdir) def load_test_data(): - data_file_path = os.path.join(os.path.dirname(__file__), "../../resources/.test/test_data.json") + data_file_path = os.path.join(os.path.dirname( + __file__), "../../resources/.test/test_data.json") with open(data_file_path, encoding="utf8") as data_file: json_test_data = data_file.read() test_data = json.loads(json_test_data)['tests']