Skip to content

Commit

Permalink
[Bugfix] fix qwen tokenizer config when converting to nemo format (#1…
Browse files Browse the repository at this point in the history
…1098)

* updated qwen tokenizer config when converting to nemo format

* Apply isort and black reformatting

Signed-off-by: chrjxj <chrjxj@users.noreply.github.com>

---------

Signed-off-by: chrjxj <chrjxj@users.noreply.github.com>
Co-authored-by: lukex <lukex@nvidia.com>
  • Loading branch information
chrjxj and lukex authored Jan 9, 2025
1 parent 3146703 commit 7aac482
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/checkpoint_converters/convert_qwen2_hf_to_nemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ def load_config(args, qwen_config):
nemo_config.num_query_groups = qwen_config['num_key_value_heads']
nemo_config.use_cpu_initialization = True
nemo_config.activation = 'fast-swiglu'
nemo_config.tokenizer.type = str(args.input_name_or_path)
nemo_config.tokenizer.model = str(args.input_name_or_path) + '/vocab.json'

# use HF tokenizer
tokenizer_dict = {
'library': 'huggingface',
'type': args.input_name_or_path,
'use_fast': True,
'trust_remote_code': True,
}
nemo_config.tokenizer = tokenizer_dict

nemo_config.override_vocab_size = qwen_config['vocab_size']

base = 128
Expand Down

0 comments on commit 7aac482

Please sign in to comment.