Skip to content

Commit

Permalink
Qwen2.5: fix convert lit/hf checkpoint scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ysjprojects committed Nov 24, 2024
1 parent f68808d commit d58eb95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions litgpt/scripts/convert_hf_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,14 @@ def convert_hf_checkpoint(
# holder to reconstitute the split q, k, v
qkv_weights = {}
copy_fn = partial(copy_weights_phi, config, qkv_weights)
elif config.mlp_class_name in ("LLaMAMLP", "GemmaMLP", "LLaMAMoE"):
# holder to reconstitute the split q, k, v
qkv_weights = {}
copy_fn = partial(copy_weights_hf_llama, config, qkv_weights)
elif model_name.lower().startswith("qwen2.5"):
# holder to reconstitute the split q, k, v
qkv_weights = {}
copy_fn = partial(copy_weights_qwen_2_5, config, qkv_weights)
elif config.mlp_class_name in ("LLaMAMLP", "GemmaMLP", "LLaMAMoE"):
# holder to reconstitute the split q, k, v
qkv_weights = {}
copy_fn = partial(copy_weights_hf_llama, config, qkv_weights)
else:
copy_fn = copy_weights_gpt_neox

Expand Down
4 changes: 2 additions & 2 deletions litgpt/scripts/convert_lit_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ def convert_lit_checkpoint(checkpoint_dir: Path, output_dir: Path) -> None:
copy_fn = partial(copy_weights_gemma_2, config)
elif config.name.lower().startswith("phi"):
copy_fn = partial(copy_weights_phi, config)
elif config.name.lower().startswith("qwen2.5"):
copy_fn = partial(copy_weights_qwen_2_5, config)
elif config.mlp_class_name in ("LLaMAMLP", "GemmaMLP", "LLaMAMoE"):
untie_weights = "Gemma" in config.name
copy_fn = partial(copy_weights_llama, config, untie_weights=untie_weights)
elif config.name.lower().startswith("qwen2.5"):
copy_fn = partial(copy_weights_qwen_2_5, config)
else:
copy_fn = copy_weights_gpt_neox

Expand Down

0 comments on commit d58eb95

Please sign in to comment.