run-tests.yaml 2.7 KB

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