run-tests.yaml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. strategy:
  34. matrix:
  35. python-version: [ 3.7, 3.8, 3.9 ]
  36. timeout-minutes: 15
  37. steps:
  38. - uses: actions/checkout@v2
  39. - name: Set up Python
  40. uses: actions/setup-python@v2
  41. with:
  42. python-version: ${{ matrix.python-version }}
  43. - name: Cache dependencies
  44. uses: actions/cache@v2
  45. with:
  46. path: ~/.cache/pip
  47. key: Key-v1-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
  48. - name: Install dependencies
  49. run: |
  50. python -m pip install --upgrade pip
  51. pip install -r requirements.txt
  52. pip install -r requirements-dev.txt
  53. - name: Test
  54. run: |
  55. # launch a DHT-only peer to connect others
  56. hivemind-dht &> dht.log &
  57. INITIAL_PID=$$
  58. sleep 3
  59. INITIAL_PEERS=$(python -c "with open('dht.log') as f: print(f.readlines()[1].split()[-1])" )
  60. echo "Initial peer: ${INITIAL_PEERS}"
  61. python -m cli.run_server --converted_model_name_or_path bloom-testing/test-bloomd-350m \
  62. --block_indices 0:12 --torch_dtype float32 --initial_peers $INITIAL_PEERS &> server1.log &
  63. SERVER1_PID=$$
  64. sleep 60 # wait for server to download layers
  65. # test individual blocks
  66. export PYTHONPATH=. REF_NAME=bloom-testing/test-bloomd-350m
  67. BLOCK_UID=bloom-testing/test-bloomd-350m.0 REF_INDEX=0 pytest tests/test_block_exact_match.py
  68. BLOCK_UID=bloom-testing/test-bloomd-350m.0 REF_INDEX=2 pytest tests/test_block_exact_match.py
  69. kill $INITIAL_PID $SERVER1_PID
  70. #python -m cli.run_server --converted_model_name_or_path bloom-testing/test-bloomd-350m \
  71. # --block_indices 9:19 --torch_dtype float32 --initial_peers $INITIAL_PEERS &> server2.log &
  72. #SERVER2_PID=$$
  73. #
  74. #python -m cli.run_server --converted_model_name_or_path bloom-testing/test-bloomd-350m \
  75. # --block_indices 18:24 --torch_dtype float32 --initial_peers $INITIAL_PEER &> server3.log &
  76. #SERVER3_PID=$$