Skip to content

Commit efed0ff

Browse files
authored
Merge pull request #14 from joeblowma/main
Updated to prevent unnecessary package version bindings
2 parents 34e19be + 4466476 commit efed0ff

7 files changed

Lines changed: 137 additions & 95 deletions

File tree

‎.github/workflows/deploy.yaml‎

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,68 @@
1+
# This workflow will upload a Python Package to PyPI when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
19
name: Deploy
210

311
on:
412
release:
5-
types:
6-
- published
13+
types: [published]
14+
15+
permissions:
16+
contents: read
717

818
jobs:
9-
build:
10-
if: github.repository == 'lovemefan/SenseVoice-python'
11-
runs-on: ubuntu-20.04
19+
release-build:
20+
runs-on: ubuntu-latest
1221

1322
steps:
14-
- uses: actions/checkout@v2
15-
- run: |
16-
git fetch --prune --unshallow
23+
- uses: actions/checkout@v6
1724

18-
- name: Set up Python 3.8
19-
uses: actions/setup-python@v1
25+
- uses: actions/setup-python@v6
2026
with:
21-
python-version: 3.8
27+
python-version: "3.13"
2228

23-
- name: Install dependencies
29+
- name: Build release distributions
2430
run: |
2531
python -m pip install -U pip
26-
python -m pip install -U twine wheel
32+
python -m pip install -U twine wheel build
33+
python -m build
34+
twine check dist/*
2735
28-
- name: Build package
29-
run: |
30-
python setup.py sdist bdist_wheel
31-
twine check dist/*
36+
- name: Upload distributions
37+
uses: actions/upload-artifact@v7
38+
with:
39+
name: release-dists
40+
path: dist/
41+
42+
pypi-publish:
43+
if: github.repository == 'lovemefan/SenseVoice-python'
44+
runs-on: ubuntu-latest
45+
needs:
46+
- release-build
47+
permissions:
48+
id-token: write
49+
50+
environment:
51+
name: pypi
52+
# OPTIONAL: uncomment to include your PyPI project URL in the deployment status:
53+
# url: https://pypi.org/project/sensevoice-onnx/
54+
55+
steps:
56+
- name: Retrieve release distributions
57+
uses: actions/download-artifact@v8
58+
with:
59+
name: release-dists
60+
path: dist/
3261

33-
- name: Publish package to PyPI
34-
if: github.event.action == 'published'
35-
uses: pypa/gh-action-pypi-publish@master
62+
- name: Publish release distributions to PyPI
63+
if: github.event.action == 'published' # doubt this is needed?
64+
uses: pypa/gh-action-pypi-publish@release/v1
3665
with:
3766
user: __token__
38-
password: ${{ secrets.pypi_token }}
67+
password: ${{ secrets.pypi_token }}
68+
packages-dir: dist/

‎.github/workflows/python-package.yaml‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,25 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
os: [ubuntu-latest, windows-latest, macos-latest]
20-
python-version: ["3.8", "3.9", "3.10", "3.11"]
20+
python-version: ["3.9", "3.11", "3.13"]
21+
exclude:
22+
- os: windows-latest # no wheel for kaldi_native_fbank at time of writing, build fails
23+
python-version: '3.14'
2124

2225
steps:
23-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@v6
27+
2428
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v3
29+
uses: actions/setup-python@v6
2630
with:
2731
python-version: ${{ matrix.python-version }}
32+
2833
- name: Install dependencies
2934
run: |
30-
python3 -m pip install --upgrade pip
31-
pip install -U setuptools wheel
32-
pip3 install -e .
35+
python -m pip install --upgrade pip
36+
python -m pip install -U setuptools wheel onnxruntime
37+
pip install -e .
3338
3439
- name: Test audio
3540
run: |
36-
sensevoice --audio sensevoice/resource/asr_example_zh.wav
41+
sensevoice --audio sensevoice/resource/asr_example_zh.wav

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist
2+
/sensevoice_onnx.egg-info

‎README-EN.md‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,23 @@
22

33
[「简体中文」](./README.md)|「English」
44

5-
[SenseVoice](https://github.com/FunAudioLLM/SenseVoice) is an audio foundation model
6-
with audio understanding capabilities,
7-
including Automatic Speech Recognition (ASR), Language Identification (LID),
8-
Speech Emotion Recognition (SER), and Acoustic Event Classification (AEC)
9-
or Acoustic Event Detection (AED).
5+
---
106

11-
Currently, SenseVoice-small supports multilingual speech recognition, emotion recognition,
12-
and event detection for Chinese, Cantonese, English, Japanese, and Korean, with extremely low inference latency.
13-
This project provides the necessary ONNX environment installation
14-
and inference methods for the Python version of the SenseVoice model.
7+
[SenseVoice](https://github.com/FunAudioLLM/SenseVoice) is an audio foundation model with audio understanding capabilities, including Automatic Speech Recognition (ASR), Language Identification (LID), Speech Emotion Recognition (SER), and Acoustic Event Classification (AEC) or Acoustic Event Detection (AED).
8+
9+
Currently, SenseVoice-small supports multilingual speech recognition, emotion recognition, and event detection for Chinese, Cantonese, English, Japanese, and Korean, with extremely low inference latency.
10+
11+
This project provides the necessary ONNX environment installation and inference methods for the Python version of the SenseVoice model.
1512

1613
## Usage
1714

18-
### Installation
15+
### Installation
1916

2017
```bash
2118
pip install sensevoice-onnx
2219

20+
# optionally install as sensevoice-onnx[gpu] or sensevoice-onnx[cpu] if you don't already have an onnxruntime installed
21+
2322
# or pip from GitHub
2423
pip install git+https://github.com/lovemefan/SenseVoice-python.git
2524
```
@@ -54,4 +53,4 @@ optional arguments:
5453
2024-07-19 07:22:43,102 INFO [sense_voice.py:81] [0.61s - 5.53s] <|zh|><|NEUTRAL|><|Speech|><|woitn|>欢迎大家来体验达摩院推出的语音识别模型
5554
2024-07-19 07:22:43,102 INFO [sense_voice.py:83] Decoder audio takes 0.31638407707214355 seconds
5655
2024-07-19 07:22:43,103 INFO [sense_voice.py:84] The RTF is 0.05669965538927304.
57-
```
56+
```

‎pyproject.toml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel", "build", "twine"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
requires-python = ">= 3.9"
7+
name = "sensevoice-onnx"
8+
version = "1.1.1"
9+
authors = [ {name = "Lovemefan", email = "lovemefan@outlook.com"} ]
10+
description = "SenseVoice-python: open source multi-language asr system from funasr with onnxruntime"
11+
readme = "README-EN.md"
12+
license = "MIT"
13+
dependencies = [
14+
"numpy>=1.24.4",
15+
"kaldi_native_fbank",
16+
"sentencepiece>=0.2.0",
17+
"soundfile>=0.12.1",
18+
"huggingface_hub",
19+
"protobuf>=3.19.6"
20+
]
21+
keywords = ["asr", "speech", "ai", "audio-to-text"]
22+
classifiers = [
23+
"Programming Language :: Python",
24+
"Programming Language :: Python :: 3",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3.12",
29+
"Programming Language :: Python :: 3.13",
30+
"Development Status :: 5 - Production/Stable",
31+
"Intended Audience :: Science/Research",
32+
"Operating System :: Microsoft :: Windows",
33+
"Operating System :: POSIX :: Linux",
34+
"Topic :: Multimedia :: Sound/Audio :: Speech",
35+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
36+
"Topic :: Software Development :: Libraries :: Python Modules"
37+
]
38+
39+
[project.scripts]
40+
sensevoice = "sensevoice.sense_voice:main"
41+
42+
[project.optional-dependencies]
43+
cpu = ["onnxruntime>=1.17.0"]
44+
gpu = ["onnxruntime-gpu>=1.17.0"]
45+
46+
[project.urls]
47+
Homepage = "https://github.com/lovemefan/SenseVoice-python"
48+
Repository = "https://github.com/lovemefan/SenseVoice-python.git"

‎sensevoice/sense_voice.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
# @Time :2024/7/18 15:40
44
# @Author :lovemefan
55
# @Email :lovemefan@outlook.com
6+
7+
try:
8+
import onnxruntime
9+
except ImportError:
10+
raise ImportError(
11+
"\n\n[SenseVoice Error]: An ONNX Runtime environment was not found.\n"
12+
"Please install your preferred backend:\n"
13+
" - onnxruntime\n"
14+
" - onnxruntime-gpu\n"
15+
" - onnxruntime-directml\n"
16+
)
17+
618
import argparse
719
import logging
820
import os

‎setup.py‎

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,60 +3,6 @@
33
# @Time :2024/7/19 09:23
44
# @Author :lovemefan
55
# @Email :lovemefan@outlook.com
6+
from setuptools import setup
67

7-
8-
import os
9-
from pathlib import Path
10-
11-
from setuptools import find_namespace_packages, setup
12-
13-
dirname = Path(os.path.dirname(__file__))
14-
version = "1.1.0"
15-
16-
requirements = {
17-
"install": [
18-
"setuptools",
19-
"numpy>=1.24.4",
20-
"kaldi_native_fbank",
21-
"onnxruntime>=1.17.0",
22-
"sentencepiece>=0.2.0",
23-
"soundfile>=0.12.1",
24-
"huggingface_hub",
25-
"protobuf>=3.19.6"
26-
]
27-
}
28-
29-
install_requires = requirements["install"]
30-
31-
32-
setup(
33-
name="sensevoice-onnx",
34-
version=version,
35-
url="https://github.com/lovemefan/SenseVoice-python",
36-
author="Lovemefan",
37-
author_email="lovemefan@outlook.com",
38-
description="SenseVoice-python: A enterprise-grade open source multi-language asr system from funasr opensource "
39-
"with onnxruntime",
40-
long_description=open(os.path.join(dirname, "README.md"), encoding="utf-8").read(),
41-
long_description_content_type="text/markdown",
42-
license="MIT", # SPDX identifier
43-
packages=find_namespace_packages(),
44-
include_package_data=True,
45-
install_requires=install_requires,
46-
python_requires=">=3.8.0",
47-
entry_points={"console_scripts": ["sensevoice=sensevoice.sense_voice:main"]},
48-
classifiers=[
49-
"Programming Language :: Python",
50-
"Programming Language :: Python :: 3",
51-
"Programming Language :: Python :: 3.8",
52-
"Programming Language :: Python :: 3.9",
53-
"Programming Language :: Python :: 3.10",
54-
"Programming Language :: Python :: 3.11",
55-
"Development Status :: 5 - Production/Stable",
56-
"Intended Audience :: Science/Research",
57-
"Operating System :: POSIX :: Linux",
58-
"Topic :: Multimedia :: Sound/Audio :: Speech",
59-
"Topic :: Scientific/Engineering :: Artificial Intelligence",
60-
"Topic :: Software Development :: Libraries :: Python Modules",
61-
],
62-
)
8+
setup()

0 commit comments

Comments
 (0)