-
Notifications
You must be signed in to change notification settings - Fork 1
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
Gelu test gpu #6
Open
yangxiaoyu14
wants to merge
35
commits into
sneaxiy:main
Choose a base branch
from
yangxiaoyu14:gelu_test_gpu
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.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
e8bad95
gelu_test
yangxiaoyu14 6b1e410
gelu_test
yangxiaoyu14 f1b795a
Basically not modifying op_acc_stable_run.py
yangxiaoyu14 2f06c90
gelu
yangxiaoyu14 bbe032c
gelu
yangxiaoyu14 de10ac4
gelu
yangxiaoyu14 4af2ee6
gelu(GPU)
yangxiaoyu14 ce3310b
gelu(gpu)
yangxiaoyu14 d3267e0
gelu(gpu)
yangxiaoyu14 f7fe4c6
gelu(gpu)
yangxiaoyu14 b4d4489
gelu(gpu)
yangxiaoyu14 3c851b5
gelu
yangxiaoyu14 23b059a
gelu
yangxiaoyu14 8804838
gelu_test
yangxiaoyu14 7c986f7
gelu_test
yangxiaoyu14 e58999b
Basically not modifying op_acc_stable_run.py
yangxiaoyu14 9568c50
gelu
yangxiaoyu14 9254d9f
gelu
yangxiaoyu14 eaeb40f
gelu
yangxiaoyu14 ceaefde
gelu(GPU)
yangxiaoyu14 7172126
gelu(gpu)
yangxiaoyu14 957df1d
gelu(gpu)
yangxiaoyu14 d3eee45
gelu(gpu)
yangxiaoyu14 b9deb6a
gelu
yangxiaoyu14 c30a820
gelu
yangxiaoyu14 04d20dc
gelu
yangxiaoyu14 c96c4ab
gelu
yangxiaoyu14 09dc41b
gelu
yangxiaoyu14 ba8add4
gelu
yangxiaoyu14 ea472ae
gelu
yangxiaoyu14 39c0160
gelu
yangxiaoyu14 bf92ece
gelu_test_gpu
yangxiaoyu14 58dee1e
gelu_test
yangxiaoyu14 2666542
gelu
yangxiaoyu14 0f1f3b3
gelu
yangxiaoyu14 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 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 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,52 @@ | ||
# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from op_acc_stable_run import check_tensor_diff, op_acc_stable_run | ||
|
||
class GeluTest: | ||
def __init__(self, shape, dtype): | ||
self.shape = shape | ||
self.dtype = dtype | ||
|
||
def set_configs(self, paddle): | ||
self.tmp_cache_path = "." | ||
self.inputs = { | ||
"x": paddle.randn(self.shape, dtype=self.dtype), | ||
"y_grad": paddle.randn(self.shape, dtype=self.dtype), | ||
} | ||
|
||
def run_paddle(self, paddle): | ||
x = self.inputs["x"] | ||
y = paddle.nn.functional.gelu(x) | ||
y.backward(self.inputs["y_grad"]) | ||
return y, x.grad | ||
|
||
def run_torch(self, torch): | ||
x = self.inputs["x"] | ||
y = torch.nn.functional.gelu(x) | ||
y.backward(self.inputs["y_grad"]) | ||
return y, x.grad | ||
|
||
def check_diff(self, paddle, pd_ret, th_ret): | ||
assert len(pd_ret) == len(th_ret) | ||
for pd, th in zip(pd_ret, th_ret): | ||
check_tensor_diff(pd, th, atol=1e-6, rtol=1e-6) | ||
|
||
if __name__ == "__main__": | ||
op_acc_stable_run(GeluTest(shape=[1, 12288], dtype="float32")) | ||
op_acc_stable_run(GeluTest(shape=[1, 12288], dtype="float16")) | ||
op_acc_stable_run(GeluTest(shape=[1, 12288], dtype="bfloat16")) | ||
op_acc_stable_run(GeluTest(shape=[1, 4096, 24576], dtype="float32")) | ||
op_acc_stable_run(GeluTest(shape=[1, 4096, 24576], dtype="float16")) | ||
op_acc_stable_run(GeluTest(shape=[1, 4096, 24576], dtype="bfloat16")) | ||
This file contains 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 |
---|---|---|
|
@@ -45,4 +45,4 @@ def check_diff(self, paddle, pd_ret, th_ret): | |
|
||
|
||
if __name__ == "__main__": | ||
op_acc_stable_run(SoftmaxTest) | ||
op_acc_stable_run(SoftmaxTest) | ||
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. 修复最后一行的这个问题。 |
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.
修复最后一行的这个问题。
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.
这个最后的一行的问题指什么?我不太确定,指最后一行缺少空行吗?