-
Notifications
You must be signed in to change notification settings - Fork 42
adapt triton moe #385
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
Draft
HaonanWang98
wants to merge
6
commits into
main
Choose a base branch
from
remove_ck
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
adapt triton moe #385
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
82daef5
enable triton moe
HaonanWang98 c4e03ef
Merge branch 'main' into remove_ck
HaonanWang98 d2dd20e
fix accuracy
HaonanWang98 d165717
Merge remote-tracking branch 'origin/main' into remove_ck
HaonanWang98 8930976
450 moe
HaonanWang98 e1fec6b
450 kernel
HaonanWang98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -271,7 +271,8 @@ def have_shared_expert(name): | |
| detect_fused_expert_fn = getattr(model, "detect_fused_expert_format", None) | ||
| get_fused_expert_mapping_fn = getattr(model, "get_fused_expert_mapping", None) | ||
|
|
||
| with concurrent.futures.ThreadPoolExecutor() as executor: | ||
| if True: | ||
| executor = None | ||
| futures = [] | ||
| disable_mmap = envs.ATOM_DISABLE_MMAP | ||
|
Comment on lines
276
to
277
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| for name, weight_tensor in safetensors_weights_iterator( | ||
|
|
@@ -346,11 +347,7 @@ def have_shared_expert(name): | |
| except AttributeError: | ||
| continue | ||
| weight_loader = getattr(param, "weight_loader") | ||
| futures.append( | ||
| executor.submit( | ||
| weight_loader, param, weight_tensor, shard_idx | ||
| ) | ||
| ) | ||
| weight_loader(param, weight_tensor, shard_idx) | ||
| loaded_weights_record.add(prefix + param_name) | ||
| else: | ||
| # Checkpoint has separate weights, load into fused param | ||
|
|
@@ -364,11 +361,7 @@ def have_shared_expert(name): | |
| break | ||
| weight_loader = getattr(param, "weight_loader") | ||
| # weight_loader(param, weight_tensor, shard_id) | ||
| futures.append( | ||
| executor.submit( | ||
| weight_loader, param, weight_tensor, shard_id | ||
| ) | ||
| ) | ||
| weight_loader(param, weight_tensor, shard_id) | ||
| loaded_weights_record.add(prefix + param_name) | ||
| break | ||
| else: | ||
|
|
@@ -438,16 +431,7 @@ def have_shared_expert(name): | |
| matched = True | ||
| break | ||
| weight_loader = getattr(param, "weight_loader") | ||
| futures.append( | ||
| executor.submit( | ||
| weight_loader, | ||
| param, | ||
| weight_tensor, | ||
| name, | ||
| shard_id, | ||
| expert_id, | ||
| ) | ||
| ) | ||
| weight_loader(param, weight_tensor, name, shard_id, expert_id) | ||
| loaded_weights_record.add(prefix + name) | ||
| matched = True | ||
| break | ||
|
|
@@ -461,9 +445,7 @@ def have_shared_expert(name): | |
| weight_loader = getattr( | ||
| param, "weight_loader", default_weight_loader | ||
| ) | ||
| futures.append( | ||
| executor.submit(weight_loader, param, weight_tensor) | ||
| ) | ||
| weight_loader(param, weight_tensor) | ||
| loaded_weights_record.add(prefix + name) | ||
| else: | ||
| # Model doesn't have expert mapping, use generic loading | ||
|
|
@@ -474,12 +456,9 @@ def have_shared_expert(name): | |
| weight_loader = getattr( | ||
| param, "weight_loader", default_weight_loader | ||
| ) | ||
| # weight_loader(param, weight_tensor) | ||
| futures.append(executor.submit(weight_loader, param, weight_tensor)) | ||
| weight_loader(param, weight_tensor) | ||
| loaded_weights_record.add(prefix + name) | ||
| # Wait for all tasks to complete and raise any exceptions. | ||
| for future in concurrent.futures.as_completed(futures): | ||
| future.result() | ||
| pass # Weight loading done synchronously above | ||
|
|
||
| for _, module in model.named_modules(): | ||
| if hasattr(module, "process_weights_after_loading"): | ||
|
|
||
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Local variable
executoris assigned to but never used