You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.7KB

  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. python -c "from utils.google_utils import * ; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')"
  49. mv ./coco128 ../
  50. - name: Tests workflow
  51. run: |
  52. export PYTHONPATH="$PWD" # to run *.py. files in subdirectories
  53. di=cpu # inference devices # define device
  54. # train
  55. python train.py --img 256 --batch 8 --weights weights/${{ matrix.model }}.pt --cfg models/${{ matrix.model }}.yaml --epochs 1 --device $di
  56. # detect
  57. python detect.py --weights weights/${{ matrix.model }}.pt --device $di
  58. python detect.py --weights runs/exp0/weights/last.pt --device $di
  59. # test
  60. python test.py --img 256 --batch 8 --weights weights/${{ matrix.model }}.pt --device $di
  61. python test.py --img 256 --batch 8 --weights runs/exp0/weights/last.pt --device $di
  62. python models/yolo.py --cfg models/${{ matrix.model }}.yaml # inspect
  63. python models/export.py --img 256 --batch 1 --weights weights/${{ matrix.model }}.pt # export
  64. shell: bash