akiki 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- akiki-0.0.1/LICENSE +201 -0
- akiki-0.0.1/MANIFEST.in +2 -0
- akiki-0.0.1/PKG-INFO +66 -0
- akiki-0.0.1/README.md +47 -0
- akiki-0.0.1/pyproject.toml +36 -0
- akiki-0.0.1/setup.cfg +4 -0
- akiki-0.0.1/src/akiki/__init__.py +5 -0
- akiki-0.0.1/src/akiki/__main__.py +29 -0
- akiki-0.0.1/src/akiki/models/MODEL_CARD.md +22 -0
- akiki-0.0.1/src/akiki/models/candidate-1.json +29 -0
- akiki-0.0.1/src/akiki/models/candidate-1.onnx +0 -0
- akiki-0.0.1/src/akiki/vad.py +73 -0
- akiki-0.0.1/src/akiki.egg-info/PKG-INFO +66 -0
- akiki-0.0.1/src/akiki.egg-info/SOURCES.txt +17 -0
- akiki-0.0.1/src/akiki.egg-info/dependency_links.txt +1 -0
- akiki-0.0.1/src/akiki.egg-info/entry_points.txt +2 -0
- akiki-0.0.1/src/akiki.egg-info/requires.txt +3 -0
- akiki-0.0.1/src/akiki.egg-info/top_level.txt +1 -0
- akiki-0.0.1/tests/test_vad.py +33 -0
akiki-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
akiki-0.0.1/MANIFEST.in
ADDED
akiki-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: akiki
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Local streaming voice activity detection with Akiki VAD
|
|
5
|
+
Author: Akiki AI
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://huggingface.co/Akiki-AI
|
|
8
|
+
Keywords: vad,audio,speech,voice-activity-detection
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: numpy>=1.24
|
|
16
|
+
Requires-Dist: onnxruntime>=1.17
|
|
17
|
+
Requires-Dist: soundfile>=0.12
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# Akiki
|
|
21
|
+
|
|
22
|
+
Run streaming voice activity detection locally with a small bundled Akiki VAD
|
|
23
|
+
model. No model download, network connection or PyTorch is needed at runtime.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install akiki
|
|
27
|
+
akiki --version
|
|
28
|
+
akiki recording.wav
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Audio must be mono at 16,000 Hz. The CLI prints one JSON object per complete
|
|
32
|
+
16 ms frame: its start, end, speech probability and threshold decision.
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import soundfile as sf
|
|
36
|
+
from akiki import VAD
|
|
37
|
+
|
|
38
|
+
audio, sample_rate = sf.read("recording.wav", dtype="float32")
|
|
39
|
+
vad = VAD()
|
|
40
|
+
for frame in vad.push(audio, sample_rate=sample_rate):
|
|
41
|
+
print(frame)
|
|
42
|
+
vad.reset() # Start a new recording.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`push()` accepts arbitrary buffer sizes and retains incomplete frames between
|
|
46
|
+
calls. A trailing incomplete frame is left pending; it is not padded or scored.
|
|
47
|
+
Use `VAD(threshold=0.6)` or `akiki recording.wav --threshold 0.6` to change the
|
|
48
|
+
threshold. Probabilities are always returned.
|
|
49
|
+
|
|
50
|
+
Version 0.0.1 bundles the experimental **candidate-1, seed 1729** model, with
|
|
51
|
+
210,561 parameters and a 16 ms output hop. It is an initial functional release;
|
|
52
|
+
future versions will supply the production Akiki VAD models. Training provenance
|
|
53
|
+
and checksums are included in `akiki/models/MODEL_CARD.md` and the model metadata.
|
|
54
|
+
|
|
55
|
+
Code and bundled Akiki weights are provided under Apache-2.0. Source audio and
|
|
56
|
+
the independent teacher retain their original licences; neither is distributed
|
|
57
|
+
in this package.
|
|
58
|
+
|
|
59
|
+
To publish this release from the project directory:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uv build
|
|
63
|
+
uv publish dist/akiki-0.0.1*
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Authenticate to PyPI locally when prompted. The project contains no credentials.
|
akiki-0.0.1/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Akiki
|
|
2
|
+
|
|
3
|
+
Run streaming voice activity detection locally with a small bundled Akiki VAD
|
|
4
|
+
model. No model download, network connection or PyTorch is needed at runtime.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install akiki
|
|
8
|
+
akiki --version
|
|
9
|
+
akiki recording.wav
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Audio must be mono at 16,000 Hz. The CLI prints one JSON object per complete
|
|
13
|
+
16 ms frame: its start, end, speech probability and threshold decision.
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
import soundfile as sf
|
|
17
|
+
from akiki import VAD
|
|
18
|
+
|
|
19
|
+
audio, sample_rate = sf.read("recording.wav", dtype="float32")
|
|
20
|
+
vad = VAD()
|
|
21
|
+
for frame in vad.push(audio, sample_rate=sample_rate):
|
|
22
|
+
print(frame)
|
|
23
|
+
vad.reset() # Start a new recording.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`push()` accepts arbitrary buffer sizes and retains incomplete frames between
|
|
27
|
+
calls. A trailing incomplete frame is left pending; it is not padded or scored.
|
|
28
|
+
Use `VAD(threshold=0.6)` or `akiki recording.wav --threshold 0.6` to change the
|
|
29
|
+
threshold. Probabilities are always returned.
|
|
30
|
+
|
|
31
|
+
Version 0.0.1 bundles the experimental **candidate-1, seed 1729** model, with
|
|
32
|
+
210,561 parameters and a 16 ms output hop. It is an initial functional release;
|
|
33
|
+
future versions will supply the production Akiki VAD models. Training provenance
|
|
34
|
+
and checksums are included in `akiki/models/MODEL_CARD.md` and the model metadata.
|
|
35
|
+
|
|
36
|
+
Code and bundled Akiki weights are provided under Apache-2.0. Source audio and
|
|
37
|
+
the independent teacher retain their original licences; neither is distributed
|
|
38
|
+
in this package.
|
|
39
|
+
|
|
40
|
+
To publish this release from the project directory:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv build
|
|
44
|
+
uv publish dist/akiki-0.0.1*
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Authenticate to PyPI locally when prompted. The project contains no credentials.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.3", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "akiki"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "Local streaming voice activity detection with Akiki VAD"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{name = "Akiki AI"}]
|
|
14
|
+
keywords = ["vad", "audio", "speech", "voice-activity-detection"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: Multimedia :: Sound/Audio :: Analysis",
|
|
19
|
+
]
|
|
20
|
+
dependencies = ["numpy>=1.24", "onnxruntime>=1.17", "soundfile>=0.12"]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://huggingface.co/Akiki-AI"
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
akiki = "akiki.__main__:main"
|
|
27
|
+
|
|
28
|
+
[tool.setuptools.packages.find]
|
|
29
|
+
where = ["src"]
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.package-data]
|
|
32
|
+
akiki = ["models/*.onnx", "models/*.json", "models/*.md"]
|
|
33
|
+
|
|
34
|
+
[tool.pytest.ini_options]
|
|
35
|
+
pythonpath = ["src"]
|
|
36
|
+
testpaths = ["tests"]
|
akiki-0.0.1/setup.cfg
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from dataclasses import asdict
|
|
2
|
+
import argparse
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
from . import __version__
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
parser = argparse.ArgumentParser(description="Run Akiki VAD locally on mono 16 kHz audio.")
|
|
10
|
+
parser.add_argument("--version", action="version", version=f"akiki {__version__}")
|
|
11
|
+
parser.add_argument("audio", help="Input audio file")
|
|
12
|
+
parser.add_argument("--threshold", type=float, default=None)
|
|
13
|
+
args = parser.parse_args()
|
|
14
|
+
import soundfile as sf
|
|
15
|
+
from . import VAD
|
|
16
|
+
try:
|
|
17
|
+
detector = VAD(threshold=args.threshold)
|
|
18
|
+
with sf.SoundFile(args.audio) as source:
|
|
19
|
+
if source.samplerate != 16000 or source.channels != 1:
|
|
20
|
+
raise ValueError("Expected mono 16 kHz audio")
|
|
21
|
+
for block in source.blocks(blocksize=16000, dtype="float32"):
|
|
22
|
+
for frame in detector.push(block):
|
|
23
|
+
print(json.dumps(asdict(frame)))
|
|
24
|
+
except (OSError, ValueError, RuntimeError) as error:
|
|
25
|
+
parser.exit(2, f"akiki: {error}\n")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if __name__ == "__main__":
|
|
29
|
+
main()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Bundled model: candidate-1, seed 1729
|
|
2
|
+
|
|
3
|
+
Experimental Akiki CNN+GRU128, 210,561 parameters, FP32 ONNX with full waveform
|
|
4
|
+
frontend and explicit recurrent state. Mono 16 kHz; 256 new samples per output
|
|
5
|
+
(16 ms), with 320 past context samples. Threshold 0.5.
|
|
6
|
+
|
|
7
|
+
Fresh random student initialization; independent cached Silero 6.2.3 soft
|
|
8
|
+
teacher labels on approximately 994 hours of commercially permitted training
|
|
9
|
+
audio. The cache retains 58 explicitly instrumental zero-label exceptions.
|
|
10
|
+
Native 32 ms targets supervise the mean of two 16 ms student outputs.
|
|
11
|
+
No TEN or Silero v5 supervision and no AMI/ICSI training audio.
|
|
12
|
+
|
|
13
|
+
Selected at training window 24 in candidate-study-v1. That historical study used
|
|
14
|
+
85% teacher and 15% AMI validation loss for checkpoint selection, including for
|
|
15
|
+
candidate-1. AMI validation did not contribute gradients. This package freezes
|
|
16
|
+
that existing candidate; it does not contain the subsequently requested rerun.
|
|
17
|
+
|
|
18
|
+
Code and these Akiki weights: Apache-2.0, matching the Akiki repository licence.
|
|
19
|
+
Silero VAD is MIT licensed: https://github.com/snakers4/silero-vad . No Silero
|
|
20
|
+
weights or source audio are included. Dataset audio retains its original terms.
|
|
21
|
+
|
|
22
|
+
ONNX SHA256: `80c2bc5761f29a4abf98420139d2be4975084d087b52278e1b91084299607c4c`.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bytes": 1117830,
|
|
3
|
+
"created_utc": "2026-10-24T20:07:21Z",
|
|
4
|
+
"input_policy": "576 samples = 320 past + 256 current; fixed batch 1, 16kHz; complete frontend included",
|
|
5
|
+
"onnx_sha256": "80c2bc5761f29a4abf98420139d2be4975084d087b52278e1b91084299607c4c",
|
|
6
|
+
"origin": {
|
|
7
|
+
"checkpoint_sha256": "bc0feb888b8cea73678acc7bc3a4b02c1f1d90f266c7b77431565f55a63c849b",
|
|
8
|
+
"family": "candidate-1",
|
|
9
|
+
"human_test_checkpoint_selection": false,
|
|
10
|
+
"published_ami_icsi_annotations_used": false,
|
|
11
|
+
"recipe_sha256": "77a1f2865008125866ffb811b1fe66c1b0582fc848cb149a1931810c29e7fa0f",
|
|
12
|
+
"seed": 1729,
|
|
13
|
+
"teacher_release": "6.2.3",
|
|
14
|
+
"teacher_sha256": "1a153a22f4509e292a94e67d6f9b85e8deb25b4988682b7e174c65279d8788e3",
|
|
15
|
+
"teacher_v5_supervision_used": false,
|
|
16
|
+
"ten_supervision_used": false,
|
|
17
|
+
"threshold_source": "Frozen0.5; same validation rule across all families; no benchmark threshold tuning"
|
|
18
|
+
},
|
|
19
|
+
"spec": {
|
|
20
|
+
"chunk_samples": 256,
|
|
21
|
+
"context_samples": 320,
|
|
22
|
+
"frontend": "Silero-v5-16k",
|
|
23
|
+
"hidden": 128,
|
|
24
|
+
"kind": "gru",
|
|
25
|
+
"sample_rate": 16000
|
|
26
|
+
},
|
|
27
|
+
"threshold": 0.5,
|
|
28
|
+
"threshold_source": "Frozen0.5; same validation rule across all families; no benchmark threshold tuning"
|
|
29
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""CPU ONNX inference for the bundled full-waveform Akiki model."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
import hashlib
|
|
6
|
+
import json
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
|
|
11
|
+
SAMPLE_RATE = 16000
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class SpeechFrame:
|
|
16
|
+
start_seconds: float
|
|
17
|
+
end_seconds: float
|
|
18
|
+
probability: float
|
|
19
|
+
speech: bool
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class VAD:
|
|
23
|
+
"""Stateful 16 kHz mono VAD. Call reset() between recordings."""
|
|
24
|
+
|
|
25
|
+
def __init__(self, model_path: str | Path | None = None, threshold: float | None = None):
|
|
26
|
+
import onnxruntime as ort
|
|
27
|
+
path = Path(model_path) if model_path is not None else Path(__file__).parent / "models/candidate-1.onnx"
|
|
28
|
+
metadata = json.loads(path.with_suffix(".json").read_text())
|
|
29
|
+
if hashlib.sha256(path.read_bytes()).hexdigest() != metadata["onnx_sha256"]:
|
|
30
|
+
raise ValueError("Model checksum does not match its metadata")
|
|
31
|
+
spec = metadata["spec"]
|
|
32
|
+
self.chunk_samples = int(spec["chunk_samples"])
|
|
33
|
+
self.context_samples = int(spec["context_samples"])
|
|
34
|
+
self.hidden = int(spec["hidden"])
|
|
35
|
+
if spec["kind"] != "gru" or (self.chunk_samples, self.context_samples) not in {(256, 320), (512, 64)}:
|
|
36
|
+
raise ValueError("Expected an Akiki full-waveform GRU ONNX model")
|
|
37
|
+
self.threshold = float(metadata["threshold"] if threshold is None else threshold)
|
|
38
|
+
if not np.isfinite(self.threshold) or not 0 <= self.threshold <= 1:
|
|
39
|
+
raise ValueError("Threshold must lie between zero and one")
|
|
40
|
+
options = ort.SessionOptions()
|
|
41
|
+
options.intra_op_num_threads = options.inter_op_num_threads = 1
|
|
42
|
+
self.session = ort.InferenceSession(str(path), sess_options=options, providers=["CPUExecutionProvider"])
|
|
43
|
+
if {v.name for v in self.session.get_inputs()} != {"audio_with_context", "h"}:
|
|
44
|
+
raise ValueError("Unexpected ONNX inputs")
|
|
45
|
+
self.reset()
|
|
46
|
+
|
|
47
|
+
def reset(self) -> None:
|
|
48
|
+
self.context = np.zeros(self.context_samples, dtype=np.float32)
|
|
49
|
+
self.state = np.zeros((1, 1, self.hidden), dtype=np.float32)
|
|
50
|
+
self.pending = np.empty(0, dtype=np.float32)
|
|
51
|
+
self.completed_samples = 0
|
|
52
|
+
|
|
53
|
+
def push(self, samples, sample_rate: int = SAMPLE_RATE) -> list[SpeechFrame]:
|
|
54
|
+
audio = np.asarray(samples, dtype=np.float32)
|
|
55
|
+
if sample_rate != SAMPLE_RATE or audio.ndim != 1 or not np.isfinite(audio).all():
|
|
56
|
+
raise ValueError("Expected finite mono 16 kHz audio samples")
|
|
57
|
+
audio = np.concatenate([self.pending, audio])
|
|
58
|
+
complete = len(audio) // self.chunk_samples * self.chunk_samples
|
|
59
|
+
frames = []
|
|
60
|
+
for start in range(0, complete, self.chunk_samples):
|
|
61
|
+
window = np.concatenate([self.context, audio[start:start + self.chunk_samples]])
|
|
62
|
+
probability, state = self.session.run(None, {"audio_with_context": window[None], "h": self.state})
|
|
63
|
+
probability = float(np.asarray(probability).reshape(-1)[0])
|
|
64
|
+
if not np.isfinite(probability) or not 0 <= probability <= 1:
|
|
65
|
+
raise RuntimeError("Model returned an invalid speech probability")
|
|
66
|
+
begin = self.completed_samples
|
|
67
|
+
self.state = state
|
|
68
|
+
self.context = window[-self.context_samples:].copy()
|
|
69
|
+
self.completed_samples += self.chunk_samples
|
|
70
|
+
frames.append(SpeechFrame(begin / SAMPLE_RATE, self.completed_samples / SAMPLE_RATE,
|
|
71
|
+
probability, probability >= self.threshold))
|
|
72
|
+
self.pending = audio[complete:].copy()
|
|
73
|
+
return frames
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: akiki
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Local streaming voice activity detection with Akiki VAD
|
|
5
|
+
Author: Akiki AI
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://huggingface.co/Akiki-AI
|
|
8
|
+
Keywords: vad,audio,speech,voice-activity-detection
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: numpy>=1.24
|
|
16
|
+
Requires-Dist: onnxruntime>=1.17
|
|
17
|
+
Requires-Dist: soundfile>=0.12
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# Akiki
|
|
21
|
+
|
|
22
|
+
Run streaming voice activity detection locally with a small bundled Akiki VAD
|
|
23
|
+
model. No model download, network connection or PyTorch is needed at runtime.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install akiki
|
|
27
|
+
akiki --version
|
|
28
|
+
akiki recording.wav
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Audio must be mono at 16,000 Hz. The CLI prints one JSON object per complete
|
|
32
|
+
16 ms frame: its start, end, speech probability and threshold decision.
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import soundfile as sf
|
|
36
|
+
from akiki import VAD
|
|
37
|
+
|
|
38
|
+
audio, sample_rate = sf.read("recording.wav", dtype="float32")
|
|
39
|
+
vad = VAD()
|
|
40
|
+
for frame in vad.push(audio, sample_rate=sample_rate):
|
|
41
|
+
print(frame)
|
|
42
|
+
vad.reset() # Start a new recording.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`push()` accepts arbitrary buffer sizes and retains incomplete frames between
|
|
46
|
+
calls. A trailing incomplete frame is left pending; it is not padded or scored.
|
|
47
|
+
Use `VAD(threshold=0.6)` or `akiki recording.wav --threshold 0.6` to change the
|
|
48
|
+
threshold. Probabilities are always returned.
|
|
49
|
+
|
|
50
|
+
Version 0.0.1 bundles the experimental **candidate-1, seed 1729** model, with
|
|
51
|
+
210,561 parameters and a 16 ms output hop. It is an initial functional release;
|
|
52
|
+
future versions will supply the production Akiki VAD models. Training provenance
|
|
53
|
+
and checksums are included in `akiki/models/MODEL_CARD.md` and the model metadata.
|
|
54
|
+
|
|
55
|
+
Code and bundled Akiki weights are provided under Apache-2.0. Source audio and
|
|
56
|
+
the independent teacher retain their original licences; neither is distributed
|
|
57
|
+
in this package.
|
|
58
|
+
|
|
59
|
+
To publish this release from the project directory:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uv build
|
|
63
|
+
uv publish dist/akiki-0.0.1*
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Authenticate to PyPI locally when prompted. The project contains no credentials.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
src/akiki/__init__.py
|
|
6
|
+
src/akiki/__main__.py
|
|
7
|
+
src/akiki/vad.py
|
|
8
|
+
src/akiki.egg-info/PKG-INFO
|
|
9
|
+
src/akiki.egg-info/SOURCES.txt
|
|
10
|
+
src/akiki.egg-info/dependency_links.txt
|
|
11
|
+
src/akiki.egg-info/entry_points.txt
|
|
12
|
+
src/akiki.egg-info/requires.txt
|
|
13
|
+
src/akiki.egg-info/top_level.txt
|
|
14
|
+
src/akiki/models/MODEL_CARD.md
|
|
15
|
+
src/akiki/models/candidate-1.json
|
|
16
|
+
src/akiki/models/candidate-1.onnx
|
|
17
|
+
tests/test_vad.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
akiki
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pytest
|
|
3
|
+
from akiki import VAD
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_streaming_matches_one_shot_and_reset():
|
|
7
|
+
audio = np.random.default_rng(1729).normal(0, .02, 256 * 9 + 71).astype(np.float32)
|
|
8
|
+
detector = VAD()
|
|
9
|
+
expected = detector.push(audio)
|
|
10
|
+
assert len(expected) == 9 and len(detector.pending) == 71
|
|
11
|
+
detector.reset()
|
|
12
|
+
actual = [f for i in range(0, len(audio), 173) for f in detector.push(audio[i:i+173])]
|
|
13
|
+
assert actual == expected
|
|
14
|
+
assert actual[0].start_seconds == 0 and actual[-1].end_seconds == .144
|
|
15
|
+
detector.reset()
|
|
16
|
+
assert detector.push(audio) == expected
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_invalid_audio_does_not_mutate_state():
|
|
20
|
+
detector = VAD()
|
|
21
|
+
detector.push(np.zeros(37, np.float32))
|
|
22
|
+
before = detector.pending.copy(), detector.state.copy(), detector.context.copy()
|
|
23
|
+
for audio, rate in [(np.zeros(20), 8000), (np.zeros((20, 2)), 16000), (np.array([np.nan]), 16000)]:
|
|
24
|
+
with pytest.raises(ValueError):
|
|
25
|
+
detector.push(audio, rate)
|
|
26
|
+
for actual, expected in zip((detector.pending, detector.state, detector.context), before):
|
|
27
|
+
np.testing.assert_array_equal(actual, expected)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_threshold_range():
|
|
31
|
+
for threshold in [-.1, 1.1, float('nan')]:
|
|
32
|
+
with pytest.raises(ValueError, match="Threshold"):
|
|
33
|
+
VAD(threshold=threshold)
|