Skip to content
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

Pass in rotary_base to mcore and from HF #7933

Merged
merged 5 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ pipeline {
steps {
sh 'git clone https://github.com/NVIDIA/Megatron-LM.git && \
cd Megatron-LM && \
git checkout e122536b7645edcb7ebf099b5c92a443f7dbf8e7 && \
pip install -e .'
git checkout 973330e9c3681604703bf1eb6b5a265d1b9b9b38 && \
pip install .'
}
}

Expand Down
3 changes: 3 additions & 0 deletions examples/nlp/language_modeling/tuning/megatron_gpt_sft.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ def _modify_config(gpt_cfg, cfg, add_cfg_to_tree=False):
if cfg.model.get('seq_len_interpolation_factor', None) is not None:
gpt_cfg.seq_len_interpolation_factor = cfg.model.seq_len_interpolation_factor

if cfg.model.get('rotary_base', None) is not None:
gpt_cfg.rotary_base = cfg.model.rotary_base

sft_cls = MegatronGPTSFTModel
gpt_cfg.target = f"{sft_cls.__module__}.{sft_cls.__name__}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ def model_provider_func(self, pre_process, post_process):
position_embedding_type=self.cfg.get('position_embedding_type', 'learned_absolute'),
rotary_percent=self.cfg.get('rotary_percentage', 1.0),
seq_len_interpolation_factor=self.cfg.get('seq_len_interpolation_factor', None),
rotary_base=self.cfg.get('rotary_base', 10000),
)
else:
assert self.cfg.get('num_query_groups', None) is None or self.cfg.get(
Expand Down
2 changes: 2 additions & 0 deletions scripts/nlp_language_modeling/convert_hf_llama_to_nemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def load_config(args, llama_config):
nemo_config['seq_len_interpolation_factor'] = llama_config['rope_scaling']['factor']
else:
raise ValueError("Only linear rope scaling type is supported now")
if llama_config['rope_theta'] is not None:
nemo_config['rotary_base'] = llama_config['rope_theta']

base = 128
while llama_config['vocab_size'] % base != 0:
Expand Down
Loading