| 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 4 | # All rights reserved. |
| 5 | # |
| 6 | # This source code is licensed under the terms described in the LICENSE file in |
| 7 | # the root directory of this source tree. |
| 8 | |
| 9 | set -euo pipefail |
| 10 | set -x |
| 11 | |
| 12 | cd $(git rev-parse --show-toplevel) |
| 13 | |
| 14 | MASTER_HOST=$1 |
| 15 | RUN_ID=$2 |
| 16 | CKPT_DIR=$3 |
| 17 | QUANT_CKPT_DIR=$4 |
| 18 | TOKENIZER_PATH=$5 |
| 19 | NNODES=$6 |
| 20 | NPROC=$7 |
| 21 | |
| 22 | echo $MASTER_HOST, $RUN_ID, $CKPT_DIR, $QUANT_CKPT_DIR |
| 23 | |
| 24 | NCCL_NET=Socket NCCL_SOCKET_IFNAME=eth TIKTOKEN_CACHE_DIR="" \ |
| 25 | torchrun \ |
| 26 | --nnodes=$NNODES --nproc_per_node=$NPROC \ |
| 27 | --rdzv_id=$RUN_ID \ |
| 28 | --rdzv_conf='timeout=120' \ |
| 29 | --rdzv_backend=c10d \ |
| 30 | --rdzv_endpoint="${MASTER_HOST}:29502" \ |
| 31 | quantize_checkpoint.py $CKPT_DIR $TOKENIZER_PATH $QUANT_CKPT_DIR |