-
Notifications
You must be signed in to change notification settings - Fork 825
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
eager global sucessfully in 1card and 2card #7635
Conversation
|
||
@autotest(n=1, check_graph=False) | ||
def _test_tuple_dim_norm_with_random_data(test_case, placement, sbp): | ||
input = random_tensor(ndim=2,dim0=8,dim1=8) |
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.
这里缩进应该是四个空格,调一下
from collections import OrderedDict | ||
|
||
import numpy as np | ||
from oneflow.test_utils.test_util import GenArgList |
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.
这些都没用,删除
from collections import OrderedDict | ||
|
||
from random import shuffle | ||
import numpy as np | ||
from oneflow.test_utils.test_util import GenArgList |
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.
删除
m = flow.nn.PixelShuffle(h_upscale_factor=h_upscale_factor, w_upscale_factor=w_upscale_factor) | ||
m = m.to(device) | ||
of_out = m(input) | ||
np_out = _np_pixel_shuffle(x, h_upscale_factor, w_upscale_factor) |
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和input不一样,数值上就会有所不同
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.
值为什么不一样
首先,x在每个rank上的值是不一样的,其次,input = flow.tensor(x).to_global(...)
之后,如果是s(0)时,形状就会改变
m = m.to(device) | ||
of_out = m(input) | ||
np_out = _np_pixel_shuffle(x, h_upscale_factor, w_upscale_factor) | ||
if flow.env.get_rank() == 0: |
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.
感觉所有rank都检查结果稳妥些
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.
这个就是别的rank不检查结果吧
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.
这个就是别的rank不检查结果吧
为啥?
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.
好的,所以rank都检查吧
import unittest | ||
from collections import OrderedDict | ||
|
||
import numpy as np | ||
from oneflow.test_utils.test_util import GenArgList |
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.
import unittest | ||
from collections import OrderedDict | ||
|
||
from random import shuffle | ||
import numpy as np | ||
from oneflow.test_utils.test_util import GenArgList |
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.
同上,这些import应该能删除一部分,你自己跑下看看哪些能删
import unittest | ||
from collections import OrderedDict | ||
|
||
from random import shuffle | ||
import numpy as np | ||
from oneflow.test_utils.test_util import GenArgList |
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.
同上
y = flow.ones_like(x) | ||
test_case.assertTrue(y.dtype is flow.float32) | ||
test_case.assertTrue(y.shape == x.shape) | ||
test_case.assertTrue(y.to_local().device == x.to_local().device) |
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.
这个地方也不太对,placement的类型type和device不一定一样,这里应该是过不了的
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.
我跑没问题
y = flow.ones_like(x) | ||
test_case.assertTrue(y.dtype is flow.int) | ||
test_case.assertTrue(y.shape == x.shape) | ||
test_case.assertTrue(y.to_local().device == x.to_local().device) |
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.
同上
m = flow.nn.PixelShuffle(h_upscale_factor=h_upscale_factor, w_upscale_factor=w_upscale_factor) | ||
m = m.to(device) | ||
of_out = m(input) | ||
np_out = _np_pixel_shuffle(x, h_upscale_factor, w_upscale_factor) |
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在每个rank上的值是不一样的,其次,input = flow.tensor(x).to_global(...)
之后,如果是s(0)时,形状就会改变
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
|
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.
加空行,或则121行有空格,需要删除
b9aa893
to
047aa98
Compare
test_case.assertTrue(y.dtype is flow.float32) | ||
test_case.assertTrue(y.shape == x.shape) | ||
test_case.assertTrue(y.placement == placement) | ||
y_numpy = np.ones_like(x.numpy()) |
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.
这里的y_numpy是不是应该通过y_numpy = np.ones(x.numpy(shape))
获取更合适一点
test_case.assertTrue(y.dtype is flow.int) | ||
test_case.assertTrue(y.shape == x.shape) | ||
test_case.assertTrue(y.placement == placement) | ||
y_numpy = np.ones_like(x.numpy()) |
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.
同上
Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally. |
CI failed when running job: cuda-module-distributed-rank-0. PR label automerge has been removed |
Speed stats:
|
CI failed when running job: cuda-speed-test. PR label automerge has been removed |
Speed stats:
|
CI failed when running job: cpu-module. PR label automerge has been removed |
Speed stats:
|
Speed stats:
|
Speed stats:
|
* eager global sucessfully in 1card and 2card * remove some import * revise pixel_shuffle, ones_like * delete randperm * using ones * auto format by CI * test to _test * eager global sucessfully in 1card and 2card (#7635) eager global sucessfully in 1card and 2card (#7635) eager global sucessfully in 1card and 2card (#7635) eager global sucessfully in 1card and 2card (#7635) eager global sucessfully in 1card and 2card * remove some import * revise pixel_shuffle, ones_like * delete randperm * using ones * Merge branch 'master' into lch_eager_succeed * auto format by CI * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * test to _test * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * rm test pixel shuffle Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> Co-authored-by: mergify-bot <noreply@mergify.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* eager global sucessfully in 1card and 2card * remove some import * revise pixel_shuffle, ones_like * delete randperm * using ones * auto format by CI * test to _test * eager global sucessfully in 1card and 2card (#7635) eager global sucessfully in 1card and 2card (#7635) eager global sucessfully in 1card and 2card (#7635) eager global sucessfully in 1card and 2card (#7635) eager global sucessfully in 1card and 2card * remove some import * revise pixel_shuffle, ones_like * delete randperm * using ones * Merge branch 'master' into lch_eager_succeed * auto format by CI * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * test to _test * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * Merge branch 'master' into lch_eager_succeed * rm test pixel shuffle Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com> Co-authored-by: mergify-bot <noreply@mergify.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
No description provided.