-
Notifications
You must be signed in to change notification settings - Fork 30
[DICP][Ascend] Support llama2 7B with lightllm. #787
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
19ccd7a
support ascendgraph.
Reinerzhou 020afa4
add prompt_attention op.
Reinerzhou 0917803
add op pattern match and ext_ops.
Reinerzhou 5ee8611
clean code.
Reinerzhou 2459fce
format code for ci check.
Reinerzhou 8cfcdad
adjust code.
Reinerzhou f3f7d83
adjust code.
Reinerzhou c9d7822
update code
tangzhiyi11 503ac36
Merge branch 'zhousl/llm_dev' into tangzy/llm_dev
tangzhiyi11 8d77b41
Merge pull request #10 from DeepLink-org/tangzy/llm_dev
Reinerzhou dfd778d
remove unused record_function.
Reinerzhou 910a410
clean code.
Reinerzhou 4c660bf
revert select conversion.
Reinerzhou 78c9fa7
revert default format and remove joint_graph_passes.
Reinerzhou 9151cfe
uncomment a joint_graph_passes.
Reinerzhou ffc239c
cancel test_hf temporarily.
Reinerzhou 289734c
Fix test_hf case.
pdx1989 61f1740
clean code.
Reinerzhou bc35a28
remove gather temporarily.
Reinerzhou 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
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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| from collections import defaultdict | ||
| from typing import Callable, Dict, Sequence, Union | ||
|
|
||
| import torch | ||
| from torch._decomp import register_decomposition | ||
| from torch._ops import OpOverload, OpOverloadPacket | ||
|
|
||
| dicp_decomposition_table = {} | ||
| aten = torch.ops.aten | ||
|
|
||
|
|
||
| def register_decomposition_for_dicp(fn): | ||
| return register_decomposition(fn, registry=dicp_decomposition_table) | ||
|
|
||
|
|
||
| @register_decomposition_for_dicp(aten.count_nonzero.default) | ||
| def count_nonzero_default(x, dim=None): | ||
| cond = x != 0 | ||
| dim = [] if dim is None else dim | ||
| return aten.sum.dim_IntList(cond, dim=dim, keepdim=False, dtype=torch.int64) | ||
|
|
||
|
|
||
| def get_decompositions( | ||
| aten_ops: Sequence[Union[OpOverload, OpOverloadPacket]], | ||
| target_decomposition_table: Dict[OpOverload, Callable] = None, | ||
| ) -> Dict[OpOverload, Callable]: | ||
| registry = dicp_decomposition_table | ||
| packets_to_overloads = defaultdict(list) | ||
| for opo in registry: | ||
| packets_to_overloads[opo.overloadpacket].append(opo) | ||
| decompositions = target_decomposition_table if target_decomposition_table else {} | ||
| for op in aten_ops: | ||
| if isinstance(op, OpOverloadPacket) and op in packets_to_overloads: | ||
| for op_overload in packets_to_overloads[op]: | ||
| decompositions[op_overload] = registry[op_overload] | ||
| elif isinstance(op, OpOverload) and op in registry: | ||
| decompositions[op] = registry[op] | ||
| return decompositions | ||
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.
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.
Uh oh!
There was an error while loading. Please reload this page.