2022-07-15 22:59:23 +00:00
|
|
|
name: Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-07-15 23:11:17 +00:00
|
|
|
branches: [ main ]
|
2022-07-15 22:59:23 +00:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
convert-model:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
BLOOM_TESTING_WRITE_TOKEN: ${{ secrets.BLOOM_TESTING_WRITE_TOKEN }}
|
|
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.9
|
|
|
|
- name: Cache dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: Key-v1-py3.9-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install -r requirements.txt
|
|
|
|
- name: Delete previous model, if exists
|
|
|
|
run: |
|
2022-07-22 19:38:40 +00:00
|
|
|
export HF_TAG=$(python -c "import os; print(os.environ.get('GITHUB_HEAD_REF') or os.environ.get('GITHUB_REF_NAME'))")
|
2022-07-15 22:59:23 +00:00
|
|
|
python -c "from huggingface_hub import delete_repo; delete_repo(token='$BLOOM_TESTING_WRITE_TOKEN', \
|
2022-07-16 08:43:24 +00:00
|
|
|
name='test-bloomd-350m-$HF_TAG', organization='bloom-testing')" || true
|
2022-07-15 22:59:23 +00:00
|
|
|
- name: Convert model and push to hub
|
|
|
|
run: |
|
2022-07-22 19:38:40 +00:00
|
|
|
export HF_TAG=$(python -c "import os; print(os.environ.get('GITHUB_HEAD_REF') or os.environ.get('GITHUB_REF_NAME'))")
|
2022-07-15 22:59:23 +00:00
|
|
|
python -m cli.convert_model --model bigscience/bloom-350m --output_path ./converted_model \
|
2022-07-16 08:43:24 +00:00
|
|
|
--output_repo bloom-testing/test-bloomd-350m-$HF_TAG --use_auth_token $BLOOM_TESTING_WRITE_TOKEN
|
2022-07-15 22:59:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
run-tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: convert-model
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: [ 3.7, 3.8, 3.9 ]
|
|
|
|
fail-fast: false
|
|
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Cache dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: Key-v1-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install -r requirements.txt
|
|
|
|
pip install -r requirements-dev.txt
|
|
|
|
- name: Test
|
|
|
|
run: |
|
2022-07-22 19:38:40 +00:00
|
|
|
export HF_TAG=$(python -c "import os; print(os.environ.get('GITHUB_HEAD_REF') or os.environ.get('GITHUB_REF_NAME'))")
|
2022-07-16 08:43:24 +00:00
|
|
|
export MODEL_NAME=bloom-testing/test-bloomd-350m-$HF_TAG
|
2022-07-19 01:28:04 +00:00
|
|
|
export REF_NAME=bigscience/bloom-350m
|
|
|
|
|
2022-07-15 22:59:23 +00:00
|
|
|
python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:12 \
|
|
|
|
--torch_dtype float32 --identity tests/test.id --host_maddrs /ip4/127.0.0.1/tcp/31337 --throughput 1 &
|
|
|
|
SERVER1_PID=$!
|
|
|
|
|
2022-07-22 19:38:40 +00:00
|
|
|
sleep 5 # wait for the first server to initialize DHT
|
|
|
|
|
2022-07-15 22:59:23 +00:00
|
|
|
export INITIAL_PEERS=/ip4/127.0.0.1/tcp/31337/p2p/QmS9KwZptnVdB9FFV7uGgaTq4sEKBwcYeKZDfSpyKDUd1g
|
|
|
|
# ^-- server 1 multiaddr is determined by --identity and --host_maddrs
|
|
|
|
|
|
|
|
python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 12:24 \
|
|
|
|
--torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &> server2.log &
|
|
|
|
SERVER2_PID=$!
|
|
|
|
|
2022-07-22 19:38:40 +00:00
|
|
|
sleep 60 # wait for server to download layers
|
2022-07-15 22:59:23 +00:00
|
|
|
|
2022-07-19 01:28:04 +00:00
|
|
|
PYTHONPATH=. pytest tests
|
2022-07-15 22:59:23 +00:00
|
|
|
|
|
|
|
kill -s SIGINT $SERVER1_PID $SERVER2_PID
|
|
|
|
echo "Done!"
|