run-tests.yaml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 test models older than 72 hours
  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-560m-$HF_TAG', organization='bloom-testing')" || true
  32. # - name: Delete previous model, if exists
  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 -c "from huggingface_hub import delete_repo; delete_repo(token='$BLOOM_TESTING_WRITE_TOKEN', \
  36. # name='test-bloomd-560m-$HF_TAG', organization='bloom-testing')" || true
  37. # - name: Convert model and push to hub
  38. # run: |
  39. # export HF_TAG=$(python -c "import os; print(os.environ.get('GITHUB_HEAD_REF') or os.environ.get('GITHUB_REF_NAME'))")
  40. # python -m cli.convert_model --model bigscience/bloom-560m --output_path ./converted_model \
  41. # --output_repo bloom-testing/test-bloomd-560m-$HF_TAG --use_auth_token $BLOOM_TESTING_WRITE_TOKEN \
  42. # --resize_token_embeddings 10000
  43. run-tests:
  44. runs-on: ubuntu-latest
  45. # needs: convert-model
  46. strategy:
  47. matrix:
  48. python-version: [ 3.7, 3.8, 3.9 ]
  49. fail-fast: false
  50. timeout-minutes: 15
  51. steps:
  52. - uses: actions/checkout@v2
  53. - name: Set up Python
  54. uses: actions/setup-python@v2
  55. with:
  56. python-version: ${{ matrix.python-version }}
  57. - name: Cache dependencies
  58. uses: actions/cache@v2
  59. with:
  60. path: ~/.cache/pip
  61. key: Key-v1-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
  62. - name: Install dependencies
  63. run: |
  64. python -m pip install --upgrade pip
  65. pip install -r requirements.txt
  66. pip install -r requirements-dev.txt
  67. - name: Build bitsandbytes cpuonly
  68. run: |
  69. git clone https://github.com/TimDettmers/bitsandbytes.git
  70. cd bitsandbytes
  71. git checkout de354f7ded52bfa857089769225cdf1ee694bfd6
  72. make cpuonly
  73. pip install .
  74. cd -
  75. - name: Test
  76. run: |
  77. export HF_TAG=$(python -c "import os; print(os.environ.get('GITHUB_HEAD_REF') or os.environ.get('GITHUB_REF_NAME'))")
  78. export MODEL_NAME=bloom-testing/test-bloomd-560m-$HF_TAG
  79. export REF_NAME=bigscience/bloom-560m
  80. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:12 \
  81. --torch_dtype float32 --identity tests/test.id --host_maddrs /ip4/127.0.0.1/tcp/31337 --throughput 1 &
  82. SERVER1_PID=$!
  83. sleep 5 # wait for the first server to initialize DHT
  84. export INITIAL_PEERS=/ip4/127.0.0.1/tcp/31337/p2p/QmS9KwZptnVdB9FFV7uGgaTq4sEKBwcYeKZDfSpyKDUd1g
  85. # ^-- server 1 multiaddr is determined by --identity and --host_maddrs
  86. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 12:22 \
  87. --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &> server2.log &
  88. SERVER2_PID=$!
  89. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:6 \
  90. --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &> server3.log &
  91. SERVER3_PID=$!
  92. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 4:16 \
  93. --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &> server4.log &
  94. SERVER4_PID=$!
  95. sleep 10 # wait for initial servers to declare blocks, then let server decide which blocks to serve
  96. python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --num_blocks 3 \
  97. --torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &> server4.log &
  98. SERVER5_PID=$!
  99. sleep 30 # wait for server to download layers
  100. PYTHONPATH=. pytest tests --durations=0 --durations-min=1.0 -v
  101. kill -s SIGINT $SERVER1_PID $SERVER2_PID $SERVER3_PID $SERVER4_PID $SERVER5_PID
  102. echo "Done!"