[QUESTION]Missing key(s) when load checkpoint
We use core_r0.8.0 to train the LLAMA2 7B model (Here the model layer number is set to 4, but the complete model will also encounter this problem), and use the same version of loader_megatron.py to load the checkpoints but the problem of Missing key(s) occurs.
The training script is as follows:
#!/bin/bash
# Runs the "7B" parameter model
export CUDA_DEVICE_MAX_CONNECTIONS=1
GPUS_PER_NODE=4
# Change for multinode config
MASTER_ADDR=localhost
MASTER_PORT=6000
NNODES=1
NODE_RANK=0
CHECKPOINT_PATH=/data2/yex_z/Megatron-LM-core_r0.8/check
TENSORBOARD_LOGS_PATH=/data2/yex_z/Megatron-LM-core_r0.8/check/tb
TOKENIZER_PATH=/data2/llama-dataset/tokenizer.model
DATA_PATH=/data2/llama-dataset/merged/RedPajama-Data-1T-Sample
# 7 B
HIDDEN_SIZE=4096
FFN_HIDDEN_SIZE=11008
NUM_LAYERS=4
NUM_HEADS=32
SEQ_LENGTH=4096
TRAIN_STEPS=10
LR=3e-4
MIN_LR=3e-5
LR_WARMUP_STEPS=1
WEIGHT_DECAY=0.1
GRAD_CLIP=1
TP=4
PP=1
MBS=1
GBS=256
DISTRIBUTED_ARGS=(
--nproc_per_node ${GPUS_PER_NODE}
--nnodes ${NNODES}
--node_rank ${NODE_RANK}
--master_addr ${MASTER_ADDR}
--master_port ${MASTER_PORT}
)
# transformer_engine
# local
TRAINING_ARGS=(
# --transformer-impl local
--use-legacy-models
--train-iters ${TRAIN_STEPS}
--tensor-model-parallel-size ${TP}
--pipeline-model-parallel-size ${PP}
--disable-bias-linear
--use-distributed-optimizer
--use-flash-attn
)
MIXED_PRETRAIN_ARGS=(
--use-tp-pp-dp-mapping
--micro-batch-size ${MBS}
--global-batch-size ${GBS}
)
MIXED_PRECISION_ARGS=(
--bf16
--initial-loss-scale 65536
--min-loss-scale 1.0
--loss-scale-window 1024
--attention-softmax-in-fp32
)
DATA_ARGS=(
--data-path ${DATA_PATH}
# --split 949,50,1
--split 1
--tokenizer-type Llama2Tokenizer
--tokenizer-model ${TOKENIZER_PATH}
)
NETWORK_ARGS=(
--num-layers ${NUM_LAYERS}
--hidden-size ${HIDDEN_SIZE}
--ffn-hidden-size $FFN_HIDDEN_SIZE
--num-attention-heads ${NUM_HEADS}
--seq-length ${SEQ_LENGTH}
--max-position-embeddings ${SEQ_LENGTH}
--use-rotary-position-embeddings
--no-position-embedding
--normalization RMSNorm
--swiglu
--make-vocab-size-divisible-by 64
--untie-embeddings-and-output-weights
)
INITIALIZATION_ARGS=(
--init-method-std 0.02
--seed 1234
)
REGULARIZATION_ARGS=(
--attention-dropout 0.0
--hidden-dropout 0.0
--weight-decay 0.1
--adam-beta1 0.9
--adam-beta2 0.95
--clip-grad 1.0
)
LEARNING_RATE_ARGS=(
--lr $LR
--lr-decay-style cosine
--lr-warmup-iters 2
--min-lr 1.5e-5
)
LOGGING_ARGS=(
--save-interval 5
--eval-interval 5
--log-interval 1
--timing-log-level 1
--save $CHECKPOINT_PATH
--load $CHECKPOINT_PATH
)
DATE=`date +%y%m%d%H%M%S`
LOG_DIR=./logs/nv_log_${DATE}
mkdir -p ${LOG_DIR}
cmd="
torchrun ${DISTRIBUTED_ARGS[@]} ../pretrain_gpt.py \
${TRAINING_ARGS[@]} \
${MIXED_PRETRAIN_ARGS[@]} \
${MIXED_PRECISION_ARGS[@]} \
${DATA_ARGS[@]} \
${NETWORK_ARGS[@]} \
${INITIALIZATION_ARGS[@]} \
${REGULARIZATION_ARGS[@]} \
${LEARNING_RATE_ARGS[@]} \
${LOGGING_ARGS[@]} | tee ${LOG_DIR}/node${NODE_RANK}.log
"
echo $cmd
eval $cmd
The dependencies are as follows
Package Version
------------------------- ----------------
absl-py 2.1.0
aiohttp 3.9.5
aiosignal 1.3.1
annotated-types 0.7.0
apex 0.1
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
asciitree 0.3.3
asttokens 2.4.1
astunparse 1.6.3
async-timeout 4.0.3
attrs 23.2.0
audioread 3.0.1
beautifulsoup4 4.12.3
bleach 6.1.0
blis 0.7.11
cachetools 5.3.3
catalogue 2.0.10
certifi 2024.7.4
cffi 1.16.0
chardet 4.0.0
charset-normalizer 3.3.2
click 8.1.7
cloudpathlib 0.18.1
cloudpickle 3.0.0
cmake 3.30.0
colorama 0.4.4
comm 0.2.2
confection 0.1.5
contourpy 1.2.1
cuda-python 12.5.0
cudf 24.4.0
cugraph 24.4.0
cugraph-dgl 24.4.0
cugraph-equivariant 24.4.0
cugraph-pyg 24.4.0
cugraph-service-client 24.4.0
cugraph-service-server 24.4.0
cuml 24.4.0
cupy-cuda12x 13.0.0
cycler 0.12.1
cymem 2.0.8
Cython 3.0.10
dask 2024.1.1
dask-cuda 24.4.0
dask-cudf 24.4.0
dask-expr 0.4.0
debugpy 1.8.2
decorator 5.1.1
defusedxml 0.7.1
devscripts 2.22.1ubuntu1
distributed 2024.1.1
dm-tree 0.1.8
einops 0.8.0
entrypoints 0.4
exceptiongroup 1.2.1
execnet 2.1.1
executing 2.0.1
expecttest 0.1.3
fasteners 0.19
fastjsonschema 2.20.0
fastrlock 0.8.2
filelock 3.15.4
flash-attn 2.4.2
fonttools 4.53.1
frozenlist 1.4.1
fsspec 2024.5.0
gast 0.6.0
google-auth 2.32.0
google-auth-oauthlib 0.4.6
gpg 1.16.0
grpcio 1.62.1
hf-xet 1.1.2
huggingface-hub 0.32.2
hypothesis 5.35.1
idna 3.7
igraph 0.11.6
importlib_metadata 7.1.0
iniconfig 2.0.0
intel-openmp 2021.4.0
ipykernel 6.29.5
ipython 8.21.0
ipython-genutils 0.2.0
jedi 0.19.1
Jinja2 3.1.4
joblib 1.4.2
json5 0.9.25
jsonschema 4.23.0
jsonschema-specifications 2023.12.1
jupyter_client 8.6.2
jupyter_core 5.7.2
jupyter-tensorboard 0.2.0
jupyterlab 2.3.2
jupyterlab_pygments 0.3.0
jupyterlab-server 1.2.0
jupytext 1.16.2
kiwisolver 1.4.5
kvikio 24.4.0
langcodes 3.4.0
language_data 1.2.0
lazy_loader 0.4
librosa 0.10.1
lightning-thunder 0.2.0.dev0
lightning-utilities 0.11.3.post0
lintrunner 0.12.5
llvmlite 0.42.0
locket 1.0.0
looseversion 1.3.0
marisa-trie 1.2.0
Markdown 3.6
markdown-it-py 3.0.0
MarkupSafe 2.1.5
matplotlib 3.9.1
matplotlib-inline 0.1.7
mdit-py-plugins 0.4.1
mdurl 0.1.2
mistune 3.0.2
mkl 2021.1.1
mkl-devel 2021.1.1
mkl-include 2021.1.1
mock 5.1.0
mpmath 1.3.0
msgpack 1.0.8
multidict 6.0.5
murmurhash 1.0.10
nbclient 0.10.0
nbconvert 7.16.4
nbformat 5.10.4
nest-asyncio 1.6.0
networkx 3.3
ninja 1.11.1.1
notebook 6.4.10
numba 0.59.1
numcodecs 0.11.0
numpy 1.24.4
nvfuser 0.2.6a0+f73ff1b
nvidia-cudnn-frontend 1.5.1
nvidia-dali-cuda120 1.39.0
nvidia-modelopt 0.13.0
nvidia-nvimgcodec-cu12 0.2.0.7
nvidia-pyindex 1.0.9
nvtx 0.2.5
nx-cugraph 24.4.0
oauthlib 3.2.2
onnx 1.16.0
opencv 4.7.0
opt-einsum 3.3.0
optree 0.12.1
packaging 24.0
pandas 2.2.1
pandocfilters 1.5.1
parso 0.8.4
partd 1.4.2
pexpect 4.9.0
pillow 10.4.0
pip 24.1.2
platformdirs 4.2.2
pluggy 1.5.0
ply 3.11
polygraphy 0.49.12
pooch 1.8.2
preshed 3.0.9
prometheus_client 0.20.0
prompt_toolkit 3.0.47
protobuf 4.24.4
psutil 5.9.8
ptyprocess 0.7.0
pure-eval 0.2.2
pyarrow 14.0.2
pyasn1 0.6.0
pyasn1_modules 0.4.0
pybind11 2.13.1
pybind11_global 2.13.1
pycocotools 2.0+nv0.8.0
pycparser 2.22
pydantic 2.8.2
pydantic_core 2.20.1
Pygments 2.18.0
pylibcugraph 24.4.0
pylibcugraphops 24.4.0
pylibraft 24.4.0
pylibwholegraph 24.4.0
pynvjitlink 0.2.3
pynvml 11.4.1
pyparsing 3.1.2
pytest 8.1.1
pytest-flakefinder 1.1.0
pytest-rerunfailures 14.0
pytest-shard 0.1.2
pytest-xdist 3.6.1
python-apt 2.4.0+ubuntu4
python-dateutil 2.9.0.post0
python-debian 0.1.43+ubuntu1.1
python-hostlist 1.23.0
python-magic 0.4.24
pytorch-triton 3.0.0+989adb9a2
pytz 2024.1
pyxdg 0.27
PyYAML 6.0.1
pyzmq 26.0.3
raft-dask 24.4.0
rapids-dask-dependency 24.4.0a0
referencing 0.35.1
regex 2024.5.15
requests 2.32.3
requests-oauthlib 2.0.0
rich 13.7.1
rmm 24.4.0
rpds-py 0.19.0
rsa 4.9
safetensors 0.5.3
scikit-learn 1.5.1
scipy 1.13.1
Send2Trash 1.8.3
sentencepiece 0.2.0
setuptools 68.2.2
shellingham 1.5.4
six 1.16.0
smart-open 7.0.4
sortedcontainers 2.4.0
soundfile 0.12.1
soupsieve 2.5
soxr 0.3.7
spacy 3.7.5
spacy-legacy 3.0.12
spacy-loggers 1.0.5
srsly 2.4.8
stack-data 0.6.3
sympy 1.13.0
tabulate 0.9.0
tbb 2021.13.0
tblib 3.0.0
tensorboard 2.9.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tensorrt 10.2.0
terminado 0.18.1
texttable 1.7.0
thinc 8.2.5
threadpoolctl 3.5.0
thriftpy2 0.5.0
tinycss2 1.3.0
tokenizers 0.21.1
tomli 2.0.1
toolz 0.12.1
torch 2.4.0a0+3bcc3cd
torch-tensorrt 2.5.0a0
torchvision 0.19.0a0
tornado 6.4
tqdm 4.66.4
traitlets 5.9.0
transformer_engine 2.2.0
transformer_engine_cu12 2.2.0
transformer-engine-torch 2.2.0
transformers 4.52.3
treelite 4.1.2
typer 0.12.3
types-dataclasses 0.6.6
typing_extensions 4.12.0
tzdata 2024.1
ubuntu-drivers-common 0.0.0
ucx-py 0.37.0
unidiff 0.5.5
urllib3 2.0.7
wasabi 1.1.3
wcwidth 0.2.13
weasel 0.4.1
webencodings 0.5.1
Werkzeug 3.0.3
wheel 0.43.0
wrapt 1.16.0
xdg 5
xdoctest 1.0.2
xgboost 2.0.3
xkit 0.0.0
yarl 1.9.4
zarr 2.18.2
zict 3.0.0
zipp 3.19.0
The specific error is as follows:
Setting num_layers to 4 from checkpoint
Setting hidden_size to 4096 from checkpoint
Setting ffn_hidden_size to 11008 from checkpoint
Setting seq_length to 4096 from checkpoint
Setting num_attention_heads to 32 from checkpoint
Setting num_query_groups to 32 from checkpoint
Setting group_query_attention to False from checkpoint
Setting kv_channels to 128 from checkpoint
Setting max_position_embeddings to 4096 from checkpoint
Setting position_embedding_type to rope from checkpoint
Setting add_position_embedding to False from checkpoint
Setting use_rotary_position_embeddings to True from checkpoint
Setting rotary_percent to 1.0 from checkpoint
Setting rotary_interleaved to False from checkpoint
Setting add_bias_linear to False from checkpoint
Setting add_qkv_bias to False from checkpoint
Setting swiglu to True from checkpoint
Setting untie_embeddings_and_output_weights to True from checkpoint
Setting apply_layernorm_1p to False from checkpoint
Setting normalization to RMSNorm from checkpoint
Setting tokenizer_type to Llama2Tokenizer from checkpoint
Setting padded_vocab_size to 32000 from checkpoint
Setting apply_query_key_layer_scaling to False from checkpoint
Setting tensor_model_parallel_size to 4 from checkpoint
Setting pipeline_model_parallel_size to 1 from checkpoint
Checkpoint did not provide arguments virtual_pipeline_model_parallel_size
Checkpoint did not provide arguments num_layers_per_virtual_pipeline_stage
using world size: 4, data-parallel size: 1, context-parallel size: 1 tensor-model-parallel size: 4, pipeline-model-parallel size: 1
setting global batch size to 1
WARNING: Setting args.overlap_p2p_comm to False since non-interleaved schedule does not support overlapping p2p communication
accumulate and all-reduce gradients in fp32 for bfloat16 data type.
using torch.bfloat16 for parameters ...
------------------------ arguments ------------------------
accumulate_allreduce_grads_in_fp32 .............. True
adam_beta1 ...................................... 0.9
adam_beta2 ...................................... 0.999
adam_eps ........................................ 1e-08
add_bias_linear ................................. False
add_position_embedding .......................... False
add_qkv_bias .................................... False
adlr_autoresume ................................. False
adlr_autoresume_interval ........................ 1000
app_tag_run_name ................................ None
app_tag_run_version ............................. 0.0.0
apply_layernorm_1p .............................. False
apply_query_key_layer_scaling ................... False
apply_residual_connection_post_layernorm ........ False
apply_rope_fusion ............................... True
async_save ...................................... None
async_tensor_model_parallel_allreduce ........... False
attention_dropout ............................... 0.1
attention_softmax_in_fp32 ....................... False
auto_detect_ckpt_format ......................... False
barrier_with_L1_time ............................ True
bert_binary_head ................................ True
bert_embedder_type .............................. megatron
bert_load ....................................... None
bf16 ............................................ True
bias_dropout_fusion ............................. False
bias_gelu_fusion ................................ False
bias_swiglu_fusion .............................. True
biencoder_projection_dim ........................ 0
biencoder_shared_query_context_model ............ False
block_data_path ................................. None
calculate_per_token_loss ........................ False
check_for_nan_in_loss_and_grad .................. True
check_weight_hash_across_dp_replicas_interval ... None
ckpt_assume_constant_structure .................. False
ckpt_fully_parallel_load ........................ False
ckpt_fully_parallel_save ........................ True
ckpt_fully_parallel_save_deprecated ............. False
ckpt_step ....................................... None
classes_fraction ................................ 1.0
clip_grad ....................................... 1.0
clone_scatter_output_in_embedding ............... True
consumed_train_samples .......................... 0
consumed_valid_samples .......................... 0
context_parallel_size ........................... 1
create_attention_mask_in_dataloader ............. True
cross_entropy_loss_fusion ....................... False
data_cache_path ................................. None
data_parallel_random_init ....................... False
data_parallel_size .............................. 1
data_path ....................................... None
data_per_class_fraction ......................... 1.0
data_sharding ................................... True
dataloader_type ................................. single
ddp_average_in_collective ....................... False
ddp_bucket_size ................................. None
decoder_num_layers .............................. None
decoder_seq_length .............................. None
decoupled_lr .................................... None
decoupled_min_lr ................................ None
defer_embedding_wgrad_compute ................... False
delay_grad_reduce ............................... True
delay_param_gather .............................. False
deprecated_use_mcore_models ..................... False
deterministic_mode .............................. False
dino_bottleneck_size ............................ 256
dino_freeze_last_layer .......................... 1
dino_head_hidden_size ........................... 2048
dino_local_crops_number ......................... 10
dino_local_img_size ............................. 96
dino_norm_last_layer ............................ False
dino_teacher_temp ............................... 0.07
dino_warmup_teacher_temp ........................ 0.04
dino_warmup_teacher_temp_epochs ................. 30
disable_straggler_on_startup .................... False
dist_ckpt_format ................................ torch_dist
dist_ckpt_strictness ............................ assume_ok_unexpected
distribute_saved_activations .................... False
distributed_backend ............................. nccl
distributed_timeout_minutes ..................... 10
embedding_path .................................. None
empty_unused_memory_level ....................... 0
enable_one_logger ............................... True
encoder_num_layers .............................. 4
encoder_seq_length .............................. 4096
end_weight_decay ................................ 0.01
eod_mask_loss ................................... False
eval_interval ................................... 1000
eval_iters ...................................... 100
evidence_data_path .............................. None
exit_duration_in_mins ........................... None
exit_interval ................................... None
exit_on_missing_checkpoint ...................... False
exit_signal_handler ............................. False
expert_model_parallel_size ...................... 1
ffn_hidden_size ................................. 11008
finetune ........................................ False
fp16 ............................................ False
fp16_lm_cross_entropy ........................... False
fp32_residual_connection ........................ False
fp8 ............................................. None
fp8_amax_compute_algo ........................... most_recent
fp8_amax_history_len ............................ 1
fp8_interval .................................... 1
fp8_margin ...................................... 0
fp8_wgrad ....................................... True
global_batch_size ............................... 1
gradient_accumulation_fusion .................... True
group_query_attention ........................... False
head_lr_mult .................................... 1.0
hidden_dropout .................................. 0.1
hidden_size ..................................... 4096
hybrid_attention_ratio .......................... 0.0
hybrid_mlp_ratio ................................ 0.0
hybrid_override_pattern ......................... None
hysteresis ...................................... 2
ict_head_size ................................... None
ict_load ........................................ None
img_h ........................................... 224
img_w ........................................... 224
indexer_batch_size .............................. 128
indexer_log_interval ............................ 1000
inference_batch_times_seqlen_threshold .......... 512
init_method_std ................................. 0.02
init_method_xavier_uniform ...................... False
initial_loss_scale .............................. 4294967296
iter_per_epoch .................................. 1250
iteration ....................................... 10
kv_channels ..................................... 128
lazy_mpu_init ................................... None
load ............................................ /data2/yex_z/Megatron-LM-core_r0.8/check
local_rank ...................................... None
log_batch_size_to_tensorboard ................... False
log_interval .................................... 100
log_learning_rate_to_tensorboard ................ True
log_loss_scale_to_tensorboard ................... True
log_memory_to_tensorboard ....................... False
log_num_zeros_in_grad ........................... False
log_params_norm ................................. False
log_progress .................................... False
log_straggler ................................... False
log_throughput .................................. False
log_timers_to_tensorboard ....................... False
log_validation_ppl_to_tensorboard ............... False
log_world_size_to_tensorboard ................... False
logging_level ................................... None
loss_scale ...................................... None
loss_scale_window ............................... 1000
lr .............................................. None
lr_decay_iters .................................. None
lr_decay_samples ................................ None
lr_decay_style .................................. linear
lr_warmup_fraction .............................. None
lr_warmup_init .................................. 0.0
lr_warmup_iters ................................. 0
lr_warmup_samples ............................... 0
lr_wsd_decay_iters .............................. None
lr_wsd_decay_samples ............................ None
lr_wsd_decay_style .............................. exponential
make_vocab_size_divisible_by .................... 128
manual_gc ....................................... False
manual_gc_eval .................................. True
manual_gc_interval .............................. 0
mask_factor ..................................... 1.0
mask_prob ....................................... 0.15
mask_type ....................................... random
masked_softmax_fusion ........................... False
max_position_embeddings ......................... 4096
max_tokens_to_oom ............................... 12000
merge_file ...................................... None
micro_batch_size ................................ 1
min_loss_scale .................................. 1.0
min_lr .......................................... 0.0
mmap_bin_files .................................. True
mock_data ....................................... True
moe_aux_loss_coeff .............................. 0.0
moe_expert_capacity_factor ...................... None
moe_extended_tp ................................. False
moe_grouped_gemm ................................ False
moe_input_jitter_eps ............................ None
moe_layer_recompute ............................. False
moe_pad_expert_input_to_capacity ................ False
moe_per_layer_logging ........................... False
moe_router_load_balancing_type .................. aux_loss
moe_router_pre_softmax .......................... False
moe_router_topk ................................. 2
moe_token_dispatcher_type ....................... allgather
moe_token_drop_policy ........................... probs
moe_z_loss_coeff ................................ None
nccl_communicator_config_path ................... None
no_load_optim ................................... True
no_load_rng ..................................... True
no_persist_layer_norm ........................... False
no_save_optim ................................... True
no_save_rng ..................................... True
norm_epsilon .................................... 1e-05
normalization ................................... RMSNorm
num_attention_heads ............................. 32
num_channels .................................... 3
num_classes ..................................... 1000
num_dataset_builder_threads ..................... 1
num_experts ..................................... None
num_layers ...................................... 4
num_layers_per_virtual_pipeline_stage ........... None
num_query_groups ................................ 32
num_workers ..................................... 2
one_logger_async ................................ False
one_logger_project .............................. megatron-lm
one_logger_run_name ............................. None
onnx_safe ....................................... None
openai_gelu ..................................... False
optimizer ....................................... adam
output_bert_embeddings .......................... False
overlap_grad_reduce ............................. False
overlap_p2p_comm ................................ False
overlap_param_gather ............................ False
override_opt_param_scheduler .................... False
padded_vocab_size ............................... 32000
params_dtype .................................... torch.bfloat16
patch_dim ....................................... 16
perform_initialization .......................... False
pipeline_model_parallel_size .................... 1
pipeline_model_parallel_split_rank .............. None
position_embedding_type ......................... rope
pretrained_checkpoint ........................... None
profile ......................................... False
profile_ranks ................................... [0]
profile_step_end ................................ 12
profile_step_start .............................. 10
qk_layernorm .................................... False
query_in_block_prob ............................. 0.1
rampup_batch_size ............................... None
rank ............................................ 0
recompute_granularity ........................... None
recompute_method ................................ None
recompute_num_layers ............................ None
reset_attention_mask ............................ False
reset_position_ids .............................. False
retriever_report_topk_accuracies ................ []
retriever_score_scaling ......................... False
retriever_seq_length ............................ 256
retro_add_retriever ............................. False
retro_attention_gate ............................ 1
retro_cyclic_train_iters ........................ None
retro_encoder_attention_dropout ................. 0.1
retro_encoder_hidden_dropout .................... 0.1
retro_encoder_layers ............................ 2
retro_num_neighbors ............................. 2
retro_num_retrieved_chunks ...................... 2
retro_project_dir ............................... None
retro_verify_neighbor_count ..................... True
rotary_base ..................................... 10000
rotary_interleaved .............................. False
rotary_percent .................................. 1.0
rotary_seq_len_interpolation_factor ............. None
s3_cache_path ................................... None
sample_rate ..................................... 1.0
save ............................................ None
save_interval ................................... None
scatter_gather_tensors_in_pipeline .............. True
seed ............................................ 1234
seq_length ...................................... 4096
sequence_parallel ............................... False
sgd_momentum .................................... 0.9
short_seq_prob .................................. 0.1
skip_train ...................................... False
spec ............................................ None
split ........................................... None
squared_relu .................................... False
standalone_embedding_stage ...................... False
start_weight_decay .............................. 0.01
straggler_ctrlr_port ............................ 65535
straggler_minmax_count .......................... 1
swiglu .......................................... True
swin_backbone_type .............................. tiny
tensor_model_parallel_size ...................... 4
tensorboard_dir ................................. None
tensorboard_log_interval ........................ 1
tensorboard_queue_size .......................... 1000
test_data_path .................................. None
test_mode ....................................... False
tiktoken_num_special_tokens ..................... 1000
tiktoken_pattern ................................ None
tiktoken_special_tokens ......................... None
timing_log_level ................................ 0
timing_log_option ............................... minmax
titles_data_path ................................ None
tokenizer_model ................................. None
tokenizer_type .................................. Llama2Tokenizer
tp_comm_bulk_dgrad .............................. True
tp_comm_bulk_wgrad .............................. True
tp_comm_overlap ................................. False
tp_comm_overlap_ag .............................. True
tp_comm_overlap_cfg ............................. None
tp_comm_overlap_rs .............................. True
tp_comm_overlap_rs_dgrad ........................ False
tp_comm_split_ag ................................ True
tp_comm_split_rs ................................ True
train_data_path ................................. None
train_iters ..................................... None
train_samples ................................... None
transformer_impl ................................ transformer_engine
transformer_pipeline_model_parallel_size ........ 1
untie_embeddings_and_output_weights ............. True
use_checkpoint_args ............................. False
use_checkpoint_opt_param_scheduler .............. False
use_cpu_initialization .......................... True
use_dist_ckpt ................................... False
use_distributed_optimizer ....................... False
use_flash_attn .................................. False
use_legacy_models ............................... False
use_one_sent_docs ............................... False
use_ring_exchange_p2p ........................... False
use_rotary_position_embeddings .................. True
use_tp_pp_dp_mapping ............................ False
valid_data_path ................................. None
variable_seq_lengths ............................ False
virtual_pipeline_model_parallel_size ............ None
vision_backbone_type ............................ vit
vision_pretraining .............................. False
vision_pretraining_type ......................... classify
vocab_extra_ids ................................. 0
vocab_file ...................................... None
vocab_size ...................................... None
wandb_exp_name ..................................
wandb_project ...................................
wandb_save_dir ..................................
weight_decay .................................... 0.01
weight_decay_incr_style ......................... constant
wgrad_deferral_limit ............................ 0
world_size ...................................... 4
yaml_cfg ........................................ None
-------------------- end of arguments ---------------------
INFO:megatron.core.num_microbatches_calculator:setting number of micro-batches to constant 1
building GPT model ...
loading checkpoint from /data2/yex_z/Megatron-LM-core_r0.8/check at iteration 10
Traceback (most recent call last):
File "/data2/yex_z/Megatron-LM-core_r0.8/tools/checkpoint/convert.py", line 154, in <module>
Loader exited, exiting saver
main()
File "/data2/yex_z/Megatron-LM-core_r0.8/tools/checkpoint/convert.py", line 147, in main
loader.load_checkpoint(queue, args)
File "/data2/yex_z/Megatron-LM-core_r0.8/tools/checkpoint/loader_megatron.py", line 368, in load_checkpoint
_load_checkpoint(queue, args)
File "/data2/yex_z/Megatron-LM-core_r0.8/tools/checkpoint/loader_megatron.py", line 230, in _load_checkpoint
all_models = [get_models(tp_size, md.params_dtype)]
File "/data2/yex_z/Megatron-LM-core_r0.8/tools/checkpoint/loader_megatron.py", line 158, in get_models
load_checkpoint(model_, None, None)
File "/data2/yex_z/Megatron-LM-core_r0.8/megatron/training/checkpointing.py", line 839, in load_checkpoint
model[0].load_state_dict(state_dict['model'], strict=strict)
File "/data2/yex_z/Megatron-LM-core_r0.8/megatron/legacy/model/gpt_model.py", line 122, in load_state_dict
self.language_model.load_state_dict(state_dict, strict=strict)
File "/data2/yex_z/Megatron-LM-core_r0.8/megatron/legacy/model/language_model.py", line 608, in load_state_dict
self.encoder.load_state_dict(state_dict_, strict=strict)
File "/data2/yex_z/Megatron-LM-core_r0.8/megatron/legacy/model/transformer.py", line 1818, in load_state_dict
super().load_state_dict(state_dict_, strict)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 2215, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ParallelTransformer:
Missing key(s) in state_dict: "layers.0.input_norm.weight", "layers.0.self_attention.query_key_value.weight", "layers.0.self_attention.dense.weight", "layers.0.post_attention_norm.weight", "layers.0.mlp.dense_h_to_4h.weight", "layers.0.mlp.dense_4h_to_h.weight", "layers.1.input_norm.weight", "layers.1.self_attention.query_key_value.weight", "layers.1.self_attention.dense.weight", "layers.1.post_attention_norm.weight", "layers.1.mlp.dense_h_to_4h.weight", "layers.1.mlp.dense_4h_to_h.weight", "layers.2.input_norm.weight", "layers.2.self_attention.query_key_value.weight", "layers.2.self_attention.dense.weight", "layers.2.post_attention_norm.weight", "layers.2.mlp.dense_h_to_4h.weight", "layers.2.mlp.dense_4h_to_h.weight", "layers.3.input_norm.weight", "layers.3.self_attention.query_key_value.weight", "layers.3.self_attention.dense.weight", "layers.3.post_attention_norm.weight", "layers.3.mlp.dense_h_to_4h.weight", "layers.3.mlp.dense_4h_to_h.weight".
Unexpected key(s) in state_dict: "layers.0.layernorm_mlp.layer_norm_weight", "layers.0.layernorm_mlp.fc1_weight", "layers.0.layernorm_mlp.fc2_weight", "layers.0.layernorm_mlp._extra_state", "layers.0.self_attention.layernorm_qkv.layer_norm_weight", "layers.0.self_attention.layernorm_qkv.weight", "layers.0.self_attention.layernorm_qkv._extra_state", "layers.0.self_attention.proj.weight", "layers.0.self_attention.proj._extra_state", "layers.0.self_attention.core_attention._extra_state", "layers.1.layernorm_mlp.layer_norm_weight", "layers.1.layernorm_mlp.fc1_weight", "layers.1.layernorm_mlp.fc2_weight", "layers.1.layernorm_mlp._extra_state", "layers.1.self_attention.layernorm_qkv.layer_norm_weight", "layers.1.self_attention.layernorm_qkv.weight", "layers.1.self_attention.layernorm_qkv._extra_state", "layers.1.self_attention.proj.weight", "layers.1.self_attention.proj._extra_state", "layers.1.self_attention.core_attention._extra_state", "layers.2.layernorm_mlp.layer_norm_weight", "layers.2.layernorm_mlp.fc1_weight", "layers.2.layernorm_mlp.fc2_weight", "layers.2.layernorm_mlp._extra_state", "layers.2.self_attention.layernorm_qkv.layer_norm_weight", "layers.2.self_attention.layernorm_qkv.weight", "layers.2.self_attention.layernorm_qkv._extra_state", "layers.2.self_attention.proj.weight", "layers.2.self_attention.proj._extra_state", "layers.2.self_attention.core_attention._extra_state", "layers.3.layernorm_mlp.layer_norm_weight", "layers.3.layernorm_mlp.fc1_weight", "layers.3.layernorm_mlp.fc2_weight", "layers.3.layernorm_mlp._extra_state", "layers.3.self_attention.layernorm_qkv.layer_norm_weight", "layers.3.self_attention.layernorm_qkv.weight", "layers.3.self_attention.layernorm_qkv._extra_state", "layers.3.self_attention.proj.weight", "layers.3.self_attention.proj._extra_state", "layers.3.self_attention.core_attention._extra_state".
seems like there is something wrong with your checkpoint, where do you get this checkpoint? If you download checkpoint from huggingface, you should convert it to megatron format first: https://github.com/NVIDIA/Megatron-LM?tab=readme-ov-file#checkpoint-format-conversion
@xing-ye The checkpoint loading error you're seeing is due to mismatched parameter names. Megatron Bridge provides a cleaner solution for working with Llama2/3.1 models. It includes training recipes and Hugging Face ↔ Megatron checkpoint conversion. Please feel free to create a new issue in Megatron Bridge if you are still facing issues.