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
|
||||
run: |
|
||||
pip install --verbose sherpa-onnx
|
||||
# python3 -m pip install --verbose .
|
||||
|
||||
- name: Test sherp-onnx
|
||||
- name: Test sherpa-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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
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:
|
||||
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",
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
# 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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user