Fix CI tests for Python and JNI. (#554)
This commit is contained in:
5
.github/workflows/test-pip-install.yaml
vendored
5
.github/workflows/test-pip-install.yaml
vendored
@@ -48,8 +48,9 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
pip install --verbose sherpa-onnx
|
pip install --verbose sherpa-onnx
|
||||||
|
# python3 -m pip install --verbose .
|
||||||
|
|
||||||
- name: Test sherp-onnx
|
- name: Test sherpa-onnx
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)"
|
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.10.11/x64/bin:$PATH
|
||||||
export PATH=/c/hostedtoolcache/windows/Python/3.11.7/x64/bin:$PATH
|
export PATH=/c/hostedtoolcache/windows/Python/3.11.7/x64/bin:$PATH
|
||||||
|
|
||||||
|
|
||||||
sherpa-onnx --help
|
sherpa-onnx --help
|
||||||
|
sherpa-onnx-keyword-spotter --help
|
||||||
sherpa-onnx-offline --help
|
sherpa-onnx-offline --help
|
||||||
sherpa-onnx-offline-tts --help
|
sherpa-onnx-offline-tts --help
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ package com.k2fsa.sherpa.onnx
|
|||||||
|
|
||||||
import android.content.res.AssetManager
|
import android.content.res.AssetManager
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.k2fsa.sherpa.onnx.speaker.identification.TAG
|
|
||||||
|
|
||||||
|
|
||||||
|
private val TAG = "sherpa-onnx"
|
||||||
data class SpeakerEmbeddingExtractorConfig(
|
data class SpeakerEmbeddingExtractorConfig(
|
||||||
val model: String,
|
val model: String,
|
||||||
var numThreads: Int = 1,
|
var numThreads: Int = 1,
|
||||||
|
|||||||
10
kotlin-api-examples/faked-log.kt
Normal file
10
kotlin-api-examples/faked-log.kt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package android.util
|
||||||
|
|
||||||
|
class Log {
|
||||||
|
companion object {
|
||||||
|
fun i(tag: String, msg: String) {
|
||||||
|
println("$tag, $msg")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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
|
rm vits-piper-en_US-amy-low.tar.bz2
|
||||||
fi
|
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
|
ls -lh main.jar
|
||||||
|
|
||||||
|
|||||||
8
setup.py
8
setup.py
@@ -36,13 +36,6 @@ package_name = "sherpa-onnx"
|
|||||||
with open("sherpa-onnx/python/sherpa_onnx/__init__.py", "a") as f:
|
with open("sherpa-onnx/python/sherpa_onnx/__init__.py", "a") as f:
|
||||||
f.write(f"__version__ = '{get_package_version()}'\n")
|
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():
|
def get_binaries_to_install():
|
||||||
bin_dir = Path("build") / "sherpa_onnx" / "bin"
|
bin_dir = Path("build") / "sherpa_onnx" / "bin"
|
||||||
@@ -91,7 +84,6 @@ def get_binaries_to_install():
|
|||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name=package_name,
|
name=package_name,
|
||||||
python_requires=">=3.6",
|
python_requires=">=3.6",
|
||||||
install_requires=install_requires,
|
|
||||||
version=get_package_version(),
|
version=get_package_version(),
|
||||||
author="The sherpa-onnx development team",
|
author="The sherpa-onnx development team",
|
||||||
author_email="dpovey@gmail.com",
|
author_email="dpovey@gmail.com",
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
# Copyright (c) 2023 Xiaomi Corporation
|
# Copyright (c) 2023 Xiaomi Corporation
|
||||||
|
|
||||||
import logging
|
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 pathlib import Path
|
||||||
from sherpa_onnx import text2token
|
from sherpa_onnx import text2token
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,6 @@ import re
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional, Union
|
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(
|
def text2token(
|
||||||
texts: List[str],
|
texts: List[str],
|
||||||
tokens: 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
|
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.
|
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}"
|
assert Path(tokens).is_file(), f"File not exists, {tokens}"
|
||||||
tokens_table = {}
|
tokens_table = {}
|
||||||
with open(tokens, "r", encoding="utf-8") as f:
|
with open(tokens, "r", encoding="utf-8") as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user