-
Notifications
You must be signed in to change notification settings - Fork 57
Add a SP e2e test. #1209
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
base: main
Are you sure you want to change the base?
Add a SP e2e test. #1209
Conversation
Signed-off-by: Xiongfei Wei <isaacwxf23@gmail.com>
…allelism.py Signed-off-by: Xiongfei Wei <isaacwxf23@gmail.com>
Signed-off-by: Xiongfei Wei <isaacwxf23@gmail.com>
Signed-off-by: Xiongfei Wei <isaacwxf23@gmail.com>
DescriptionStart with a short description of what the PR does and how this is a change from The rest of the description includes relevant details and context, examples:
If the change fixes a bug or a Github issue, please include a link, e.g.,: TestsPlease describe how you tested this change, and include any instructions and/or ChecklistBefore submitting this PR, please make sure:
|
| token_num = x.shape[0] | ||
| # NOTE(chengjiyao): make sure the sharded token_num is larger than TPU_SECOND_LAST_MINOR | ||
| if token_num // self.mesh.shape["model"] >= TPU_SECOND_LAST_MINOR: | ||
| logger.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our e2e test, should we check the log to see sp is actually enabled? Another way is to check the final optimized graph, but that's more difficult.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked manually that this line(76) is executed. But I think you meant if we can check it in the test. I'm not sure how we can do that in the test. Let me know if you have some ideas.
Though, I added a long prompt (line24 ""Three Rings...") to ensure token_num//8 >= 8 is triggered. Also the precompilation phase use very large num_tokens so this case is triggered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we output the log in a file and checked the file's content later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be logger.debug instead of logger.info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No luck for now. Somehow I couldn't capture the logger. I agree that this may be the easiest way to test. But if someone write a similar logging string, then this test may not work as intended. Other parallelism seem to have the same issue: it's hard to examine how each layer is sharded in the test.
I've been thinking if there is better way to test. Since SP's main benefits is to reduce memory, we can check with SP if the mem usage is indeed reduced. But there is no jax api that let me check the mem usage.
How about let's merge this pr so that it verifies with "enable_sequence_parallelism=True" and "tensor_parallelism=8" the test runs to completion, since that is the intended way to enable SP. Then when we do integration, we improve the test. Wdyt?
Signed-off-by: Xiongfei Wei <isaacwxf23@gmail.com>
Signed-off-by: Xiongfei Wei <isaacwxf23@gmail.com>
Signed-off-by: Xiongfei Wei <isaacwxf23@gmail.com>
Signed-off-by: Xiongfei Wei <isaacwxf23@gmail.com>
Description
This PR adds a SP e2e test and adds it to the CI.
Tests
pytest -s -vv tests/e2e/test_sequence_parallelism.py
Checklist
Before submitting this PR, please make sure: