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

Support UniFormer #147

Merged
merged 16 commits into from Feb 24, 2022
Merged

Support UniFormer #147

merged 16 commits into from Feb 24, 2022

Conversation

thinksoso
Copy link
Contributor

@thinksoso thinksoso commented Feb 14, 2022

Support Uniformer

  • build uniformer model
  • convert pretrained weight
  • inference test on imagenet and update model_zoo small_plus
  • update docs
  • update changelog
  • pytorch speed comparison

@thinksoso thinksoso marked this pull request as draft February 14, 2022 09:55
@rentainhe rentainhe changed the title Add_Uniformer Support UniFormer Feb 14, 2022
@rentainhe rentainhe added this to In progress in Flowvision V0.2.0 Progress Feb 16, 2022
@thinksoso thinksoso marked this pull request as ready for review February 16, 2022 09:54
flowvision/models/uniformer.py Outdated Show resolved Hide resolved
flowvision/models/uniformer.py Outdated Show resolved Hide resolved
flowvision/models/uniformer.py Outdated Show resolved Hide resolved
flowvision/models/uniformer.py Outdated Show resolved Hide resolved
flowvision/models/uniformer.py Outdated Show resolved Hide resolved
@thinksoso
Copy link
Contributor Author

eval 结果跟论文对不上的问题已经向官方提了 issue Sense-X/UniFormer#16

@thinksoso
Copy link
Contributor Author

thinksoso commented Feb 23, 2022

测速结果

OneFlow uniformer_base time: 198.4ms (= 19835.6ms / 100, input_shape=[16, 3, 224, 224])
PyTorch uniformer_base time: 205.1ms (= 20506.7ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.03 (= 205.1ms / 198.4ms)

PyTorch uniformer_base_ls time: 211.3ms (= 21126.4ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.06 (= 211.3ms / 198.9ms)

OneFlow uniformer_small time: 83.6ms (= 8361.4ms / 100, input_shape=[16, 3, 224, 224])
PyTorch uniformer_small time: 102.1ms (= 10210.4ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.22 (= 102.1ms / 83.6ms)

OneFlow uniformer_small_plus time: 99.2ms (= 9921.4ms / 100, input_shape=[16, 3, 224, 224])
PyTorch uniformer_small_plus time: 108.9ms (= 10885.4ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.10 (= 108.9ms / 99.2ms)

OneFlow uniformer_base time: 257.9ms (= 25788.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch uniformer_base time: 265.4ms (= 26543.0ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.03 (= 265.4ms / 257.9ms)

✔️ Relative speed: 0.99 (= 273.9ms / 275.5ms)

OneFlow uniformer_small time: 121.7ms (= 12169.2ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch uniformer_small time: 123.5ms (= 12352.7ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.02 (= 123.5ms / 121.7ms)

OneFlow uniformer_small_plus time: 139.7ms (= 13967.8ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch uniformer_small_plus time: 137.3ms (= 13732.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
❌ Relative speed: 0.98 (= 137.3ms / 139.7ms)

ci/check/run_speed_test.sh Outdated Show resolved Hide resolved
flowvision/models/uniformer.py Outdated Show resolved Hide resolved
flowvision/models/uniformer.py Outdated Show resolved Hide resolved
results/results_imagenet.md Outdated Show resolved Hide resolved
flowvision/models/uniformer.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@rentainhe
Copy link
Contributor

@kaijieshi7 开杰这边double review一下,我没有问题了~

@Andy1621
Copy link

抱歉,issue已回复,精度没对上是模型代码有个参数写错了,现在的model我都测了一遍没有问题的

@rentainhe rentainhe merged commit 8465a6d into main Feb 24, 2022
@rentainhe rentainhe deleted the add_uniformer branch February 24, 2022 07:08
@Andy1621
Copy link

Andy1621 commented Mar 2, 2022

测速结果

OneFlow uniformer_base time: 198.4ms (= 19835.6ms / 100, input_shape=[16, 3, 224, 224]) PyTorch uniformer_base time: 205.1ms (= 20506.7ms / 100, input_shape=[16, 3, 224, 224]) ✔️ Relative speed: 1.03 (= 205.1ms / 198.4ms)

PyTorch uniformer_base_ls time: 211.3ms (= 21126.4ms / 100, input_shape=[16, 3, 224, 224]) ✔️ Relative speed: 1.06 (= 211.3ms / 198.9ms)

OneFlow uniformer_small time: 83.6ms (= 8361.4ms / 100, input_shape=[16, 3, 224, 224]) PyTorch uniformer_small time: 102.1ms (= 10210.4ms / 100, input_shape=[16, 3, 224, 224]) ✔️ Relative speed: 1.22 (= 102.1ms / 83.6ms)

OneFlow uniformer_small_plus time: 99.2ms (= 9921.4ms / 100, input_shape=[16, 3, 224, 224]) PyTorch uniformer_small_plus time: 108.9ms (= 10885.4ms / 100, input_shape=[16, 3, 224, 224]) ✔️ Relative speed: 1.10 (= 108.9ms / 99.2ms)

OneFlow uniformer_base time: 257.9ms (= 25788.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2) PyTorch uniformer_base time: 265.4ms (= 26543.0ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2) ✔️ Relative speed: 1.03 (= 265.4ms / 257.9ms)

✔️ Relative speed: 0.99 (= 273.9ms / 275.5ms)

OneFlow uniformer_small time: 121.7ms (= 12169.2ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2) PyTorch uniformer_small time: 123.5ms (= 12352.7ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2) ✔️ Relative speed: 1.02 (= 123.5ms / 121.7ms)

OneFlow uniformer_small_plus time: 139.7ms (= 13967.8ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2) PyTorch uniformer_small_plus time: 137.3ms (= 13732.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2) ❌ Relative speed: 0.98 (= 137.3ms / 139.7ms)

您好,不同模型的测速结果,oneflow官方有提供吗,对专门的测速比较挺感兴趣

@kaijieshi7
Copy link
Contributor

kaijieshi7 commented Mar 2, 2022

https://github.com/Oneflow-Inc/vision/blob/main/ci/check/compare_speed_with_pytorch.py
在这里,最简单的是直接测试,这里的代码是转换引用d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants