-
Notifications
You must be signed in to change notification settings - Fork 101
Add t0 scripts #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Add t0 scripts #50
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
94adbdd
Add t0 scripts
Muennighoff 3b8cc31
Add T0 specific args
Muennighoff 058e60b
Remove warmup
Muennighoff d93e169
Update train/t0/tr11f-6B3-ml-t0.slurm
Muennighoff 78791e2
t0 -> tr13
Muennighoff 094a273
t0 -> tr13
Muennighoff 2fc43b0
Use weighted-split-path
Muennighoff 41c1ef4
Add 350M script & adjust HPs
Muennighoff 877158b
Adjust tr13f-350M
Muennighoff 5674c69
Add weight decay based on FLAN
Muennighoff 582ee32
Remove finetune & add checkpoint-activations
Muennighoff d5b1622
Remove finetune
Muennighoff 56729d3
Change BS for more throughput & increase LR
Muennighoff 318dfc7
Update train/tr13-t0/t0_test.slurm
Muennighoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
#!/bin/bash | ||
#SBATCH --job-name=tr11e-350M-ml-t0 | ||
#SBATCH --nodes=1 | ||
#SBATCH --ntasks-per-node=1 # crucial - only 1 task per dist per node! | ||
#SBATCH --cpus-per-task=40 # number of cores per tasks | ||
#SBATCH --hint=nomultithread # we get physical cores not logical | ||
#SBATCH --gres=gpu:1 # number of gpus | ||
#SBATCH -C v100-32g | ||
#SBATCH --time 20:00:00 # maximum execution time (HH:MM:SS) | ||
#SBATCH --output=%x-%j.out # output file name | ||
#SBATCH --account=six@v100 | ||
|
||
set -x -e | ||
|
||
source $six_ALL_CCFRWORK/start-muennighofflmeval | ||
echo "START TIME: $(date)" | ||
|
||
variant=main | ||
|
||
DATA_OUTPUT_PATH=$six_ALL_CCFRSCRATCH/checkpoints/tr11e-350M-ml | ||
CHECKPOINT_PATH=$DATA_OUTPUT_PATH/checkpoints/$variant | ||
REPO_PATH=$DATA_OUTPUT_PATH/tr11e-350M-ml-logs | ||
TENSORBOARD_PATH=$REPO_PATH/tensorboard-test/$variant | ||
LOGS_PATH=$REPO_PATH/logs-test/$variant | ||
mkdir -p $LOGS_PATH | ||
|
||
MEGATRON_DEEPSPEED_REPO=/gpfsscratch/rech/six/commun/commun/experiments/muennighoff/megdsmtf/thomas/Megatron-DeepSpeed | ||
cd $MEGATRON_DEEPSPEED_REPO | ||
|
||
BIGSCIENCE_REPO=$six_ALL_CCFRWORK/code/bigscience | ||
TOKENIZER_NAME_OR_PATH=bigscience-catalogue-data-dev/byte-level-bpe-tokenizer-no-norm-250k-whitespace-and-eos-regex-alpha-v3-dedup-lines-articles | ||
|
||
# defining the right environment variables | ||
export TRANSFORMERS_CACHE=$six_ALL_CCFRWORK/models | ||
export HF_DATASETS_CACHE=$six_ALL_CCFRWORK/datasets | ||
export HF_MODULES_CACHE=$six_ALL_CCFRWORK/modules | ||
export HF_METRICS_CACHE=$six_ALL_CCFRWORK/metrics | ||
export HF_DATASETS_OFFLINE=1 | ||
export TRANSFORMERS_OFFLINE=1 | ||
|
||
# testing for potential faulty nodes | ||
# srun --jobid $SLURM_JOBID bash -c 'python -c "import torch, socket; print(socket.gethostname(), torch.cuda.is_available())"' | ||
|
||
# so processes know who to talk to | ||
MASTER_ADDR=$(scontrol show hostnames $SLURM_JOB_NODELIST | head -n 1) | ||
MASTER_PORT=6001 | ||
|
||
GPUS_PER_NODE=1 | ||
NNODES=1 | ||
|
||
PP_SIZE=1 | ||
TP_SIZE=1 | ||
|
||
MICRO_BATCH_SIZE=1 | ||
GLOBAL_BATCH_SIZE=4 | ||
|
||
NLAYERS=2 | ||
NHIDDEN=1024 | ||
NHEADS=16 | ||
SEQ_LEN=256 | ||
|
||
SAVE_INTERVAL=250 | ||
|
||
TRAIN_SAMPLES=10 # TODO | ||
LR_DECAY_SAMPLES=10 # TODO | ||
LR_WARMUP_SAMPLES=1 # TODO | ||
|
||
|
||
OPTIMIZER_ARGS=" \ | ||
--optimizer adam \ | ||
--adam-beta1 0.9 \ | ||
--adam-beta2 0.95 \ | ||
--adam-eps 1e-8 \ | ||
--lr 3.0e-4 \ | ||
--min-lr 1e-5 \ | ||
--lr-decay-style cosine \ | ||
--lr-decay-samples $LR_DECAY_SAMPLES \ | ||
--lr-warmup-samples $LR_WARMUP_SAMPLES \ | ||
--clip-grad 1.0 \ | ||
--weight-decay 1e-1 \ | ||
" | ||
# for 20h 1190, for 100h 5990 | ||
# --exit-duration-in-mins 1190 \ | ||
EXIT_OPTS=" \ | ||
--exit-duration-in-mins 5990 \ | ||
" | ||
|
||
GPT_ARGS=" \ | ||
--pp-partition-method 'type:transformer|embedding' \ | ||
--num-layers $NLAYERS \ | ||
--hidden-size $NHIDDEN \ | ||
--num-attention-heads $NHEADS \ | ||
--seq-length $SEQ_LEN \ | ||
--max-position-embeddings $SEQ_LEN \ | ||
--micro-batch-size $MICRO_BATCH_SIZE \ | ||
--global-batch-size $GLOBAL_BATCH_SIZE \ | ||
--train-samples $TRAIN_SAMPLES \ | ||
--tokenizer-type PretrainedFromHF \ | ||
--tokenizer-name-or-path $TOKENIZER_NAME_OR_PATH \ | ||
--init-method-std 0.0048 \ | ||
--embed-layernorm \ | ||
--fp16 \ | ||
--seed 42 \ | ||
--position-embedding-type alibi \ | ||
--abort-on-unmet-fused-kernel-constraints \ | ||
--pad-vocab-size-to 250880 \ | ||
$OPTIMIZER_ARGS \ | ||
$EXIT_OPTS \ | ||
" | ||
|
||
OUTPUT_ARGS=" \ | ||
--log-interval 1 \ | ||
--save-interval $SAVE_INTERVAL \ | ||
--eval-interval 1000 \ | ||
--eval-iters 1 \ | ||
--tensorboard-dir $TENSORBOARD_PATH \ | ||
--tensorboard-queue-size 5 \ | ||
--log-timers-to-tensorboard \ | ||
--log-batch-size-to-tensorboard \ | ||
--log-validation-ppl-to-tensorboard \ | ||
" | ||
|
||
ZERO_STAGE=0 # important: bf16 must use z0! it implements its own zero stage 1 equivalent | ||
|
||
config_json="./ds_config.$SLURM_JOBID.json" | ||
|
||
# Deepspeed figures out GAS dynamically from dynamic GBS via set_train_batch_size() | ||
cat <<EOT > $config_json | ||
{ | ||
"train_micro_batch_size_per_gpu": $MICRO_BATCH_SIZE, | ||
"train_batch_size": $GLOBAL_BATCH_SIZE, | ||
"gradient_clipping": 1.0, | ||
"zero_optimization": { | ||
"stage": $ZERO_STAGE | ||
}, | ||
"fp16": { | ||
"enabled": true, | ||
"loss_scale": 0, | ||
"loss_scale_window": 500, | ||
"hysteresis": 2, | ||
"min_loss_scale": 1, | ||
"initial_scale_power": 12 | ||
}, | ||
"steps_per_print": 2000, | ||
"wall_clock_breakdown": false | ||
} | ||
EOT | ||
|
||
|
||
DEEPSPEED_ARGS=" \ | ||
--deepspeed \ | ||
--deepspeed_config ${config_json} \ | ||
--zero-stage ${ZERO_STAGE} \ | ||
--deepspeed-activation-checkpointing \ | ||
" | ||
|
||
export LAUNCHER="python -u -m torch.distributed.run \ | ||
--nproc_per_node $GPUS_PER_NODE \ | ||
--nnodes $NNODES \ | ||
--rdzv_endpoint $MASTER_ADDR:$MASTER_PORT \ | ||
--rdzv_backend c10d \ | ||
--max_restarts 0 \ | ||
--tee 3 \ | ||
" | ||
|
||
DATA_PATH="/gpfswork/rech/six/commun/bigscience-training/p3t0/p3_t0_train" | ||
|
||
|
||
export CMD=" \ | ||
`pwd`/finetune_t0_non_causal_decoder.py \ | ||
--tensor-model-parallel-size $TP_SIZE \ | ||
--pipeline-model-parallel-size $PP_SIZE \ | ||
$GPT_ARGS \ | ||
$OUTPUT_ARGS \ | ||
--data-path $DATA_PATH \ | ||
--split 100,0,0 \ | ||
--dataloader-type single \ | ||
--data-impl mmap \ | ||
--distributed-backend nccl \ | ||
$DEEPSPEED_ARGS \ | ||
" | ||
|
||
echo $CMD | ||
|
||
# do not remove or the training will hang and nodes will be lost w/o this workaround | ||
export CUDA_LAUNCH_BLOCKING=1 | ||
|
||
# hide duplicated errors using this hack - will be properly fixed in pt-1.12 | ||
export TORCHELASTIC_ERROR_FILE=/tmp/torch-elastic-error.json | ||
|
||
clear; srun --jobid $SLURM_JOBID bash -c "$LAUNCHER --node_rank \$SLURM_PROCID $CMD" 2>&1 | tee -a $LOGS_PATH/main_log.txt | ||
|
||
echo "END TIME: $(date)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
#!/bin/bash | ||
#SBATCH --job-name=tr11f-6B3-ml-t0 | ||
#SBATCH --partition=gpu_p5 | ||
#SBATCH --constraint=a100 | ||
#SBATCH --reservation=hug | ||
#SBATCH --qos=qos_gpu-gc # up to 100h | ||
#SBATCH --nodes=16 | ||
#SBATCH --ntasks-per-node=1 # crucial - only 1 task per dist per node! | ||
#SBATCH --cpus-per-task=64 # number of cores per tasks | ||
#SBATCH --hint=nomultithread # we get physical cores not logical | ||
#SBATCH --gres=gpu:8 # number of gpus | ||
#SBATCH --time 100:00:00 # maximum execution time (HH:MM:SS) | ||
#SBATCH --output=%x-%j.out # output file name | ||
#SBATCH --account=six@a100 | ||
|
||
set -x -e | ||
|
||
source $six_ALL_CCFRWORK/start-tr11f-6B3-ml-t0 # TODO | ||
echo "START TIME: $(date)" | ||
|
||
variant=main | ||
|
||
DATA_OUTPUT_PATH=$six_ALL_CCFRSCRATCH/checkpoints/tr11f-6B3-ml-t0 | ||
CHECKPOINT_PATH=$DATA_OUTPUT_PATH/checkpoints/$variant | ||
REPO_PATH=$DATA_OUTPUT_PATH/tr11f-6B3-ml-t0-logs | ||
Muennighoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TENSORBOARD_PATH=$REPO_PATH/tensorboard/$variant | ||
LOGS_PATH=$REPO_PATH/logs/$variant | ||
mkdir -p $LOGS_PATH | ||
|
||
MEGATRON_DEEPSPEED_REPO=$six_ALL_CCFRWORK/code/tr11f-6B3-ml-t0/Megatron-DeepSpeed # TODO | ||
cd $MEGATRON_DEEPSPEED_REPO | ||
|
||
BIGSCIENCE_REPO=$six_ALL_CCFRWORK/code/bigscience | ||
Muennighoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TOKENIZER_NAME_OR_PATH=bigscience-catalogue-data-dev/byte-level-bpe-tokenizer-no-norm-250k-whitespace-and-eos-regex-alpha-v3-dedup-lines-articles | ||
Muennighoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# defining the right environment variables | ||
export TRANSFORMERS_CACHE=$six_ALL_CCFRWORK/models | ||
export HF_DATASETS_CACHE=$six_ALL_CCFRWORK/datasets | ||
export HF_MODULES_CACHE=$six_ALL_CCFRWORK/modules | ||
export HF_METRICS_CACHE=$six_ALL_CCFRWORK/metrics | ||
export HF_DATASETS_OFFLINE=1 | ||
export TRANSFORMERS_OFFLINE=1 | ||
|
||
# testing for potential faulty nodes | ||
# srun --jobid $SLURM_JOBID bash -c 'python -c "import torch, socket; print(socket.gethostname(), torch.cuda.is_available())"' | ||
|
||
# so processes know who to talk to | ||
MASTER_ADDR=$(scontrol show hostnames $SLURM_JOB_NODELIST | head -n 1) | ||
MASTER_PORT=6001 | ||
|
||
GPUS_PER_NODE=8 | ||
NNODES=$SLURM_NNODES | ||
|
||
PP_SIZE=1 | ||
TP_SIZE=1 | ||
|
||
# T0 paper: | ||
# ...truncate input and target sequences to 1024 and 256 tokens... | ||
# ...use a batch size of 1024 sequences ... 2^20 total input tokens per batch... | ||
# We use 2048 total tokens and 512 batch size = 2**20 | ||
MICRO_BATCH_SIZE=1 | ||
GLOBAL_BATCH_SIZE=512 | ||
|
||
NLAYERS=30 | ||
NHIDDEN=4096 | ||
NHEADS=32 | ||
SEQ_LEN=2048 | ||
|
||
SAVE_INTERVAL=500 | ||
Muennighoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
TRAIN_SAMPLES=6_400_000 # 13e9 / 2048 | ||
Muennighoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# T0 paper: | ||
# "...we use a learning rate of 1e-3..." | ||
OPTIMIZER_ARGS=" \ | ||
--optimizer adam \ | ||
--adam-beta1 0.9 \ | ||
--adam-beta2 0.95 \ | ||
--adam-eps 1e-8 \ | ||
--lr 1e-3 \ | ||
--lr-decay-style constant \ | ||
--clip-grad 1.0 \ | ||
--weight-decay 1e-1 \ | ||
Muennighoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
" | ||
# for 20h 1190, for 100h 5990 | ||
# --exit-duration-in-mins 1190 \ | ||
EXIT_OPTS=" \ | ||
--exit-duration-in-mins 5990 \ | ||
" | ||
|
||
GPT_ARGS=" \ | ||
--pp-partition-method 'type:transformer|embedding' \ | ||
--num-layers $NLAYERS \ | ||
--hidden-size $NHIDDEN \ | ||
--num-attention-heads $NHEADS \ | ||
--seq-length $SEQ_LEN \ | ||
--max-position-embeddings $SEQ_LEN \ | ||
--micro-batch-size $MICRO_BATCH_SIZE \ | ||
--global-batch-size $GLOBAL_BATCH_SIZE \ | ||
--train-samples $TRAIN_SAMPLES \ | ||
--tokenizer-type PretrainedFromHF \ | ||
--tokenizer-name-or-path $TOKENIZER_NAME_OR_PATH \ | ||
--init-method-std 0.0048 \ | ||
--embed-layernorm \ | ||
--fp16 \ | ||
--seed 42 \ | ||
--position-embedding-type alibi \ | ||
--abort-on-unmet-fused-kernel-constraints \ | ||
--pad-vocab-size-to 250880 \ | ||
$OPTIMIZER_ARGS \ | ||
$EXIT_OPTS \ | ||
" | ||
|
||
OUTPUT_ARGS=" \ | ||
--log-interval 1 \ | ||
--save-interval $SAVE_INTERVAL \ | ||
--eval-interval 1000 \ | ||
--eval-iters 1 \ | ||
Muennighoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--tensorboard-dir $TENSORBOARD_PATH \ | ||
--tensorboard-queue-size 5 \ | ||
--log-timers-to-tensorboard \ | ||
--log-batch-size-to-tensorboard \ | ||
--log-validation-ppl-to-tensorboard \ | ||
" | ||
|
||
ZERO_STAGE=1 # important: bf16 must use z0! it implements its own zero stage 1 equivalent | ||
Muennighoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
config_json="./ds_config.$SLURM_JOBID.json" | ||
|
||
# Deepspeed figures out GAS dynamically from dynamic GBS via set_train_batch_size() | ||
cat <<EOT > $config_json | ||
{ | ||
"train_micro_batch_size_per_gpu": $MICRO_BATCH_SIZE, | ||
"train_batch_size": $GLOBAL_BATCH_SIZE, | ||
"gradient_clipping": 1.0, | ||
"zero_optimization": { | ||
"stage": $ZERO_STAGE | ||
}, | ||
"fp16": { | ||
"enabled": true, | ||
"loss_scale": 0, | ||
"loss_scale_window": 500, | ||
"hysteresis": 2, | ||
"min_loss_scale": 1, | ||
"initial_scale_power": 12 | ||
}, | ||
"steps_per_print": 2000, | ||
"wall_clock_breakdown": false | ||
} | ||
EOT | ||
|
||
|
||
DEEPSPEED_ARGS=" \ | ||
--deepspeed \ | ||
--deepspeed_config ${config_json} \ | ||
--zero-stage ${ZERO_STAGE} \ | ||
--deepspeed-activation-checkpointing \ | ||
" | ||
|
||
export LAUNCHER="python -u -m torch.distributed.run \ | ||
--nproc_per_node $GPUS_PER_NODE \ | ||
--nnodes $NNODES \ | ||
--rdzv_endpoint $MASTER_ADDR:$MASTER_PORT \ | ||
--rdzv_backend c10d \ | ||
--max_restarts 0 \ | ||
--tee 3 \ | ||
" | ||
|
||
DATA_PATH="/gpfswork/rech/six/commun/bigscience-training/p3t0/p3_t0_train" | ||
|
||
|
||
export CMD=" \ | ||
`pwd`/finetune_t0_non_causal_decoder.py \ | ||
--tensor-model-parallel-size $TP_SIZE \ | ||
--pipeline-model-parallel-size $PP_SIZE \ | ||
$GPT_ARGS \ | ||
$OUTPUT_ARGS \ | ||
--save $CHECKPOINT_PATH \ | ||
--load $CHECKPOINT_PATH \ | ||
--data-path $DATA_PATH \ | ||
--split 95,5,0 \ | ||
Muennighoff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--dataloader-type single \ | ||
--data-impl mmap \ | ||
--distributed-backend nccl \ | ||
$DEEPSPEED_ARGS \ | ||
" | ||
|
||
echo $CMD | ||
|
||
# do not remove or the training will hang and nodes will be lost w/o this workaround | ||
export CUDA_LAUNCH_BLOCKING=1 | ||
|
||
# hide duplicated errors using this hack - will be properly fixed in pt-1.12 | ||
export TORCHELASTIC_ERROR_FILE=/tmp/torch-elastic-error.json | ||
|
||
clear; srun --jobid $SLURM_JOBID bash -c "$LAUNCHER --node_rank \$SLURM_PROCID $CMD" 2>&1 | tee -a $LOGS_PATH/main_log.txt | ||
|
||
echo "END TIME: $(date)" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.