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

Support customized mesh rules to support different HWs #696

Merged
merged 13 commits into from
Sep 13, 2024

Conversation

kelvin-zou
Copy link
Contributor

Add a few system only mesh config modifiers, including

  1. Gradient Accumulation (not affecting global batch size)
  2. Remat policies
  3. Mesh shape
  4. Chain config modifier (can concatenate all config modifiers)

Also added v5e fuji-7B numbers for the record.

@kelvin-zou kelvin-zou marked this pull request as ready for review September 11, 2024 18:45
axlearn/common/trainer.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
@kelvin-zou kelvin-zou requested a review from markblee September 12, 2024 15:58
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
axlearn/common/utils.py Outdated Show resolved Hide resolved
axlearn/common/utils.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
axlearn/common/trainer_config_modifier.py Outdated Show resolved Hide resolved
@@ -102,6 +105,26 @@ def sharding(self) -> jax.sharding.Sharding:
NestedTensorSpec = Optional[Union[TensorSpec, dict[str, Any]]]


def offload_dots_saveble(offload_src, offload_dst):
"""Extract and combine the policy from save_and_offload_only_these_names and dots_saveable.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this accurate? Seems that dots_saveable includes lax_convolution.conv_general_dilated_p. Also clarify how it combines save_and_offload_only_these_names ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated comments, the reference is actually a bit different from dots_saveable.

@kelvin-zou kelvin-zou requested a review from markblee September 12, 2024 22:03
@@ -0,0 +1,180 @@
# Copyright © 2023 Apple Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Copyright © 2023 Apple Inc.
# Copyright © 2024 Apple Inc.

(here and elsewhere)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks for the review, I need one more approval after the nit change.

@kelvin-zou kelvin-zou requested a review from markblee September 13, 2024 17:27
@kelvin-zou kelvin-zou added this pull request to the merge queue Sep 13, 2024
Merged via the queue into apple:main with commit f2326c5 Sep 13, 2024
4 checks passed
@kelvin-zou kelvin-zou deleted the support_mesh_config branch September 13, 2024 18:35
qdavid1 pushed a commit to qdavid1/axlearn that referenced this pull request Dec 11, 2024
* cherrypick from internal PR change

* snapshot

* nit comment fixes

* address Mark's comments

* snapshot

* fix the wrong name

* snapshot

* nit type format

* snasphot

* snasphot

* remove white space

* nit format fix

* fix some minor annotation
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