Instructions to use cszhilu1998/LiveWorld with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use cszhilu1998/LiveWorld with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("cszhilu1998/LiveWorld", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download LiveWorld-Code/train.sh from cszhilu1998/LiveWorld: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/cszhilu1998/LiveWorld/resolve/main/LiveWorld-Code/train.sh
- Command line
-
hf download hf://cszhilu1998/LiveWorld/LiveWorld-Code/train.sh
-
curl -L -o train.sh https://huggingface.co/cszhilu1998/LiveWorld/resolve/main/LiveWorld-Code/train.sh
1.1 kB
| # LiveWorld Training | |
| export TORCH_HOME=./ckpts | |
| export HF_HUB_DISABLE_IMPORTS_VERIFICATION=1 | |
| export NCCL_TIMEOUT=7200 | |
| # === Define nodes and per-node GPU assignments === | |
| NODES=("$(hostname)") | |
| CUDA_VISIBLE_DEVICES_LIST=("1") | |
| # === Auto-detect current node === | |
| HOSTNAME=$(hostname) | |
| for i in "${!NODES[@]}"; do | |
| if [[ "$HOSTNAME" == "${NODES[$i]}" ]]; then | |
| NODE_RANK=$i | |
| export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES_LIST[$i]} | |
| break | |
| fi | |
| done | |
| if [[ -z "$NODE_RANK" ]]; then | |
| echo "Error: hostname ($HOSTNAME) not in NODES list." | |
| exit 1 | |
| fi | |
| MASTER_ADDR=${NODES[0]} | |
| NNODES=${#NODES[@]} | |
| GPUS_PER_NODE=$(echo $CUDA_VISIBLE_DEVICES | awk -F',' '{print NF}') | |
| echo "Node: $HOSTNAME | rank=$NODE_RANK | GPUs=$CUDA_VISIBLE_DEVICES | master=$MASTER_ADDR | nnodes=$NNODES" | |
| torchrun \ | |
| --nproc_per_node=$GPUS_PER_NODE \ | |
| --nnodes=$NNODES \ | |
| --node_rank=$NODE_RANK \ | |
| --rdzv_id=5235 \ | |
| --rdzv_backend=c10d \ | |
| --rdzv_endpoint=$MASTER_ADDR:29511 \ | |
| scripts/train.py \ | |
| --config_path configs/train_liveworld_1-3B.yaml \ | |
| --disable_wandb | |