Open
Conversation
ydli-ai
reviewed
Jun 4, 2024
|
|
||
| if freqs_cis is not None: | ||
| query, key = apply_rotary_emb(query.transpose(1,2), key.transpose(1,2), freqs_cis=freqs_cis) | ||
| if use_dynamic_ntk: |
| self.self_attn = MultiHeadedAttention( | ||
| args.hidden_size, args.heads_num, attention_head_size, local_kv_heads_num, args.dropout, has_bias=has_bias, | ||
| with_scale=with_scale, lora_params=lora_params, layer_number=layer_number | ||
| args.hidden_size, args.heads_num, attention_head_size, local_kv_heads_num, args.dropout, self.max_seq_length, has_bias=has_bias, has_attention_bias = has_attention_bias, |
Collaborator
There was a problem hiding this comment.
之前has_bias包含了attention_bias,这里重命名后是否有考虑对之前的兼容性? 比如T5模型
Author
There was a problem hiding this comment.
之前has_bias包含了attention_bias,这里重命名后是否有考虑对之前的兼容性? 比如T5模型
当创建q,k,v的linear_layers时,如果没有传入attention_bias,则会使用has_bias的值,应该是对之前的模型兼容。
| self.has_residual_attention = args.has_residual_attention | ||
| self.use_logn_attn = args.use_logn_attn | ||
| self.max_seq_length = args.max_seq_length | ||
| self.use_dynamic_ntk = args.use_dynamic_ntk |
Collaborator
There was a problem hiding this comment.
训练不需要ntk,只有推理需要,如果只考虑训练的话这里是否有可能简化?
wmpscc
reviewed
Jun 21, 2024
Contributor
There was a problem hiding this comment.
建议同时提供 互相转换脚本
convert_qwen_from_tencentpretrain_to_huggingface.py
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
convert
python3 scripts/convert_qwen_from_huggingface_to_tencentpretrain.py --input_model_path $Qwen_1_8B_FOLDER --output_model_path models/qwen-1_8b.bin --layers_num 24
test
python3 scripts/generate_lm.py --load_model_path models/qwen-1_8b.bin
--tokenizer qwen --vocab_path $Qwen_1_8B_FOLDER
--test_path beginning.txt --prediction_path generated_sentence.txt
--config_path models/qwen/1_8b_config.json