Fix building wheels for macOS (#2192)
This commit is contained in:
@@ -20,7 +20,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest]
|
os: [macos-13]
|
||||||
python-version: ["cp38", "cp39", "cp310", "cp311", "cp312", "cp313"]
|
python-version: ["cp38", "cp39", "cp310", "cp311", "cp312", "cp313"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -88,7 +88,13 @@ jobs:
|
|||||||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
||||||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --break-system-packages --upgrade pip
|
opts='--break-system-packages'
|
||||||
python3 -m pip install --break-system-packages wheel twine==5.0.0 setuptools
|
v=${{ matrix.python-version }}
|
||||||
|
if [[ $v == cp38 || $v == cp39 ]]; then
|
||||||
|
opts=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
python3 -m pip install $opts --upgrade pip
|
||||||
|
python3 -m pip install $opts wheel twine==5.0.0 setuptools
|
||||||
|
|
||||||
twine upload ./wheelhouse/*.whl
|
twine upload ./wheelhouse/*.whl
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ std::vector<char> ReadFile(AAssetManager *mgr, const std::string &filename) {
|
|||||||
AAsset *asset = AAssetManager_open(mgr, filename.c_str(), AASSET_MODE_BUFFER);
|
AAsset *asset = AAssetManager_open(mgr, filename.c_str(), AASSET_MODE_BUFFER);
|
||||||
if (!asset) {
|
if (!asset) {
|
||||||
__android_log_print(ANDROID_LOG_FATAL, "sherpa-onnx",
|
__android_log_print(ANDROID_LOG_FATAL, "sherpa-onnx",
|
||||||
"Read binary file: Load %s failed", filename.c_str());
|
"Read binary file: Load '%s' failed", filename.c_str());
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,9 +123,10 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl {
|
|||||||
if (!EncodeKeywords(is, sym_, ¤t_ids, ¤t_kws, ¤t_scores,
|
if (!EncodeKeywords(is, sym_, ¤t_ids, ¤t_kws, ¤t_scores,
|
||||||
¤t_thresholds)) {
|
¤t_thresholds)) {
|
||||||
#if __OHOS__
|
#if __OHOS__
|
||||||
SHERPA_ONNX_LOGE("Encode keywords %{public}s failed.", keywords.c_str());
|
SHERPA_ONNX_LOGE("Encode keywords '%{public}s' failed.",
|
||||||
|
keywords.c_str());
|
||||||
#else
|
#else
|
||||||
SHERPA_ONNX_LOGE("Encode keywords %s failed.", keywords.c_str());
|
SHERPA_ONNX_LOGE("Encode keywords '%s' failed.", keywords.c_str());
|
||||||
#endif
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -303,10 +304,10 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl {
|
|||||||
std::ifstream is(config_.keywords_file);
|
std::ifstream is(config_.keywords_file);
|
||||||
if (!is) {
|
if (!is) {
|
||||||
#if __OHOS__
|
#if __OHOS__
|
||||||
SHERPA_ONNX_LOGE("Open keywords file failed: %{public}s",
|
SHERPA_ONNX_LOGE("Open keywords file failed: '%{public}s'",
|
||||||
config_.keywords_file.c_str());
|
config_.keywords_file.c_str());
|
||||||
#else
|
#else
|
||||||
SHERPA_ONNX_LOGE("Open keywords file failed: %s",
|
SHERPA_ONNX_LOGE("Open keywords file failed: '%s'",
|
||||||
config_.keywords_file.c_str());
|
config_.keywords_file.c_str());
|
||||||
#endif
|
#endif
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@@ -325,10 +326,10 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl {
|
|||||||
|
|
||||||
if (!is) {
|
if (!is) {
|
||||||
#if __OHOS__
|
#if __OHOS__
|
||||||
SHERPA_ONNX_LOGE("Open keywords file failed: %{public}s",
|
SHERPA_ONNX_LOGE("Open keywords file failed: '%{public}s'",
|
||||||
config_.keywords_file.c_str());
|
config_.keywords_file.c_str());
|
||||||
#else
|
#else
|
||||||
SHERPA_ONNX_LOGE("Open keywords file failed: %s",
|
SHERPA_ONNX_LOGE("Open keywords file failed: '%s'",
|
||||||
config_.keywords_file.c_str());
|
config_.keywords_file.c_str());
|
||||||
#endif
|
#endif
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
|
|||||||
std::vector<float> current_scores;
|
std::vector<float> current_scores;
|
||||||
if (!EncodeHotwords(is, config_.model_config.modeling_unit, symbol_table_,
|
if (!EncodeHotwords(is, config_.model_config.modeling_unit, symbol_table_,
|
||||||
bpe_encoder_.get(), ¤t, ¤t_scores)) {
|
bpe_encoder_.get(), ¤t, ¤t_scores)) {
|
||||||
SHERPA_ONNX_LOGE("Encode hotwords failed, skipping, hotwords are : %s",
|
SHERPA_ONNX_LOGE("Encode hotwords failed, skipping, hotwords are : '%s'",
|
||||||
hotwords.c_str());
|
hotwords.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
|
|||||||
|
|
||||||
std::ifstream is(config_.hotwords_file);
|
std::ifstream is(config_.hotwords_file);
|
||||||
if (!is) {
|
if (!is) {
|
||||||
SHERPA_ONNX_LOGE("Open hotwords file failed: %s",
|
SHERPA_ONNX_LOGE("Open hotwords file failed: '%s'",
|
||||||
config_.hotwords_file.c_str());
|
config_.hotwords_file.c_str());
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
|
|||||||
std::istringstream is(std::string(buf.begin(), buf.end()));
|
std::istringstream is(std::string(buf.begin(), buf.end()));
|
||||||
|
|
||||||
if (!is) {
|
if (!is) {
|
||||||
SHERPA_ONNX_LOGE("Open hotwords file failed: %s",
|
SHERPA_ONNX_LOGE("Open hotwords file failed: '%s'",
|
||||||
config_.hotwords_file.c_str());
|
config_.hotwords_file.c_str());
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,12 +78,12 @@ bool WriteWave(const std::string &filename, int32_t sampling_rate,
|
|||||||
WriteWave(buffer.data(), sampling_rate, samples, n);
|
WriteWave(buffer.data(), sampling_rate, samples, n);
|
||||||
std::ofstream os(filename, std::ios::binary);
|
std::ofstream os(filename, std::ios::binary);
|
||||||
if (!os) {
|
if (!os) {
|
||||||
SHERPA_ONNX_LOGE("Failed to create %s", filename.c_str());
|
SHERPA_ONNX_LOGE("Failed to create '%s'", filename.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
os << buffer;
|
os << buffer;
|
||||||
if (!os) {
|
if (!os) {
|
||||||
SHERPA_ONNX_LOGE("Write %s failed", filename.c_str());
|
SHERPA_ONNX_LOGE("Write '%s' failed", filename.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user