run-tests.yaml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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: Delete previous model, if exists
  28. run: |
  29. python -c "from huggingface_hub import delete_repo; delete_repo(token='$BLOOM_TESTING_WRITE_TOKEN', \
  30. name='test-bloomd-350m-$GITHUB_HEAD_REF', organization='bloom-testing')" || true
  31. - name: Convert model and push to hub
  32. run: |
  33. python -m cli.convert_model --model bigscience/bloom-350m --output_path ./converted_model \
  34. --output_repo bloom-testing/test-bloomd-350m-$GITHUB_HEAD_REF --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. fail-fast: false
  42. timeout-minutes: 15
  43. steps:
  44. - uses: actions/checkout@v2
  45. - name: Set up Python
  46. uses: actions/setup-python@v2
  47. with:
  48. python-version: ${{ matrix.python-version }}
  49. - name: Cache dependencies
  50. uses: actions/cache@v2
  51. with:
  52. path: ~/.cache/pip
  53. key: Key-v1-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
  54. - name: Install dependencies
  55. run: |
  56. python -m pip install --upgrade pip
  57. pip install -r requirements.txt
  58. pip install -r requirements-dev.txt
  59. - name: Test
  60. run: |
  61. export MODEL_NAME=bloom-testing/test-bloomd-350m-$GITHUB_HEAD_REF
  62. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:12 \
  63. --torch_dtype float32 --identity tests/test.id --host_maddrs /ip4/127.0.0.1/tcp/31337 --throughput 1 &
  64. SERVER1_PID=$!
  65. export INITIAL_PEERS=/ip4/127.0.0.1/tcp/31337/p2p/QmS9KwZptnVdB9FFV7uGgaTq4sEKBwcYeKZDfSpyKDUd1g
  66. # ^-- server 1 multiaddr is determined by --identity and --host_maddrs
  67. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 12:24 \
  68. --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &> server2.log &
  69. SERVER2_PID=$!
  70. sleep 30 # wait for server to download layers
  71. # test individual blocks
  72. export PYTHONPATH=.
  73. BLOCK_UID=$MODEL_NAME.0 REF_NAME=$MODEL_NAME REF_INDEX=0 pytest tests/test_block_exact_match.py
  74. BLOCK_UID=$MODEL_NAME.19 REF_NAME=$MODEL_NAME REF_INDEX=19 pytest tests/test_block_exact_match.py
  75. REF_NAME=$MODEL_NAME pytest tests/test_chained_calls.py
  76. REF_NAME=bigscience/bloom-350m pytest tests/test_full_model.py
  77. kill -s SIGINT $SERVER1_PID $SERVER2_PID
  78. echo "Done!"