Open
Conversation
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.
当打开sequence packing做sft时,若一个pack中的子序列长度恰好为上下文窗口长度等边界情况时,原代码会在训练中遇到该问题时报错:
[rank1]: tokens, labels, loss_mask, attention_mask, position_ids, num_seqs, packed_seq_params = get_batch(data_iterator)
[rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^
[rank1]: File "/volume/data/lzh/Pai-Megatron-Patch-main/megatron_patch/template/helper.py", line 103, in get_batch
[rank1]: max_seqlen = torch.max(seqlens.max(), position_ids.max() + 1)
[rank1]: ^^^^^^^^^^^^^
[rank1]: RuntimeError: max(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument.
修改后的代码解决了边界问题且为更健壮的实现。