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.
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
[XPU] llama add xpu support #8282
[XPU] llama add xpu support #8282
Changes from 1 commit
1293619
e388ed6
41421f4
e9a4b87
2a8c639
d9dcdbe
40c23a5
a3935fd
6e0316a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 418 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L416-L418
Check warning on line 422 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L420-L422
Check warning on line 594 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L592-L594
Check warning on line 603 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L599-L603
Check warning on line 610 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L609-L610
Check warning on line 613 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L613
Check warning on line 621 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L617-L621
Check warning on line 628 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L627-L628
Check warning on line 632 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L630-L632
Check warning on line 666 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L666
Check warning on line 678 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L676-L678
Check warning on line 687 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L680-L687
Check warning on line 768 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L766-L768
Check warning on line 777 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L773-L777
Check warning on line 784 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L783-L784
Check warning on line 787 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L787
Check warning on line 795 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L791-L795
Check warning on line 802 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L801-L802
Check warning on line 806 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L804-L806
Check warning on line 839 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L839
Check warning on line 844 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L844
Check warning on line 852 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L852
Check warning on line 1530 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L1527-L1530
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.
当传入的
x
和y
是整型scalar类型时,paddle.where
会将其视为int64、形状[1]的tensor,并会进行broadcast_add操作,详见search.pyThere 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.
这里和上面 npu 的逻辑看着差不多,可以复用吗?
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.
理论上是可以复用的,但是npu里面写死了dtype是
float16
,xpu跑的程序是可能是float16
,也可能是bfloat16
的。我们需要修改npu的模块么?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.
@SylarTiaNII 看一下?
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.
根据 @wuhuachaocoding 意见,还是分成if elif两个单独的分支
Check warning on line 1813 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L1812-L1813
Check warning on line 1819 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L1817-L1819
Check warning on line 1834 in paddlenlp/transformers/llama/modeling.py
Codecov / codecov/patch
paddlenlp/transformers/llama/modeling.py#L1834