pull/556/head
Hui Zhang 5 years ago
parent a0c6c5e30a
commit 490204368f

@ -37,26 +37,26 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"2021-03-24 03:20:39,129 - WARNING - register user softmax to paddle, remove this when fixed!\n", "2021-03-24 06:30:47,727 - WARNING - register user softmax to paddle, remove this when fixed!\n",
"2021-03-24 03:20:39,130 - WARNING - register user sigmoid to paddle, remove this when fixed!\n", "2021-03-24 06:30:47,728 - WARNING - register user sigmoid to paddle, remove this when fixed!\n",
"2021-03-24 03:20:39,131 - WARNING - register user relu to paddle, remove this when fixed!\n", "2021-03-24 06:30:47,729 - WARNING - register user relu to paddle, remove this when fixed!\n",
"2021-03-24 03:20:39,132 - WARNING - override cat of paddle if exists or register, remove this when fixed!\n", "2021-03-24 06:30:47,729 - WARNING - override cat of paddle if exists or register, remove this when fixed!\n",
"2021-03-24 03:20:39,133 - WARNING - override eq of paddle.Tensor if exists or register, remove this when fixed!\n", "2021-03-24 06:30:47,730 - WARNING - override eq of paddle.Tensor if exists or register, remove this when fixed!\n",
"2021-03-24 03:20:39,133 - WARNING - override contiguous of paddle.Tensor if exists or register, remove this when fixed!\n", "2021-03-24 06:30:47,731 - WARNING - override contiguous of paddle.Tensor if exists or register, remove this when fixed!\n",
"2021-03-24 03:20:39,135 - WARNING - override size of paddle.Tensor (`to_static` do not process `size` property, maybe some `paddle` api dependent on it), remove this when fixed!\n", "2021-03-24 06:30:47,731 - WARNING - override size of paddle.Tensor (`to_static` do not process `size` property, maybe some `paddle` api dependent on it), remove this when fixed!\n",
"2021-03-24 03:20:39,135 - WARNING - register user view to paddle.Tensor, remove this when fixed!\n", "2021-03-24 06:30:47,732 - WARNING - register user view to paddle.Tensor, remove this when fixed!\n",
"2021-03-24 03:20:39,136 - WARNING - register user view_as to paddle.Tensor, remove this when fixed!\n", "2021-03-24 06:30:47,732 - WARNING - register user view_as to paddle.Tensor, remove this when fixed!\n",
"2021-03-24 03:20:39,137 - WARNING - register user masked_fill to paddle.Tensor, remove this when fixed!\n", "2021-03-24 06:30:47,733 - WARNING - register user masked_fill to paddle.Tensor, remove this when fixed!\n",
"2021-03-24 03:20:39,137 - WARNING - register user masked_fill_ to paddle.Tensor, remove this when fixed!\n", "2021-03-24 06:30:47,733 - WARNING - register user masked_fill_ to paddle.Tensor, remove this when fixed!\n",
"2021-03-24 03:20:39,138 - WARNING - register user fill_ to paddle.Tensor, remove this when fixed!\n", "2021-03-24 06:30:47,734 - WARNING - register user fill_ to paddle.Tensor, remove this when fixed!\n",
"2021-03-24 03:20:39,138 - WARNING - register user repeat to paddle.Tensor, remove this when fixed!\n", "2021-03-24 06:30:47,734 - WARNING - register user repeat to paddle.Tensor, remove this when fixed!\n",
"2021-03-24 03:20:39,139 - WARNING - register user softmax to paddle.Tensor, remove this when fixed!\n", "2021-03-24 06:30:47,735 - WARNING - register user softmax to paddle.Tensor, remove this when fixed!\n",
"2021-03-24 03:20:39,140 - WARNING - register user sigmoid to paddle.Tensor, remove this when fixed!\n", "2021-03-24 06:30:47,735 - WARNING - register user sigmoid to paddle.Tensor, remove this when fixed!\n",
"2021-03-24 03:20:39,140 - WARNING - register user relu to paddle.Tensor, remove this when fixed!\n", "2021-03-24 06:30:47,736 - WARNING - register user relu to paddle.Tensor, remove this when fixed!\n",
"2021-03-24 03:20:39,141 - WARNING - register user glu to paddle.nn.functional, remove this when fixed!\n", "2021-03-24 06:30:47,736 - WARNING - register user glu to paddle.nn.functional, remove this when fixed!\n",
"2021-03-24 03:20:39,141 - WARNING - override ctc_loss of paddle.nn.functional if exists, remove this when fixed!\n", "2021-03-24 06:30:47,737 - WARNING - override ctc_loss of paddle.nn.functional if exists, remove this when fixed!\n",
"2021-03-24 03:20:39,142 - WARNING - register user GLU to paddle.nn, remove this when fixed!\n", "2021-03-24 06:30:47,737 - WARNING - register user GLU to paddle.nn, remove this when fixed!\n",
"2021-03-24 03:20:39,142 - WARNING - register user ConstantPad2d to paddle.nn, remove this when fixed!\n", "2021-03-24 06:30:47,738 - WARNING - register user ConstantPad2d to paddle.nn, remove this when fixed!\n",
"/home/ssd5/zhanghui/DeepSpeech2.x/tools/venv-dev/lib/python3.7/site-packages/scipy/fftpack/__init__.py:103: DeprecationWarning: The module numpy.dual is deprecated. Instead of using dual, use the functions directly from numpy or scipy.\n", "/home/ssd5/zhanghui/DeepSpeech2.x/tools/venv-dev/lib/python3.7/site-packages/scipy/fftpack/__init__.py:103: DeprecationWarning: The module numpy.dual is deprecated. Instead of using dual, use the functions directly from numpy or scipy.\n",
" from numpy.dual import register_func\n", " from numpy.dual import register_func\n",
"/home/ssd5/zhanghui/DeepSpeech2.x/tools/venv-dev/lib/python3.7/site-packages/scipy/special/orthogonal.py:81: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.\n", "/home/ssd5/zhanghui/DeepSpeech2.x/tools/venv-dev/lib/python3.7/site-packages/scipy/special/orthogonal.py:81: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.\n",
@ -88,8 +88,6 @@
"from deepspeech.io.dataset import ManifestDataset\n", "from deepspeech.io.dataset import ManifestDataset\n",
"\n", "\n",
"\n", "\n",
"from paddle.inference import Config\n",
"from paddle.inference import create_predictor\n",
"\n", "\n",
"from deepspeech.frontend.utility import read_manifest" "from deepspeech.frontend.utility import read_manifest"
] ]
@ -291,7 +289,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -316,14 +314,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"2021-03-24 03:26:27,422 - INFO - [checkpoint] Rank 0: loaded model from examples/aishell/ckpt-loss2e-3-0.83-5/checkpoints/step-11725.pdparams\n" "2021-03-24 06:31:20,943 - INFO - [checkpoint] Rank 0: loaded model from examples/aishell/ckpt-loss2e-3-0.83-5/checkpoints/step-11725.pdparams\n"
] ]
}, },
{ {
@ -409,26 +407,53 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"examples/aishell/jit.model.pdmodel\n",
"examples/aishell/jit.model.pdiparams\n",
"0\n",
"True\n"
]
}
],
"source": [ "source": [
"\n",
"from paddle.inference import Config\n",
"from paddle.inference import PrecisionType\n",
"from paddle.inference import create_predictor\n",
"\n",
"args.use_gpu=True\n",
"\n",
"def init_predictor(args):\n", "def init_predictor(args):\n",
" if args.model_dir is not None:\n", " if args.model_dir is not None:\n",
" config = Config(args.model_dir)\n", " config = Config(args.model_dir)\n",
" else:\n", " else:\n",
" config = Config(args.model_file, args.params_file)\n", " config = Config(args.model_file, args.params_file)\n",
"\n", "\n",
" config.enable_memory_optim()\n",
" if args.use_gpu:\n", " if args.use_gpu:\n",
" config.enable_use_gpu(memory_pool_init_size_mb=1000, device_id=0)\n", " config.enable_use_gpu(memory_pool_init_size_mb=1000, device_id=0)\n",
" config.enable_tensorrt_engine(precision_mode=PrecisionType.Float32,\n",
" use_calib_mode=True) # 开启TensorRT预测精度为fp32开启int8离线量化\n",
" else:\n", " else:\n",
" # If not specific mkldnn, you can set the blas thread.\n", " # If not specific mkldnn, you can set the blas thread.\n",
" # The thread num should not be greater than the number of cores in the CPU.\n", " # The thread num should not be greater than the number of cores in the CPU.\n",
" config.set_cpu_math_library_num_threads(4)\n", " config.set_cpu_math_library_num_threads(1)\n",
" #config.enable_mkldnn()\n", " config.enable_mkldnn()\n",
" \n",
" config.enable_memory_optim()\n",
" config.switch_ir_optim(False)\n", " config.switch_ir_optim(False)\n",
" \n", " \n",
" print(config.model_dir())\n",
" print(config.prog_file())\n",
" print(config.params_file())\n",
" print(config.gpu_device_id())\n",
" print(args.use_gpu)\n",
" predictor = create_predictor(config)\n", " predictor = create_predictor(config)\n",
" return predictor\n", " return predictor\n",
"\n", "\n",
@ -509,7 +534,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -582,7 +607,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {

@ -19,7 +19,8 @@ addons:
before_install: before_install:
- python3 --version - python3 --version
- python3 -m pip --version - python3 -m pip --version
- sudo pip install -U virtualenv pre-commit pip - pip3 --version
- sudo pip3 install -U virtualenv pre-commit pip
- docker pull paddlepaddle/paddle:latest - docker pull paddlepaddle/paddle:latest
script: script:

@ -6,10 +6,16 @@ abort(){
exit 1 exit 1
} }
print_env(){
cat /etc/lsb-release
gcc -v
g++ -v
}
unittest(){ unittest(){
cd $1 > /dev/null cd $1 > /dev/null
if [ -f "setup.sh" ]; then if [ -f "setup.sh" ]; then
sh setup.sh bash setup.sh
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
fi fi
if [ $? != 0 ]; then if [ $? != 0 ]; then
@ -24,6 +30,10 @@ unittest(){
trap 'abort' 0 trap 'abort' 0
set -e set -e
print_env
cd tools; make; cd - cd tools; make; cd -
. tools/venv/bin/activate . tools/venv/bin/activate
pip3 install pytest pip3 install pytest

Loading…
Cancel
Save