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-$GITHUB_HEAD_REF --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. fail-fast: false
  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. export MODEL_NAME=test-bloomd-350m-$GITHUB_HEAD_REF
  58. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:12 \
  59. --torch_dtype float32 --identity tests/test.id --host_maddrs /ip4/127.0.0.1/tcp/31337 --throughput 1 &
  60. SERVER1_PID=$!
  61. export INITIAL_PEERS=/ip4/127.0.0.1/tcp/31337/p2p/QmS9KwZptnVdB9FFV7uGgaTq4sEKBwcYeKZDfSpyKDUd1g
  62. # ^-- server 1 multiaddr is determined by --identity and --host_maddrs
  63. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 12:24 \
  64. --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &> server2.log &
  65. SERVER2_PID=$!
  66. sleep 30 # wait for server to download layers
  67. # test individual blocks
  68. export PYTHONPATH=.
  69. BLOCK_UID=$MODEL_NAME.0 REF_NAME=$MODEL_NAME REF_INDEX=0 pytest tests/test_block_exact_match.py
  70. BLOCK_UID=$MODEL_NAME.19 REF_NAME=$MODEL_NAME REF_INDEX=19 pytest tests/test_block_exact_match.py
  71. REF_NAME=$MODEL_NAME pytest tests/test_chained_calls.py
  72. REF_NAME=bigscience/bloom-350m pytest tests/test_full_model.py
  73. kill -s SIGINT $SERVER1_PID $SERVER2_PID
  74. echo "Done!"