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

fix(910B): fix bugs in 910B for varlen and fixlen FA #309

Merged
merged 1 commit into from
Aug 30, 2024
Merged

Conversation

li126com
Copy link
Collaborator

@li126com li126com commented Aug 28, 2024

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

issue 307

Modification

  1. rotary_embedding为确保正确性采用gpu torch的版本。
  2. 修改了unpack data情况下seq_len的计算逻辑。
  3. 判定并修正了910B上all_reduce的op操作,由AVG转为SUM。

BC-breaking (Optional)

Does the modification introduce changes that break the backward compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here and update the documentation.

Checklist

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues.
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests.
  • The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, like docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects.
  • CLA has been signed and all committers have signed the CLA in this PR.

@li126com li126com changed the title fix(910B FA): fix bugs in 910B for var len and fix len FA fix(910B): fix bugs in 910B for var len and fix len FA Aug 28, 2024
@li126com li126com changed the title fix(910B): fix bugs in 910B for var len and fix len FA fix(910B): fix bugs in 910B for varlen and fixlen FA Aug 28, 2024
@sunpengsdu
Copy link
Contributor

sunpengsdu commented Aug 28, 2024

补充PR的description

@@ -309,13 +309,14 @@ def _forward_step(
output_obj = loss_reduced

moe_loss = (
sum(moe_losses) * gpc.config.loss.moe_loss_coeff
sum(moe_losses) * gpc.config.loss.moe_loss_coeff # pylint: disable=E0606
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why disable=E0606

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个有点怪就是在910B上执行pre-commit检查他会在这行出这个问题,只好disable了

# reformat cos/sin shape.
cos = torch.cat((cos, cos), dim=-1)[None, :, None, :]
sin = torch.cat((sin, sin), dim=-1)[None, :, None, :]

if len(x.shape) == 5:
q, k, _ = x.unbind(dim=2)

q, k = q.squeeze(dim=2), k.squeeze(dim=2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这不是在https://github.com/InternLM/InternEvo/pull/296/files 去掉了吗,为啥这里又改回来

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有,这个是我们当时说的他不是有个漏加的地方么,就是296的PR去掉了attention那块的squeeze,当时不是说embedding这应该加一个squeeze再

@li126com
Copy link
Collaborator Author

add description

done

@sunpengsdu sunpengsdu merged commit beb391a into develop Aug 30, 2024
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants