run-tests.yaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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: Convert small model
  28. # run: |
  29. # python -m cli.convert_model --model bigscience/bloom-350m --output_path ./converted_model \
  30. # --output_repo bloom-testing/test-bloomd-350m --use_auth_token $BLOOM_TESTING_WRITE_TOKEN
  31. #
  32. run-tests:
  33. runs-on: ubuntu-latest
  34. # needs: convert-model
  35. strategy:
  36. matrix:
  37. python-version: [ 3.7, 3.8, 3.9 ]
  38. timeout-minutes: 15
  39. steps:
  40. - uses: actions/checkout@v2
  41. - name: Set up Python
  42. uses: actions/setup-python@v2
  43. with:
  44. python-version: ${{ matrix.python-version }}
  45. - name: Cache dependencies
  46. uses: actions/cache@v2
  47. with:
  48. path: ~/.cache/pip
  49. key: Key-v1-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
  50. - name: Install dependencies
  51. run: |
  52. python -m pip install --upgrade pip
  53. pip install -r requirements.txt
  54. pip install -r requirements-dev.txt
  55. - name: Test
  56. run: |
  57. hivemind-dht &> dht.log &
  58. INITIAL_PID=$$
  59. sleep 5
  60. export INITIAL_PEERS=$(python -c "with open('dht.log') as f: print(f.readlines()[1].split()[-1])" )
  61. echo "Initial peer: ${INITIAL_PEERS}"
  62. cat dht.log
  63. python -m cli.run_server --converted_model_name_or_path bloom-testing/test-bloomd-350m \
  64. --block_indices 0:12 --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &
  65. SERVER1_PID=$$
  66. sleep 60 # wait for server to download layers
  67. ps aux | grep dht
  68. # test individual blocks
  69. export PYTHONPATH=. REF_NAME=bloom-testing/test-bloomd-350m
  70. BLOCK_UID=bloom-testing/test-bloomd-350m.0 REF_INDEX=0 pytest tests/test_block_exact_match.py
  71. BLOCK_UID=bloom-testing/test-bloomd-350m.4 REF_INDEX=4 pytest tests/test_block_exact_match.py
  72. kill $INITIAL_PID $SERVER1_PID
  73. echo "Done!"