Skip to content
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

Scalar::As() support being called in device #8348

Merged
merged 6 commits into from
Jun 2, 2022

Conversation

EsdeathYZH
Copy link
Contributor

No description provided.

@liujuncheng liujuncheng requested a review from hjchen2 June 1, 2022 11:20
@hjchen2
Copy link
Contributor

hjchen2 commented Jun 1, 2022

要不直接把Maybe的接口去掉,default的时候assert

@liujuncheng
Copy link
Collaborator

要不直接把Maybe的接口去掉,default的时候assert

我觉得可以,这个类的构造方法就保证了初始化吧,所以应该不需要调用者检查错误

@EsdeathYZH
Copy link
Contributor Author

要不直接把Maybe的接口去掉,default的时候assert

这样的话要改动的地方蛮多的,functional里面用Scalar.As很多

@liujuncheng
Copy link
Collaborator

要不直接把Maybe的接口去掉,default的时候assert

这样的话要改动的地方蛮多的,functional里面用Scalar.As很多

如果去人这个 Maybe 是没必要,多改几个地方也没关系,因为这个改动应该不会导致额外的错误, 或者修改 As 接口直接返回 Maybe::Ok(Value()),这样总是返回ok,可以减少其他地方的改动,保持兼容,后面新的调用鼓励用Value

@EsdeathYZH
Copy link
Contributor Author

要不直接把Maybe的接口去掉,default的时候assert

这样的话要改动的地方蛮多的,functional里面用Scalar.As很多

如果去人这个 Maybe 是没必要,多改几个地方也没关系,因为这个改动应该不会导致额外的错误, 或者修改 As 接口直接返回 Maybe::Ok(Value()),这样总是返回ok,可以减少其他地方的改动,保持兼容,后面新的调用鼓励用Value

那就还是都改掉吧,我先把涉及到的地方都改掉你们再确认下maybe是不是可以直接移除的

@EsdeathYZH EsdeathYZH requested a review from oneflow-ci-bot June 1, 2022 14:11
@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2022

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/8348/

@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2022

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.

@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot June 1, 2022 15:51
@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2022

Speed stats:
GPU Name: NVIDIA GeForce GTX 1080 

❌ OneFlow resnet50 time: 130.1ms (= 13008.6ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 144.1ms (= 14414.6ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.11 (= 144.1ms / 130.1ms)

OneFlow resnet50 time: 76.4ms (= 7642.9ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 87.1ms (= 8709.7ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.14 (= 87.1ms / 76.4ms)

OneFlow resnet50 time: 54.0ms (= 10807.3ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 54.6ms (= 10928.6ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.01 (= 54.6ms / 54.0ms)

OneFlow resnet50 time: 42.5ms (= 8495.9ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 40.0ms (= 8009.1ms / 200, input_shape=[2, 3, 224, 224])
❌ Relative speed: 0.94 (= 40.0ms / 42.5ms)

OneFlow resnet50 time: 37.8ms (= 7566.6ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 37.2ms (= 7441.8ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 0.98 (= 37.2ms / 37.8ms)

OneFlow swin dataloader time: 0.245s (= 48.957s / 200, num_workers=1)
PyTorch swin dataloader time: 0.149s (= 29.827s / 200, num_workers=1)
Relative speed: 0.609 (= 0.149s / 0.245s)

OneFlow swin dataloader time: 0.104s (= 20.861s / 200, num_workers=4)
PyTorch swin dataloader time: 0.041s (= 8.183s / 200, num_workers=4)
Relative speed: 0.392 (= 0.041s / 0.104s)

OneFlow swin dataloader time: 0.035s (= 7.095s / 200, num_workers=8)
PyTorch swin dataloader time: 0.022s (= 4.411s / 200, num_workers=8)
Relative speed: 0.622 (= 0.022s / 0.035s)

❌ OneFlow resnet50 time: 146.7ms (= 14667.5ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 175.0ms (= 17498.9ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.19 (= 175.0ms / 146.7ms)

OneFlow resnet50 time: 97.2ms (= 9717.0ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 113.3ms (= 11330.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.17 (= 113.3ms / 97.2ms)

OneFlow resnet50 time: 73.1ms (= 14622.9ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 87.5ms (= 17507.6ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.20 (= 87.5ms / 73.1ms)

OneFlow resnet50 time: 61.4ms (= 12281.9ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 75.3ms (= 15054.6ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.23 (= 75.3ms / 61.4ms)

OneFlow resnet50 time: 55.3ms (= 11061.6ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 73.8ms (= 14754.7ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.33 (= 73.8ms / 55.3ms)

@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot June 1, 2022 16:59
@EsdeathYZH EsdeathYZH enabled auto-merge (squash) June 1, 2022 17:04
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot June 1, 2022 17:13
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot June 1, 2022 20:03
@EsdeathYZH EsdeathYZH requested review from oneflow-ci-bot and removed request for oneflow-ci-bot June 2, 2022 00:58
@jackalcooper jackalcooper disabled auto-merge June 2, 2022 01:05
@jackalcooper jackalcooper merged commit 41405de into master Jun 2, 2022
@jackalcooper jackalcooper deleted the scalar_as_call_from_device branch June 2, 2022 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants