您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ci-testing.yml 2.7KB

4 年前
4 年前
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. name: CI CPU testing
  2. on: # https://help.github.com/en/actions/reference/events-that-trigger-workflows
  3. push:
  4. pull_request:
  5. schedule:
  6. - cron: "0 0 * * *"
  7. jobs:
  8. cpu-tests:
  9. runs-on: ${{ matrix.os }}
  10. strategy:
  11. fail-fast: false
  12. matrix:
  13. os: [ubuntu-latest, macos-latest, windows-latest]
  14. python-version: [3.8]
  15. model: ['yolov5s'] # models to test
  16. # Timeout: https://stackoverflow.com/a/59076067/4521646
  17. timeout-minutes: 50
  18. steps:
  19. - uses: actions/checkout@v2
  20. - name: Set up Python ${{ matrix.python-version }}
  21. uses: actions/setup-python@v2
  22. with:
  23. python-version: ${{ matrix.python-version }}
  24. # Note: This uses an internal pip API and may not always work
  25. # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
  26. - name: Get pip cache
  27. id: pip-cache
  28. run: |
  29. python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
  30. - name: Cache pip
  31. uses: actions/cache@v1
  32. with:
  33. path: ${{ steps.pip-cache.outputs.dir }}
  34. key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
  35. restore-keys: |
  36. ${{ runner.os }}-${{ matrix.python-version }}-pip-
  37. - name: Install dependencies
  38. run: |
  39. python -m pip install --upgrade pip
  40. pip install -qr requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html
  41. pip install -q onnx
  42. python --version
  43. pip --version
  44. pip list
  45. shell: bash
  46. - name: Download data
  47. run: |
  48. curl -L -o temp.zip https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip
  49. unzip -q temp.zip -d ../
  50. rm temp.zip
  51. - name: Tests workflow
  52. run: |
  53. export PYTHONPATH="$PWD" # to run *.py. files in subdirectories
  54. di=cpu # inference devices # define device
  55. # train
  56. python train.py --img 256 --batch 8 --weights weights/${{ matrix.model }}.pt --cfg models/${{ matrix.model }}.yaml --epochs 1 --device $di
  57. # detect
  58. python detect.py --weights weights/${{ matrix.model }}.pt --device $di
  59. python detect.py --weights runs/exp0/weights/last.pt --device $di
  60. # test
  61. python test.py --img 256 --batch 8 --weights weights/${{ matrix.model }}.pt --device $di
  62. python test.py --img 256 --batch 8 --weights runs/exp0/weights/last.pt --device $di
  63. python models/yolo.py --cfg models/${{ matrix.model }}.yaml # inspect
  64. python models/export.py --img 256 --batch 1 --weights weights/${{ matrix.model }}.pt # export
  65. shell: bash