From 490204368f911a8dc1573f0dd8ce1b6e2eb635e3 Mon Sep 17 00:00:00 2001 From: Hui Zhang Date: Wed, 24 Mar 2021 06:59:38 +0000 Subject: [PATCH] fix ci --- .notebook/jit_infer.ipynb | 91 +++++++++++++++++++++++++-------------- .travis.yml | 3 +- .travis/unittest.sh | 12 +++++- 3 files changed, 71 insertions(+), 35 deletions(-) diff --git a/.notebook/jit_infer.ipynb b/.notebook/jit_infer.ipynb index af89827f9..6c48bb407 100644 --- a/.notebook/jit_infer.ipynb +++ b/.notebook/jit_infer.ipynb @@ -37,26 +37,26 @@ "name": "stderr", "output_type": "stream", "text": [ - "2021-03-24 03:20:39,129 - 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 03:20:39,131 - 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 03:20:39,133 - 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 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 03:20:39,135 - 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 03:20:39,137 - 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 03:20:39,138 - 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 03:20:39,139 - 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 03:20:39,140 - 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 03:20:39,141 - 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 03:20:39,142 - WARNING - register user ConstantPad2d to paddle.nn, 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 06:30:47,728 - WARNING - register user sigmoid 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 06:30:47,729 - WARNING - override cat of paddle 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 06:30:47,731 - WARNING - override contiguous of paddle.Tensor if exists or register, 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 06:30:47,732 - WARNING - register user view 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 06:30:47,733 - 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 06:30:47,734 - WARNING - register user fill_ 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 06:30:47,735 - WARNING - register user softmax 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 06:30:47,736 - WARNING - register user relu to paddle.Tensor, 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 06:30:47,737 - WARNING - override ctc_loss of paddle.nn.functional if exists, 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 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", " 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", @@ -88,8 +88,6 @@ "from deepspeech.io.dataset import ManifestDataset\n", "\n", "\n", - "from paddle.inference import Config\n", - "from paddle.inference import create_predictor\n", "\n", "from deepspeech.frontend.utility import read_manifest" ] @@ -291,7 +289,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -316,14 +314,14 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "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", - "execution_count": 19, + "execution_count": 7, "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": [ + "\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", " if args.model_dir is not None:\n", " config = Config(args.model_dir)\n", " else:\n", " config = Config(args.model_file, args.params_file)\n", "\n", - " config.enable_memory_optim()\n", " if args.use_gpu:\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", " # 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", - " config.set_cpu_math_library_num_threads(4)\n", - " #config.enable_mkldnn()\n", + " config.set_cpu_math_library_num_threads(1)\n", + " config.enable_mkldnn()\n", + " \n", + " config.enable_memory_optim()\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", " return predictor\n", "\n", @@ -509,7 +534,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -582,7 +607,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 9, "metadata": {}, "outputs": [ { diff --git a/.travis.yml b/.travis.yml index d1f4abb50..538e9df2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,8 @@ addons: before_install: - python3 --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 script: diff --git a/.travis/unittest.sh b/.travis/unittest.sh index 2eb57477f..476c2d9df 100755 --- a/.travis/unittest.sh +++ b/.travis/unittest.sh @@ -6,10 +6,16 @@ abort(){ exit 1 } +print_env(){ + cat /etc/lsb-release + gcc -v + g++ -v +} + unittest(){ cd $1 > /dev/null if [ -f "setup.sh" ]; then - sh setup.sh + bash setup.sh export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH fi if [ $? != 0 ]; then @@ -24,6 +30,10 @@ unittest(){ trap 'abort' 0 set -e + +print_env + + cd tools; make; cd - . tools/venv/bin/activate pip3 install pytest