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

refine error msg: add NOLINT for defensive code in autograd #8525

Merged
merged 4 commits into from
Jul 1, 2022

Conversation

pingzhuu
Copy link
Contributor

@pingzhuu pingzhuu commented Jun 29, 2022

  • 完善 autograd 中防御代码的错误信息提示,添加 // NOLINT(maybe-need-error-msg)
  • 涉及的文件比较多,所以将只涉及几种简单情况的单独这个 PR 中,便于 review
  • 这个 PR 中包含的文件只处理以下几种类型,均位于 Init, Capture, Apply 函数开头检查参数数量是否正确
    • CHECK_NOTNULL_OR_RETURN(fw_op_expr);
    • CHECK_EQ_OR_RETURN(inputs.size(), xxx);
    • CHECK_EQ_OR_RETURN(outputs.size(), xxx);
    • CHECK_EQ_OR_RETURN(out_grads.size(), xxx);

@pingzhuu pingzhuu changed the title refine error msg for defensive code in autograd refine error msg: add NOLINT for defensive code in autograd Jun 29, 2022
@pingzhuu pingzhuu requested a review from oneflow-ci-bot July 1, 2022 05:43
@hjchen2
Copy link
Contributor

hjchen2 commented Jul 1, 2022

注意一下,需要将这些被改动过的文件中所有报错信息缺失的地方都改过来,才能通过need-check-error-message的检查

@pingzhuu
Copy link
Contributor Author

pingzhuu commented Jul 1, 2022

注意一下,需要将这些被改动过的文件中所有报错信息缺失的地方都改过来,才能通过need-check-error-message的检查

嗯,这个确认过,改动过的文件有 CHECK 的都改过了

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2022

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2022

Speed stats:
GPU Name: NVIDIA GeForce GTX 1080 

❌ OneFlow resnet50 time: 129.1ms (= 12906.2ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 144.6ms (= 14458.7ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.12 (= 144.6ms / 129.1ms)

OneFlow resnet50 time: 77.1ms (= 7710.3ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 86.0ms (= 8604.5ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.12 (= 86.0ms / 77.1ms)

OneFlow resnet50 time: 49.7ms (= 9936.8ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 58.8ms (= 11750.2ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.18 (= 58.8ms / 49.7ms)

OneFlow resnet50 time: 41.0ms (= 8202.7ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 43.5ms (= 8695.9ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.06 (= 43.5ms / 41.0ms)

OneFlow resnet50 time: 36.4ms (= 7289.1ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 39.6ms (= 7916.4ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.09 (= 39.6ms / 36.4ms)

OneFlow swin dataloader time: 0.270s (= 54.057s / 200, num_workers=1)
PyTorch swin dataloader time: 0.152s (= 30.409s / 200, num_workers=1)
Relative speed: 0.563 (= 0.152s / 0.270s)

OneFlow swin dataloader time: 0.081s (= 16.234s / 200, num_workers=4)
PyTorch swin dataloader time: 0.041s (= 8.243s / 200, num_workers=4)
Relative speed: 0.508 (= 0.041s / 0.081s)

OneFlow swin dataloader time: 0.045s (= 8.909s / 200, num_workers=8)
PyTorch swin dataloader time: 0.022s (= 4.421s / 200, num_workers=8)
Relative speed: 0.496 (= 0.022s / 0.045s)

❌ OneFlow resnet50 time: 145.0ms (= 14503.1ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 171.3ms (= 17132.4ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.18 (= 171.3ms / 145.0ms)

OneFlow resnet50 time: 93.3ms (= 9333.9ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 113.2ms (= 11324.7ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.21 (= 113.2ms / 93.3ms)

OneFlow resnet50 time: 70.3ms (= 14065.0ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 91.3ms (= 18264.2ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.30 (= 91.3ms / 70.3ms)

OneFlow resnet50 time: 57.6ms (= 11521.0ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 76.2ms (= 15244.3ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.32 (= 76.2ms / 57.6ms)

OneFlow resnet50 time: 52.7ms (= 10543.7ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 69.2ms (= 13834.2ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.31 (= 69.2ms / 52.7ms)

@mergify mergify bot merged commit 85c0394 into master Jul 1, 2022
@mergify mergify bot deleted the refine_error_msg_for_defensive_code branch July 1, 2022 09:11
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.

4 participants