test_gpu.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. name: PaddleOCR PR Tests GPU
  2. on:
  3. push:
  4. branches: ["main"]
  5. pull_request:
  6. branches: ["main"]
  7. workflow_dispatch:
  8. env:
  9. PR_ID: ${{ github.event.pull_request.number }}
  10. COMMIT_ID: ${{ github.event.pull_request.head.sha }}
  11. work_dir: /workspace/PaddleOCR
  12. PADDLENLP_ROOT: /workspace/PaddleOCR
  13. TASK: paddleocr-CI-${{ github.event.pull_request.number }}
  14. BRANCH: ${{ github.event.pull_request.base.ref }}
  15. AGILE_COMPILE_BRANCH: ${{ github.event.pull_request.base.ref }}
  16. DIR_NAME: ${{ github.repository }}
  17. permissions:
  18. contents: read
  19. jobs:
  20. detect-changes:
  21. runs-on: ubuntu-latest
  22. outputs:
  23. docs_only: ${{ steps.filter.outputs.docs_only }}
  24. steps:
  25. - uses: actions/checkout@v4
  26. - id: filter
  27. uses: dorny/paths-filter@v3
  28. with:
  29. filters: |
  30. docs_only:
  31. - '**.md'
  32. - '**.txt'
  33. - '**.yml'
  34. - '**.yaml'
  35. test-pr-gpu:
  36. runs-on: [self-hosted, GPU-2Card-OCR]
  37. needs: detect-changes
  38. if: needs.detect-changes.outputs.docs_only != 'true'
  39. steps:
  40. - name: run test
  41. env:
  42. py_version: "3.10"
  43. paddle_whl: https://paddle-qa.bj.bcebos.com/paddle-pipeline/Develop-GpuSome-LinuxCentos-Gcc82-Cuda118-Cudnn86-Trt85-Py310-CINN-Compile/latest/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
  44. docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:latest-dev-cuda11.8-cudnn8.6-trt8.5-gcc82
  45. run: |
  46. work_dir=$RANDOM
  47. mkdir $work_dir
  48. cd $work_dir
  49. git clone --depth=1 https://github.com/PaddlePaddle/PaddleOCR.git -b main
  50. cd PaddleOCR
  51. git fetch origin pull/${PR_ID}/head:ci_build
  52. git checkout ci_build
  53. docker run --gpus all --rm -i --name PaddleOCR_CI_$RANDOM \
  54. --shm-size=128g --net=host \
  55. -v $PWD:/workspace -w /workspace \
  56. -e "py_version=${py_version}" \
  57. -e "paddle_whl=${paddle_whl}" \
  58. ${docker_image} /bin/bash -c '
  59. ldconfig;
  60. nvidia-smi
  61. df -hl
  62. echo ${py_version}
  63. rm -rf run_env
  64. mkdir run_env
  65. ln -s $(which python${py_version}) run_env/python
  66. ln -s $(which python${py_version}) run_env/python3
  67. ln -s $(which pip${py_version}) run_env/pip
  68. export PATH=$PWD/run_env:${PATH}
  69. python -m pip install paddlepaddle-gpu==3.1.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
  70. python -c "import paddle; paddle.version.show()"
  71. python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
  72. python -m pip install pytest
  73. if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
  74. python -m pip install -e ".[all]"
  75. python -m pytest --verbose tests/
  76. '