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
2025-05-08 19:15:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2025-05-08 19:15:33 +0800
Commit
562a5f7d9b8cf618ffda97ffdda3378bba444df7
562a5f7d
1 parent
baec2da7
Fix building wheels for macOS (#2192)
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
22 行增加
和
15 行删除
.github/workflows/build-wheels-macos-universal2.yaml
sherpa-onnx/csrc/file-utils.cc
sherpa-onnx/csrc/keyword-spotter-transducer-impl.h
sherpa-onnx/csrc/offline-recognizer-transducer-impl.h
sherpa-onnx/csrc/wave-writer.cc
.github/workflows/build-wheels-macos-universal2.yaml
查看文件 @
562a5f7
...
...
@@ -20,7 +20,7 @@ jobs:
strategy
:
fail-fast
:
false
matrix
:
os
:
[
macos-
latest
]
os
:
[
macos-
13
]
python-version
:
[
"
cp38"
,
"
cp39"
,
"
cp310"
,
"
cp311"
,
"
cp312"
,
"
cp313"
]
steps
:
...
...
@@ -88,7 +88,13 @@ jobs:
TWINE_USERNAME
:
${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD
:
${{ secrets.PYPI_PASSWORD }}
run
:
|
python3 -m pip install --break-system-packages --upgrade pip
python3 -m pip install --break-system-packages wheel twine==5.0.0 setuptools
opts='--break-system-packages'
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
...
...
sherpa-onnx/csrc/file-utils.cc
查看文件 @
562a5f7
...
...
@@ -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
);
if
(
!
asset
)
{
__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
);
}
...
...
sherpa-onnx/csrc/keyword-spotter-transducer-impl.h
查看文件 @
562a5f7
...
...
@@ -123,9 +123,10 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl {
if
(
!
EncodeKeywords
(
is
,
sym_
,
&
current_ids
,
&
current_kws
,
&
current_scores
,
&
current_thresholds
))
{
#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
SHERPA_ONNX_LOGE
(
"Encode keywords
%s
failed."
,
keywords
.
c_str
());
SHERPA_ONNX_LOGE
(
"Encode keywords
'%s'
failed."
,
keywords
.
c_str
());
#endif
return
nullptr
;
}
...
...
@@ -303,10 +304,10 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl {
std
::
ifstream
is
(
config_
.
keywords_file
);
if
(
!
is
)
{
#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
());
#else
SHERPA_ONNX_LOGE
(
"Open keywords file failed:
%s
"
,
SHERPA_ONNX_LOGE
(
"Open keywords file failed:
'%s'
"
,
config_
.
keywords_file
.
c_str
());
#endif
exit
(
-
1
);
...
...
@@ -325,10 +326,10 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl {
if
(
!
is
)
{
#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
());
#else
SHERPA_ONNX_LOGE
(
"Open keywords file failed:
%s
"
,
SHERPA_ONNX_LOGE
(
"Open keywords file failed:
'%s'
"
,
config_
.
keywords_file
.
c_str
());
#endif
exit
(
-
1
);
...
...
sherpa-onnx/csrc/offline-recognizer-transducer-impl.h
查看文件 @
562a5f7
...
...
@@ -156,7 +156,7 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
std
::
vector
<
float
>
current_scores
;
if
(
!
EncodeHotwords
(
is
,
config_
.
model_config
.
modeling_unit
,
symbol_table_
,
bpe_encoder_
.
get
(),
&
current
,
&
current_scores
))
{
SHERPA_ONNX_LOGE
(
"Encode hotwords failed, skipping, hotwords are :
%s
"
,
SHERPA_ONNX_LOGE
(
"Encode hotwords failed, skipping, hotwords are :
'%s'
"
,
hotwords
.
c_str
());
}
...
...
@@ -252,7 +252,7 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
std
::
ifstream
is
(
config_
.
hotwords_file
);
if
(
!
is
)
{
SHERPA_ONNX_LOGE
(
"Open hotwords file failed:
%s
"
,
SHERPA_ONNX_LOGE
(
"Open hotwords file failed:
'%s'
"
,
config_
.
hotwords_file
.
c_str
());
exit
(
-
1
);
}
...
...
@@ -276,7 +276,7 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
std
::
istringstream
is
(
std
::
string
(
buf
.
begin
(),
buf
.
end
()));
if
(
!
is
)
{
SHERPA_ONNX_LOGE
(
"Open hotwords file failed:
%s
"
,
SHERPA_ONNX_LOGE
(
"Open hotwords file failed:
'%s'
"
,
config_
.
hotwords_file
.
c_str
());
exit
(
-
1
);
}
...
...
sherpa-onnx/csrc/wave-writer.cc
查看文件 @
562a5f7
...
...
@@ -78,12 +78,12 @@ bool WriteWave(const std::string &filename, int32_t sampling_rate,
WriteWave
(
buffer
.
data
(),
sampling_rate
,
samples
,
n
);
std
::
ofstream
os
(
filename
,
std
::
ios
::
binary
);
if
(
!
os
)
{
SHERPA_ONNX_LOGE
(
"Failed to create
%s
"
,
filename
.
c_str
());
SHERPA_ONNX_LOGE
(
"Failed to create
'%s'
"
,
filename
.
c_str
());
return
false
;
}
os
<<
buffer
;
if
(
!
os
)
{
SHERPA_ONNX_LOGE
(
"Write
%s
failed"
,
filename
.
c_str
());
SHERPA_ONNX_LOGE
(
"Write
'%s'
failed"
,
filename
.
c_str
());
return
false
;
}
return
true
;
...
...
请
注册
或
登录
后发表评论