run-tests.yaml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. name: Tests
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. jobs:
  7. convert-model:
  8. runs-on: ubuntu-latest
  9. env:
  10. BLOOM_TESTING_WRITE_TOKEN: ${{ secrets.BLOOM_TESTING_WRITE_TOKEN }}
  11. timeout-minutes: 15
  12. steps:
  13. - uses: actions/checkout@v2
  14. - name: Set up Python
  15. uses: actions/setup-python@v2
  16. with:
  17. python-version: 3.9
  18. - name: Cache dependencies
  19. uses: actions/cache@v2
  20. with:
  21. path: ~/.cache/pip
  22. key: Key-v1-py3.9-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
  23. - name: Install dependencies
  24. run: |
  25. python -m pip install --upgrade pip
  26. pip install -r requirements.txt
  27. - name: Extract branch name
  28. run: |
  29. export BRANCH_NAME="##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
  30. echo $BRANCH_NAME
  31. - name: Convert small model
  32. run: |
  33. python -m cli.convert_model --model bigscience/bloom-350m --output_path ./converted_model \
  34. --output_repo bloom-testing/test-bloomd-350m --use_auth_token $BLOOM_TESTING_WRITE_TOKEN
  35. run-tests:
  36. runs-on: ubuntu-latest
  37. # needs: convert-model
  38. strategy:
  39. matrix:
  40. python-version: [ 3.7, 3.8, 3.9 ]
  41. attempt: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ]
  42. fail-fast: false
  43. timeout-minutes: 15
  44. steps:
  45. - uses: actions/checkout@v2
  46. - name: Set up Python
  47. uses: actions/setup-python@v2
  48. with:
  49. python-version: ${{ matrix.python-version }}
  50. - name: Cache dependencies
  51. uses: actions/cache@v2
  52. with:
  53. path: ~/.cache/pip
  54. key: Key-v1-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
  55. - name: Install dependencies
  56. run: |
  57. python -m pip install --upgrade pip
  58. pip install -r requirements.txt
  59. pip install -r requirements-dev.txt
  60. - name: Test
  61. run: |
  62. hivemind-dht --host_maddrs /ip4/127.0.0.1/tcp/31337 &> dht.log &
  63. INITIAL_PID=$$
  64. sleep 5
  65. export INITIAL_PEERS=$(python -c "with open('dht.log') as f: print(f.readlines()[1].split()[-1])" )
  66. echo "Initial peer: ${INITIAL_PEERS}"
  67. cat dht.log
  68. python -m cli.run_server --converted_model_name_or_path bloom-testing/test-bloomd-350m --block_indices 0:12 \
  69. --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &
  70. SERVER1_PID=$$
  71. sleep 30 # wait for server to download layers
  72. ps aux
  73. # test individual blocks
  74. export PYTHONPATH=. REF_NAME=bloom-testing/test-bloomd-350m
  75. BLOCK_UID=bloom-testing/test-bloomd-350m.0 REF_INDEX=0 pytest tests/test_block_exact_match.py
  76. BLOCK_UID=bloom-testing/test-bloomd-350m.4 REF_INDEX=4 pytest tests/test_block_exact_match.py
  77. #kill $INITIAL_PID $SERVER1_PID
  78. echo "Done!"