run-tests.yaml 3.1 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: 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. # launch a DHT-only peer to connect others
  57. hivemind-dht &> dht.log &
  58. INITIAL_PID=$$
  59. sleep 3
  60. INITIAL_PEERS=$(python -c "with open('dht.log') as f: print(f.readlines()[1].split()[-1])" )
  61. echo "Initial peer: ${INITIAL_PEERS}"
  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 &> server1.log &
  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.0 REF_INDEX=2 pytest tests/test_block_exact_match.py
  70. kill $INITIAL_PID $SERVER1_PID
  71. #python -m cli.run_server --converted_model_name_or_path bloom-testing/test-bloomd-350m \
  72. # --block_indices 9:19 --torch_dtype float32 --initial_peers $INITIAL_PEERS &> server2.log &
  73. #SERVER2_PID=$$
  74. #
  75. #python -m cli.run_server --converted_model_name_or_path bloom-testing/test-bloomd-350m \
  76. # --block_indices 18:24 --torch_dtype float32 --initial_peers $INITIAL_PEER &> server3.log &
  77. #SERVER3_PID=$$