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

Add speed test script #117

Merged
merged 11 commits into from Jan 23, 2022
Merged

Add speed test script #117

merged 11 commits into from Jan 23, 2022

Conversation

Ldpe2G
Copy link
Collaborator

@Ldpe2G Ldpe2G commented Jan 21, 2022

脚本运行方式:

cd ci/check
bash run_speed_test.sh

结果会输出到 当前目录下的 result 文件里

目前通过测速脚本发现的问题

import torch as flow 运行会崩

  • vit
  • conv_mixer
  • crossformer
  • cswin
  • mlp_mixer
  • pvt
  • res_mlp
  • vgg

本身运行也会报错,输入是 224x224 的时候

  • efficientnet
  • res2net

@kaijieshi7
Copy link
Contributor

之前有个想法,既然有返回所有models的方法,那么能不能直接对返回的模型进行测试,这样就不需要每个模型都需要单独的脚本。存在的问题是,每个模型除了名字不一样之外,还存在input数据增强不一样,输出也不一样(googlenet输出三个)。

@Ldpe2G
Copy link
Collaborator Author

Ldpe2G commented Jan 21, 2022

之前有个想法,既然有返回所有models的方法,那么能不能直接对返回的模型进行测试,这样就不需要每个模型都需要单独的脚本。存在的问题是,每个模型除了名字不一样之外,还存在input数据增强不一样,输出也不一样(googlenet输出三个)。

因为需要和torch的对比速度,所以不是仅仅从 model_creater 拿到模型就行了,那只能测oneflow的模型速度,要测torch的速度得把模型文件开头的 import oneflow 改成 import torch,需要修改一下脚本代码,然后保存下来再重新加载测试torch的速度

@kaijieshi7
Copy link
Contributor

kaijieshi7 commented Jan 21, 2022

以下的没问题值能跑通。

  1. vit问题:flow.permute().view()可以用,torch.permute()需接contiguous()才能使用view()。应该是view是否可以操作不连续tensor的问题。
  2. conv-mixer:convmixer_768_32_reluconvmixer_1536_20convmixer_1024_20这三个换成torch的没问题。
  3. crossformer:flowvision.layers.regularization.DropPathflowvision.layers.weight_init都换成torch之后crossformer四个模型都没问题。
  4. cswin:同上,6个模型都没有问题。
  5. mlp-mixer:flowvision.layers.blocks.PatchEmbed改成torch没问题。(输出全是0)
  6. pvt:pvt-huge-v2没有定义,其他四个没问题。
  7. res-mlp:10个都没有问题
  8. vgg:8个都没问题。
  9. efficientnet的问题:efficientnet #120
  10. res2net的问题:res2net代码写错 #121

@Ldpe2G
Copy link
Collaborator Author

Ldpe2G commented Jan 21, 2022

以下的没问题值能跑通。

  1. vit问题:flow.permute().view()可以用,torch.permute()需接contiguous()才能使用view()。应该是view是否可以操作不连续tensor的问题。
  2. conv-mixer:convmixer_768_32_reluconvmixer_1536_20convmixer_1024_20这三个换成torch的没问题。
  3. crossformer:flowvision.layers.regularization.DropPathflowvision.layers.weight_init都换成torch之后crossformer四个模型都没问题。
  4. cswin:同上,6个模型都没有问题。
  5. mlp-mixer:flowvision.layers.blocks.PatchEmbed改成torch没问题。(输出全是0)

好的,我再看看

@Ldpe2G Ldpe2G requested review from oneflow-ci-bot and removed request for oneflow-ci-bot January 22, 2022 15:48
@Ldpe2G Ldpe2G requested review from oneflow-ci-bot and removed request for oneflow-ci-bot January 23, 2022 04:52
@Ldpe2G Ldpe2G merged commit c64267c into main Jan 23, 2022
@Ldpe2G Ldpe2G deleted the dev_add_speed_test_scripts branch January 23, 2022 04:55
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.

None yet

3 participants