run-tests.yaml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. name: Tests
  2. on:
  3. push:
  4. branches: [ main ]
  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. export HF_TAG=$(python -c "import os; print(os.environ.get('GITHUB_HEAD_REF') or os.environ.get('GITHUB_REF_NAME'))")
  30. python -c "from huggingface_hub import delete_repo; delete_repo(token='$BLOOM_TESTING_WRITE_TOKEN', \
  31. name='test-bloomd-350m-$HF_TAG', organization='bloom-testing')" || true
  32. - name: Convert model and push to hub
  33. run: |
  34. export HF_TAG=$(python -c "import os; print(os.environ.get('GITHUB_HEAD_REF') or os.environ.get('GITHUB_REF_NAME'))")
  35. python -m cli.convert_model --model bigscience/bloom-350m --output_path ./converted_model \
  36. --output_repo bloom-testing/test-bloomd-350m-$HF_TAG --use_auth_token $BLOOM_TESTING_WRITE_TOKEN
  37. run-tests:
  38. runs-on: ubuntu-latest
  39. needs: convert-model
  40. strategy:
  41. matrix:
  42. python-version: [ 3.7, 3.8, 3.9 ]
  43. fail-fast: false
  44. timeout-minutes: 15
  45. steps:
  46. - uses: actions/checkout@v2
  47. - name: Set up Python
  48. uses: actions/setup-python@v2
  49. with:
  50. python-version: ${{ matrix.python-version }}
  51. - name: Cache dependencies
  52. uses: actions/cache@v2
  53. with:
  54. path: ~/.cache/pip
  55. key: Key-v1-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
  56. - name: Install dependencies
  57. run: |
  58. python -m pip install --upgrade pip
  59. pip install -r requirements.txt
  60. pip install -r requirements-dev.txt
  61. - name: Test
  62. run: |
  63. export HF_TAG=$(python -c "import os; print(os.environ.get('GITHUB_HEAD_REF') or os.environ.get('GITHUB_REF_NAME'))")
  64. export MODEL_NAME=bloom-testing/test-bloomd-350m-$HF_TAG
  65. export REF_NAME=bigscience/bloom-350m
  66. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:12 \
  67. --torch_dtype float32 --identity tests/test.id --host_maddrs /ip4/127.0.0.1/tcp/31337 --throughput 1 &
  68. SERVER1_PID=$!
  69. sleep 5 # wait for the first server to initialize DHT
  70. export INITIAL_PEERS=/ip4/127.0.0.1/tcp/31337/p2p/QmS9KwZptnVdB9FFV7uGgaTq4sEKBwcYeKZDfSpyKDUd1g
  71. # ^-- server 1 multiaddr is determined by --identity and --host_maddrs
  72. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 12:24 \
  73. --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &> server2.log &
  74. SERVER2_PID=$!
  75. sleep 60 # wait for server to download layers
  76. PYTHONPATH=. pytest tests
  77. kill -s SIGINT $SERVER1_PID $SERVER2_PID
  78. echo "Done!"