Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2024-01-27 13:01:54 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2024-01-27 13:01:54 +0800
Commit
44efff4e47a30e17b657b22d2fe5fa1be002c882
44efff4e
1 parent
7ae73e75
Fix CI tests for Python and JNI. (#554)
显示空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
40 行增加
和
20 行删除
.github/workflows/test-pip-install.yaml
android/SherpaOnnxSpeakerIdentification/app/src/main/java/com/k2fsa/sherpa/onnx/speaker/identification/Speaker.kt
kotlin-api-examples/faked-log.kt
kotlin-api-examples/run.sh
setup.py
sherpa-onnx/python/sherpa_onnx/cli.py
sherpa-onnx/python/sherpa_onnx/utils.py
.github/workflows/test-pip-install.yaml
查看文件 @
44efff4
...
...
@@ -48,8 +48,9 @@ jobs:
shell
:
bash
run
:
|
pip install --verbose sherpa-onnx
# python3 -m pip install --verbose .
-
name
:
Test sherp-onnx
-
name
:
Test sherp
a
-onnx
shell
:
bash
run
:
|
python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)"
...
...
@@ -68,8 +69,8 @@ jobs:
export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH
export PATH=/c/hostedtoolcache/windows/Python/3.11.7/x64/bin:$PATH
sherpa-onnx --help
sherpa-onnx-keyword-spotter --help
sherpa-onnx-offline --help
sherpa-onnx-offline-tts --help
...
...
android/SherpaOnnxSpeakerIdentification/app/src/main/java/com/k2fsa/sherpa/onnx/speaker/identification/Speaker.kt
查看文件 @
44efff4
...
...
@@ -2,9 +2,8 @@ package com.k2fsa.sherpa.onnx
import android.content.res.AssetManager
import android.util.Log
import com.k2fsa.sherpa.onnx.speaker.identification.TAG
private val TAG = "sherpa-onnx"
data class SpeakerEmbeddingExtractorConfig(
val model: String,
var numThreads: Int = 1,
...
...
kotlin-api-examples/faked-log.kt
0 → 100644
查看文件 @
44efff4
package android.util
class Log {
companion object {
fun i(tag: String, msg: String) {
println("$tag, $msg")
}
}
}
...
...
kotlin-api-examples/run.sh
查看文件 @
44efff4
...
...
@@ -62,7 +62,7 @@ if [ ! -f ./vits-piper-en_US-amy-low/en_US-amy-low.onnx ]; then
rm vits-piper-en_US-amy-low.tar.bz2
fi
kotlinc-jvm -include-runtime -d main.jar Main.kt WaveReader.kt SherpaOnnx.kt faked-asset-manager.kt Tts.kt Speaker.kt
kotlinc-jvm -include-runtime -d main.jar Main.kt WaveReader.kt SherpaOnnx.kt faked-asset-manager.kt Tts.kt Speaker.kt
faked-log.kt
ls -lh main.jar
...
...
setup.py
查看文件 @
44efff4
...
...
@@ -36,13 +36,6 @@ package_name = "sherpa-onnx"
with
open
(
"sherpa-onnx/python/sherpa_onnx/__init__.py"
,
"a"
)
as
f
:
f
.
write
(
f
"__version__ = '{get_package_version()}'
\n
"
)
install_requires
=
[
"numpy"
,
"sentencepiece==0.1.96; python_version < '3.11'"
,
"sentencepiece; python_version >= '3.11'"
,
"click>=7.1.1"
,
]
def
get_binaries_to_install
():
bin_dir
=
Path
(
"build"
)
/
"sherpa_onnx"
/
"bin"
...
...
@@ -91,7 +84,6 @@ def get_binaries_to_install():
setuptools
.
setup
(
name
=
package_name
,
python_requires
=
">=3.6"
,
install_requires
=
install_requires
,
version
=
get_package_version
(),
author
=
"The sherpa-onnx development team"
,
author_email
=
"dpovey@gmail.com"
,
...
...
sherpa-onnx/python/sherpa_onnx/cli.py
查看文件 @
44efff4
# Copyright (c) 2023 Xiaomi Corporation
import
logging
import
click
try
:
import
click
except
ImportError
:
print
(
'Please run'
)
print
(
' pip install click'
)
print
(
'before you continue'
)
raise
from
pathlib
import
Path
from
sherpa_onnx
import
text2token
...
...
sherpa-onnx/python/sherpa_onnx/utils.py
查看文件 @
44efff4
...
...
@@ -4,12 +4,6 @@ import re
from
pathlib
import
Path
from
typing
import
List
,
Optional
,
Union
import
sentencepiece
as
spm
from
pypinyin
import
pinyin
from
pypinyin.contrib.tone_convert
import
to_initials
,
to_finals_tone
def
text2token
(
texts
:
List
[
str
],
tokens
:
str
,
...
...
@@ -38,6 +32,23 @@ def text2token(
Return the encoded texts, it is a list of a list of token ids if output_ids
is True, or it is a list of list of tokens.
"""
try
:
import
sentencepiece
as
spm
except
ImportError
:
print
(
'Please run'
)
print
(
' pip install sentencepiece'
)
print
(
'before you continue'
)
raise
try
:
from
pypinyin
import
pinyin
from
pypinyin.contrib.tone_convert
import
to_initials
,
to_finals_tone
except
ImportError
:
print
(
'Please run'
)
print
(
' pip install pypinyin'
)
print
(
'before you continue'
)
raise
assert
Path
(
tokens
)
.
is_file
(),
f
"File not exists, {tokens}"
tokens_table
=
{}
with
open
(
tokens
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
...
...
请
注册
或
登录
后发表评论