pretrain_gpt_distributed.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #! /bin/bash
  2. # Runs the "345M" parameter model
  3. GPUS_PER_NODE=8
  4. # Change for multinode config
  5. MASTER_ADDR=localhost
  6. MASTER_PORT=6000
  7. NNODES=1
  8. NODE_RANK=0
  9. WORLD_SIZE=$(($GPUS_PER_NODE*$NNODES))
  10. DATA_PATH=<Specify path and file prefix>_text_document
  11. CHECKPOINT_PATH=<Specify path>
  12. DISTRIBUTED_ARGS="--nproc_per_node $GPUS_PER_NODE --nnodes $NNODES --node_rank $NODE_RANK --master_addr $MASTER_ADDR --master_port $MASTER_PORT"
  13. python -m torch.distributed.launch $DISTRIBUTED_ARGS \
  14. pretrain_gpt.py \
  15. --num-layers 24 \
  16. --hidden-size 1024 \
  17. --num-attention-heads 16 \
  18. --micro-batch-size 8 \
  19. --global-batch-size 64 \
  20. --seq-length 1024 \
  21. --max-position-embeddings 1024 \
  22. --train-iters 500000 \
  23. --lr-decay-iters 320000 \
  24. --save $CHECKPOINT_PATH \
  25. --load $CHECKPOINT_PATH \
  26. --data-path $DATA_PATH \
  27. --vocab-file gpt2-vocab.json \
  28. --merge-file gpt2-merges.txt \
  29. --data-impl mmap \
  30. --split 949,50,1 \
  31. --distributed-backend nccl \
  32. --lr 0.00015 \
  33. --lr-decay-style cosine \
  34. --min-lr 1.0e-5 \
  35. --weight-decay 1e-2 \
  36. --clip-grad 1.0 \
  37. --lr-warmup-fraction .01 \
  38. --checkpoint-activations \
  39. --log-interval 100 \
  40. --save-interval 10000 \
  41. --eval-interval 1000 \
  42. --eval-iters 10 \
  43. --fp16