mirror of
https://github.com/bigscience-workshop/petals
synced 2024-10-31 09:20:41 +00:00
Use python -m petals.cli.run_server
instead of `python -m
cli.run_server`
This commit is contained in:
parent
3ce3fc296d
commit
e8b2091a96
12
.github/workflows/run-tests.yaml
vendored
12
.github/workflows/run-tests.yaml
vendored
@ -37,7 +37,7 @@ jobs:
|
||||
- name: Convert model and push to hub
|
||||
run: |
|
||||
export HF_TAG=$(python -c "import os; print(os.environ.get('GITHUB_HEAD_REF') or os.environ.get('GITHUB_REF_NAME'))")
|
||||
python -m cli.convert_model --model bigscience/bloom-560m --output_path ./converted_model \
|
||||
python -m petals.cli.convert_model --model bigscience/bloom-560m --output_path ./converted_model \
|
||||
--output_repo bloom-testing/test-bloomd-560m-$HF_TAG --use_auth_token $BLOOM_TESTING_WRITE_TOKEN \
|
||||
--resize_token_embeddings 50000
|
||||
|
||||
@ -70,7 +70,7 @@ jobs:
|
||||
export MODEL_NAME=bloom-testing/test-bloomd-560m-$HF_TAG
|
||||
export REF_NAME=bigscience/bloom-560m
|
||||
|
||||
python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:12 \
|
||||
python -m petals.cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:12 \
|
||||
--new_swarm --identity tests/test.id --host_maddrs /ip4/127.0.0.1/tcp/31337 --throughput 1 \
|
||||
--torch_dtype float32 --compression NONE --attn_cache_size 0.2GiB &> server1.log &
|
||||
SERVER1_PID=$!
|
||||
@ -80,21 +80,21 @@ jobs:
|
||||
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:22 \
|
||||
python -m petals.cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 12:22 \
|
||||
--initial_peers $INITIAL_PEERS --throughput 1 --torch_dtype float32 &> server2.log &
|
||||
SERVER2_PID=$!
|
||||
|
||||
sleep 10 # wait for initial servers to declare blocks, then let server decide which blocks to serve
|
||||
|
||||
python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:6 \
|
||||
python -m petals.cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 0:6 \
|
||||
--initial_peers $INITIAL_PEERS --throughput 1 --torch_dtype float32 &> server3.log &
|
||||
SERVER3_PID=$!
|
||||
|
||||
python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 4:16 \
|
||||
python -m petals.cli.run_server --converted_model_name_or_path $MODEL_NAME --block_indices 4:16 \
|
||||
--torch_dtype float32 --initial_peers $INITIAL_PEERS --throughput 1 &> server4.log &
|
||||
SERVER4_PID=$!
|
||||
|
||||
python -m cli.run_server --converted_model_name_or_path $MODEL_NAME --num_blocks 3 \
|
||||
python -m petals.cli.run_server --converted_model_name_or_path $MODEL_NAME --num_blocks 3 \
|
||||
--initial_peers $INITIAL_PEERS --throughput 1 --torch_dtype float32 &> server5.log &
|
||||
SERVER5_PID=$!
|
||||
|
||||
|
10
README.md
10
README.md
@ -107,7 +107,7 @@ For a detailed instruction with larger models, see ["Launch your own swarm"](htt
|
||||
|
||||
First, run a couple of servers, each in a separate shell. To launch your first server, run:
|
||||
```bash
|
||||
python -m cli.run_server bloom-testing/test-bloomd-560m-main --num_blocks 8 --torch_dtype float32 \
|
||||
python -m petals.cli.run_server bloom-testing/test-bloomd-560m-main --num_blocks 8 --torch_dtype float32 \
|
||||
--host_maddrs /ip4/127.0.0.1/tcp/31337 # use port 31337, local connections only
|
||||
```
|
||||
|
||||
@ -124,7 +124,7 @@ Mon Day 01:23:45.678 [INFO] Running DHT node on ['/ip4/127.0.0.1/tcp/31337/p2p/A
|
||||
You can use this address (`/ip4/whatever/else`) to connect additional servers. Open another terminal and run:
|
||||
|
||||
```bash
|
||||
python -m cli.run_server bloom-testing/test-bloomd-560m-main --num_blocks 8 --torch_dtype float32 \
|
||||
python -m petals.cli.run_server bloom-testing/test-bloomd-560m-main --num_blocks 8 --torch_dtype float32 \
|
||||
--host_maddrs /ip4/127.0.0.1/tcp/0 \
|
||||
--initial_peers /ip4/127.0... # <-- TODO: Copy the address of another server here
|
||||
# e.g. --initial_peers /ip4/127.0.0.1/tcp/31337/p2p/QmS1GecIfYouAreReadingThisYouNeedToCopyYourServerAddressCBBq
|
||||
@ -176,14 +176,14 @@ To run minimalistic tests, spin up some servers:
|
||||
```bash
|
||||
export MODEL_NAME=bloom-testing/test-bloomd-560m-main
|
||||
export INITIAL_PEERS=/ip4/127.0.0.1/tcp/31337/p2p/QmS9KwZptnVdB9FFV7uGgaTq4sEKBwcYeKZDfSpyKDUd1g
|
||||
python -m cli.run_server $MODEL_NAME --block_indices 0:12 --throughput 1 --torch_dtype float32 \
|
||||
python -m petals.cli.run_server $MODEL_NAME --block_indices 0:12 --throughput 1 --torch_dtype float32 \
|
||||
--identity tests/test.id --host_maddrs /ip4/127.0.0.1/tcp/31337 &> server1.log &
|
||||
sleep 5 # wait for the first server to initialize DHT
|
||||
python -m cli.run_server $MODEL_NAME --block_indices 12:24 --throughput 1 --torch_dtype float32 \
|
||||
python -m petals.cli.run_server $MODEL_NAME --block_indices 12:24 --throughput 1 --torch_dtype float32 \
|
||||
--initial_peers /ip4/127.0.0.1/tcp/31337/p2p/QmS9KwZptnVdB9FFV7uGgaTq4sEKBwcYeKZDfSpyKDUd1g &> server2.log &
|
||||
|
||||
tail -f server1.log server2.log # view logs for both servers
|
||||
# after you're done, kill servers with 'pkill -f cli.run_server'
|
||||
# after you're done, kill servers with 'pkill -f petals.cli.run_server'
|
||||
```
|
||||
|
||||
Then launch pytest:
|
||||
|
Loading…
Reference in New Issue
Block a user