Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
e5b2c72b
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e5b2c72b
编写于
10月 21, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
using setup.py to install pkgs by shell script
上级
82120c5c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
24 deletion
+32
-24
setup.py
setup.py
+18
-11
tools/Makefile
tools/Makefile
+10
-10
tools/extras/install_autolog.sh
tools/extras/install_autolog.sh
+4
-3
未找到文件。
setup.py
浏览文件 @
e5b2c72b
...
@@ -28,12 +28,15 @@ import subprocess as sp
...
@@ -28,12 +28,15 @@ import subprocess as sp
HERE
=
Path
(
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
)))
HERE
=
Path
(
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
)))
@
contextlib
.
contextmanager
@
contextlib
.
contextmanager
def
pushd
(
new_dir
):
def
pushd
(
new_dir
):
old_dir
=
os
.
getcwd
()
old_dir
=
os
.
getcwd
()
os
.
chdir
(
new_dir
)
os
.
chdir
(
new_dir
)
print
(
new_dir
)
yield
yield
os
.
chdir
(
old_dir
)
os
.
chdir
(
old_dir
)
print
(
old_dir
)
def
read
(
*
names
,
**
kwargs
):
def
read
(
*
names
,
**
kwargs
):
...
@@ -55,17 +58,22 @@ def check_call(cmd: str, shell=False, executable=None):
...
@@ -55,17 +58,22 @@ def check_call(cmd: str, shell=False, executable=None):
raise
e
raise
e
def
_pre_install
(
install_lib_dir
):
def
_remove
(
files
:
str
):
for
f
in
files
:
f
.
unlink
()
def
_post_install
(
install_lib_dir
):
# apt
# apt
check_call
(
"apt-get update -y"
,
False
)
check_call
(
"apt-get update -y"
)
check_call
(
"apt-get install -y "
+
'vim tig tree sox pkg-config '
+
check_call
(
"apt-get install -y "
+
'vim tig tree sox pkg-config '
+
'libsndfile1 libflac-dev libogg-dev '
+
'libsndfile1 libflac-dev libogg-dev '
+
'libvorbis-dev libboost-dev swig python3-dev '
,
False
)
'libvorbis-dev libboost-dev swig python3-dev '
)
print
(
"apt install."
)
print
(
"apt install."
)
# tools/make
# tools/make
tool_dir
=
HERE
/
"tools"
tool_dir
=
HERE
/
"tools"
for
f
in
tool_dir
.
glob
(
"*.done"
):
_remove
(
tool_dir
.
glob
(
"*.done"
))
f
.
unlink
()
with
pushd
(
tool_dir
):
with
pushd
(
tool_dir
):
check_call
(
"make"
)
check_call
(
"make"
)
print
(
"tools install."
)
print
(
"tools install."
)
...
@@ -73,17 +81,16 @@ def _pre_install(install_lib_dir):
...
@@ -73,17 +81,16 @@ def _pre_install(install_lib_dir):
# install autolog
# install autolog
tools_extrs_dir
=
HERE
/
'tools/extras'
tools_extrs_dir
=
HERE
/
'tools/extras'
with
pushd
(
tools_extrs_dir
):
with
pushd
(
tools_extrs_dir
):
check_call
(
f
"bash -e install_autolog.sh"
)
print
(
os
.
getcwd
())
check_call
(
f
"./install_autolog.sh"
)
print
(
"autolog install."
)
print
(
"autolog install."
)
# ctcdecoder
# ctcdecoder
ctcdecoder_dir
=
HERE
/
'deepspeech/decoders/ctcdecoder/swig'
ctcdecoder_dir
=
HERE
/
'deepspeech/decoders/ctcdecoder/swig'
with
pushd
(
ctcdecoder_dir
):
with
pushd
(
ctcdecoder_dir
):
check_call
(
"bash -e setup.sh"
)
check_call
(
"bash -e setup.sh"
)
print
(
"ctcdecoder install."
)
print
(
"ctcdecoder install."
)
def
_post_install
(
install_lib_dir
):
# install third_party
# install third_party
third_party_dir
=
HERE
/
'third_party'
third_party_dir
=
HERE
/
'third_party'
with
pushd
(
third_party_dir
):
with
pushd
(
third_party_dir
):
...
@@ -93,15 +100,15 @@ def _post_install(install_lib_dir):
...
@@ -93,15 +100,15 @@ def _post_install(install_lib_dir):
class
DevelopCommand
(
develop
):
class
DevelopCommand
(
develop
):
def
run
(
self
):
def
run
(
self
):
self
.
execute
(
_pre_install
,
(
self
.
install_lib
,
),
msg
=
"Pre Install..."
)
develop
.
run
(
self
)
develop
.
run
(
self
)
# must after develop.run, or pkg install by shell will not see
self
.
execute
(
_post_install
,
(
self
.
install_lib
,
),
msg
=
"Post Install..."
)
self
.
execute
(
_post_install
,
(
self
.
install_lib
,
),
msg
=
"Post Install..."
)
class
InstallCommand
(
install
):
class
InstallCommand
(
install
):
def
run
(
self
):
def
run
(
self
):
self
.
execute
(
_pre_install
,
(
self
.
install_lib
,
),
msg
=
"Pre Install..."
)
install
.
run
(
self
)
install
.
run
(
self
)
# must after install.run, or pkg install by shell will not see
self
.
execute
(
_post_install
,
(
self
.
install_lib
,
),
msg
=
"Post Install..."
)
self
.
execute
(
_post_install
,
(
self
.
install_lib
,
),
msg
=
"Post Install..."
)
...
...
tools/Makefile
浏览文件 @
e5b2c72b
...
@@ -6,15 +6,15 @@ CC ?= gcc # used for sph2pipe
...
@@ -6,15 +6,15 @@ CC ?= gcc # used for sph2pipe
# CXX = clang++ # Uncomment these lines...
# CXX = clang++ # Uncomment these lines...
# CC = clang # ...to build with Clang.
# CC = clang # ...to build with Clang.
WGET
?=
wget
--no-check-certificate
$(WGET)
?=
wget
--no-check-certificate
.PHONY
:
all clean
.PHONY
:
all clean
all
:
virtualenv kenlm.done sox.done soxbindings.done mfa.done sclite.done
all
:
virtualenv
.done
kenlm.done sox.done soxbindings.done mfa.done sclite.done
virtualenv
:
virtualenv
.done
:
test
-d
venv
||
virtualenv
-p
$(PYTHON)
venv
test
-d
venv
||
virtualenv
-p
$(PYTHON)
venv
touch
v
env/bin/activat
e
touch
v
irtualenv.don
e
clean
:
clean
:
rm
-fr
venv
rm
-fr
venv
...
@@ -26,25 +26,25 @@ kenlm.done:
...
@@ -26,25 +26,25 @@ kenlm.done:
# it seems that boost
(
1.54.0
)
requires higher version. After I switched to g++-5 it compiles normally.
# it seems that boost
(
1.54.0
)
requires higher version. After I switched to g++-5 it compiles normally.
apt
install
-y
--allow-unauthenticated
build-essential cmake libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev libeigen3-dev zlib1g-dev libbz2-dev liblzma-dev
apt
install
-y
--allow-unauthenticated
build-essential cmake libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev libeigen3-dev zlib1g-dev libbz2-dev liblzma-dev
apt-get
install
-y
gcc-5 g++-5
&&
update-alternatives
--install
/usr/bin/gcc gcc /usr/bin/gcc-5 50
&&
update-alternatives
--install
/usr/bin/g++ g++ /usr/bin/g++-5 50
apt-get
install
-y
gcc-5 g++-5
&&
update-alternatives
--install
/usr/bin/gcc gcc /usr/bin/gcc-5 50
&&
update-alternatives
--install
/usr/bin/g++ g++ /usr/bin/g++-5 50
test
-d
kenlm
||
wget
-O
- https://kheafield.com/code/kenlm.tar.gz
--no-check-certificate
|
tar
xz
test
-d
kenlm
||
$(WGET)
-O
- https://kheafield.com/code/kenlm.tar.gz
|
tar
xz
rm
-rf
kenlm/build
&&
mkdir
-p
kenlm/build
&&
cd
kenlm/build
&&
cmake ..
&&
make
-j4
&&
make
install
rm
-rf
kenlm/build
&&
mkdir
-p
kenlm/build
&&
cd
kenlm/build
&&
cmake ..
&&
make
-j4
&&
make
install
source
venv/bin/activate
;
cd
kenlm
&&
python setup.py
install
cd
kenlm
&&
python setup.py
install
touch
kenlm.done
touch
kenlm.done
sox.done
:
sox.done
:
apt
install
-y
libvorbis-dev libmp3lame-dev libmad-ocaml-dev
apt
install
-y
libvorbis-dev libmp3lame-dev libmad-ocaml-dev
test
-d
sox-14.4.2
||
wget https://nchc.dl.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.gz
--no-check-certificate
test
-d
sox-14.4.2
||
$(WGET)
https://nchc.dl.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.gz
tar
-xvzf
sox-14.4.2.tar.gz
-C
.
tar
-xvzf
sox-14.4.2.tar.gz
-C
.
cd
sox-14.4.2
&&
./configure
--prefix
=
/usr/
&&
make
-j4
&&
make
install
cd
sox-14.4.2
&&
./configure
--prefix
=
/usr/
&&
make
-j4
&&
make
install
touch
sox.done
touch
sox.done
soxbindings.done
:
soxbindings.done
:
test
-d
soxbindings
||
git clone https://github.com/pseeth/soxbindings.git
test
-d
soxbindings
||
git clone https://github.com/pseeth/soxbindings.git
source
venv/bin/activate
;
cd
soxbindings
&&
python setup.py
install
cd
soxbindings
&&
python setup.py
install
touch
soxbindings.done
touch
soxbindings.done
mfa.done
:
mfa.done
:
test
-d
montreal-forced-aligner
||
wget https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/releases/download/v1.0.1/montreal-forced-aligner_linux.tar.gz
--no-check-certificate
test
-d
montreal-forced-aligner
||
$(WGET)
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/releases/download/v1.0.1/montreal-forced-aligner_linux.tar.gz
tar
xvf montreal-forced-aligner_linux.tar.gz
tar
xvf montreal-forced-aligner_linux.tar.gz
touch
mfa.done
touch
mfa.done
...
@@ -85,7 +85,7 @@ sctk-$(SCTK_GITHASH).tar.gz:
...
@@ -85,7 +85,7 @@ sctk-$(SCTK_GITHASH).tar.gz:
if
[
-d
'
$(DOWNLOAD_DIR)
'
]
;
then
\
if
[
-d
'
$(DOWNLOAD_DIR)
'
]
;
then
\
cp
-p
'
$(DOWNLOAD_DIR)
/sctk-
$(SCTK_GITHASH)
.tar.gz'
.
;
\
cp
-p
'
$(DOWNLOAD_DIR)
/sctk-
$(SCTK_GITHASH)
.tar.gz'
.
;
\
else
\
else
\
$(
WGET
)
-nv
-T
10
-t
3
-O
sctk-
$(SCTK_GITHASH)
.tar.gz
\
$
(
$(WGET)
)
-nv
-T
10
-t
3
-O
sctk-
$(SCTK_GITHASH)
.tar.gz
\
https://github.com/usnistgov/SCTK/archive/
$(SCTK_GITHASH)
.tar.gz
;
\
https://github.com/usnistgov/SCTK/archive/
$(SCTK_GITHASH)
.tar.gz
;
\
fi
fi
...
...
tools/extras/install_autolog.sh
浏览文件 @
e5b2c72b
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#install auto-log
#install auto-log
echo
"Install auto_log into default system path"
echo
"Install auto_log into default system path"
rm
-rf
AutoLog
||
true
test
-d
AutoLog
||
git clone https://github.com/LDOUBLEV/AutoLog
test
-d
AutoLog
||
git clone https://github.com/LDOUBLEV/AutoLog
if
[
$?
!=
0
]
;
then
if
[
$?
!=
0
]
;
then
error_msg
"Download auto_log failed !!!"
error_msg
"Download auto_log failed !!!"
...
@@ -9,8 +10,8 @@ if [ $? != 0 ]; then
...
@@ -9,8 +10,8 @@ if [ $? != 0 ]; then
fi
fi
pushd
AutoLog
pushd
AutoLog
pip
install
-r
requirements.txt
pip
3
install
-r
requirements.txt
python setup.py
install
python
3
setup.py
install
popd
popd
rm
-rf
AutoLog
rm
-rf
AutoLog
||
true
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录