run-tests.yaml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. timeout-minutes: 15
  42. steps:
  43. - uses: actions/checkout@v2
  44. - name: Set up Python
  45. uses: actions/setup-python@v2
  46. with:
  47. python-version: ${{ matrix.python-version }}
  48. - name: Cache dependencies
  49. uses: actions/cache@v2
  50. with:
  51. path: ~/.cache/pip
  52. key: Key-v1-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
  53. - name: Install dependencies
  54. run: |
  55. python -m pip install --upgrade pip
  56. pip install -r requirements.txt
  57. pip install -r requirements-dev.txt
  58. - name: Test
  59. run: |
  60. hivemind-dht --host_maddrs /ip4/127.0.0.1/tcp/31337 &> dht.log &
  61. INITIAL_PID=$$
  62. sleep 5
  63. export INITIAL_PEERS=$(python -c "with open('dht.log') as f: print(f.readlines()[1].split()[-1])" )
  64. echo "Initial peer: ${INITIAL_PEERS}"
  65. cat dht.log
  66. python -m cli.run_server --converted_model_name_or_path bloom-testing/test-bloomd-350m --block_indices 0:12 \
  67. --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &
  68. SERVER1_PID=$$
  69. sleep 60 # wait for server to download layers
  70. ps aux
  71. # test individual blocks
  72. export PYTHONPATH=. REF_NAME=bloom-testing/test-bloomd-350m
  73. BLOCK_UID=bloom-testing/test-bloomd-350m.0 REF_INDEX=0 pytest tests/test_block_exact_match.py
  74. BLOCK_UID=bloom-testing/test-bloomd-350m.4 REF_INDEX=4 pytest tests/test_block_exact_match.py
  75. #kill $INITIAL_PID $SERVER1_PID
  76. echo "Done!"