You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Go to file
justheuristic a8357faa45 WIP 2 years ago
.gitignore install script 2 years ago
README.md WIP 2 years ago
client.py WIP 2 years ago
load_balancer.py WIP 2 years ago
run_server.py WIP 2 years ago
your_code_here.py WIP 2 years ago

README.md

Install (core only)


conda create -y --name demo-for-laion python=3.8.12 pip
conda activate demo-for-laion
conda install -y -c conda-forge cudatoolkit-dev==11.3.1 cudatoolkit==11.3.1 cudnn==8.2.1.32
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html
pip install https://github.com/learning-at-home/hivemind/archive/refs/heads/master.zip

Run server

python -m run_server --custom_module_path ./your_code_here.py --expert_cls ExampleModule --hidden_dim 512 \
   --dht_prefix "enter_name_here" --identity server1.id  --host_maddrs "/ip4/0.0.0.0/tcp/31337"
# connect extra servers via --initial_peers ADDRESS_PRINTED_BY_ONE_OR_MORE_EXISTNG_PEERS # e.g. /ip4/123.123.123.123/rcp/31337

Call remote inference

import torch
import hivemind
from client import BalancedRemoteExpert
dht = hivemind.DHT(
    initial_peers=['TODO_COPY_ADDRESS_FROM_ONE_OR_MODE_SERVERS'], start=True, client_mode=True
)

self = BalancedRemoteExpert(dht=dht, uid_prefix="enter_name_here.")

self(torch.randn(1, 512))

[ Based on assorted code by shuf(mryab@ younesbelkada@ borzunov@ timdettmers@ dbaranchuk@ greenfatguy@ artek0chumak@ and hivemind contributors) ]