Oneflow-Inc / one-fx

A toolkit for developers to simplify the transformation of nn.Module instances. It's now corresponding to Pytorch.fx.
Other
13 stars 1 forks source link

Feature Extract测试遇到的问题 #5

Open AsakusaRinne opened 1 year ago

AsakusaRinne commented 1 year ago

进行与pytorch feature extract test对应的测试的时候有一些模型挂掉了,列举如下,其中标记了**的是暂时不需要做任何处理的。

原因 文件名称 备注
因为模型中使用了built-in function ['shufflenet_v2_x0_5', 'shufflenet_v2_x1_0', 'shufflenet_v2_x1_5', 'shufflenet_v2_x2_0'] 主要是因为当前fx的wrap需要写在模型所在的模块里,所以这个问题有两种解决方案,一种是这边发布之后在flowvision里面引用并添加wrap的代码;另一种是在fx这里直接看看能不能做到外部wrap。
模型中包含了控制流,且控制流中变量是被trace的 ['swin_tiny_patch4_window7_224', 'swin_small_patch4_window7_224', 'swin_base_patch4_window7_224', 'swin_base_patch4_window12_384', 'swin_base_patch4_window7_224_in22k_to_1k', 'swin_base_patch4_window12_384_in22k_to_1k', 'swin_large_patch4_window7_224_in22k_to_1k', 'swin_large_patch4_window12_384_in22k_to_1k', 'crossformer_tiny_patch4_group7_224', 'crossformer_small_patch4_group7_224', 'crossformer_base_patch4_group7_224', 'crossformer_large_patch4_group7_224', 'pvt_tiny', 'pvt_small', 'pvt_medium', 'pvt_large', 'cswin_tiny_224', 'cswin_small_224', 'cswin_base_224', 'cswin_large_224', 'cswin_base_384', 'cswin_large_384', 'resmlp_12_224', 'resmlp_12_distilled_224', 'resmlp_12_224_dino', 'resmlp_24_224', 'resmlp_24_distilled_224', 'resmlp_24_224_dino', 'resmlp_36_224', 'resmlp_36_distilled_224', 'resmlp_big_24_224', 'resmlp_big_24_224_in22k_to_1k', 'resmlp_big_24_distilled_224', 'regionvit_tiny_224', 'regionvit_small_224', 'regionvit_small_w14_224', 'regionvit_small_w14_peg_224', 'regionvit_medium_224', 'regionvit_base_224', 'regionvit_base_w14_224', 'regionvit_base_w14_peg_224', 'mlp_mixer_s16_224', 'mlp_mixer_s32_224', 'mlp_mixer_b16_224', 'mlp_mixer_b32_224', 'mlp_mixer_l16_224', 'mlp_mixer_l32_224', 'mlp_mixer_b16_224_miil', 'gmlp_ti16_224', 'gmlp_s16_224', 'gmlp_b16_224', 'vit_tiny_patch16_224', 'vit_tiny_patch16_384', 'vit_small_patch32_224', 'vit_small_patch32_384', 'vit_small_patch16_224', 'vit_small_patch16_384', 'vit_base_patch32_224', 'vit_base_patch32_384', 'vit_base_patch16_224', 'vit_base_patch16_384', 'vit_base_patch8_224', 'vit_large_patch32_224', 'vit_large_patch32_384', 'vit_large_patch16_224', 'vit_large_patch16_384', 'vit_base_patch16_224_sam', 'vit_base_patch32_224_sam', 'vit_huge_patch14_224', 'vit_giant_patch14_224', 'vit_gigantic_patch14_224', 'deit_tiny_patch16_224', 'deit_small_patch16_224', 'deit_base_patch16_224', 'deit_base_patch16_384', 'deit_tiny_distilled_patch16_224', 'deit_small_distilled_patch16_224', 'deit_base_distilled_patch16_224', 'deit_base_distilled_patch16_384', 'vit_base_patch16_224_miil', 'uniformer_small', 'uniformer_base', 'uniformer_base_ls', 'mobilevit_small', 'mobilevit_x_small', 'mobilevit_xx_small', 'deit_small_patch16_LS_224', 'deit_small_patch16_LS_384', 'deit_small_patch16_LS_224_in21k', 'deit_small_patch16_LS_384_in21k', 'deit_base_patch16_LS_224', 'deit_base_patch16_LS_384', 'deit_base_patch16_LS_224_in21k', 'deit_base_patch16_LS_384_in21k', 'deit_large_patch16_LS_224', 'deit_large_patch16_LS_384', 'deit_large_patch16_LS_224_in21k', 'deit_large_patch16_LS_384_in21k', 'deit_huge_patch14_LS_224', 'deit_huge_patch14_LS_224_in21k', 'cait_XS24_384', 'cait_S24_224', 'cait_S24_384', 'cait_S36_384', 'cait_M36_384', 'cait_M48_448', 'fan_tiny_12_p16_224', 'fan_small_12_p16_224', 'fan_base_18_p16_224', 'fan_large_24_p16_224', 'fan_tiny_8_p4_hybrid', 'fan_small_12_p4_hybrid', 'fan_base_16_p4_hybrid', 'fan_large_16_p4_hybrid', 'fan_base_16_p4_hybrid_in22k_1k', 'fan_base_16_p4_hybrid_in22k_1k_384', 'fan_large_16_p4_hybrid_in22k_1k', 'fan_large_16_p4_hybrid_in22k_1k_384', 'poolformer_s12', 'poolformer_s24', 'poolformer_s36', 'poolformer_m36', 'poolformer_m48'] 这个目前能想到的只有修改一下模型代码,fx不支持动态控制流。
模型不接收num_classes参数** ['rexnetv1_1_0', 'rexnetv1_1_3', 'rexnetv1_1_5', 'rexnetv1_2_0', 'rexnetv1_3_0', 'rexnet_lite_1_0', 'rexnet_lite_1_3', 'rexnet_lite_1_5', 'rexnet_lite_2_0'] 这个只是自动测试的问题,默认输入了一个num_classes=1,实际使用的时候可以去掉。
Tensor没有zeros_这个API** ['resnest50', 'resnest101', 'resnest200', 'resnest269'] 这是因为 https://github.com/Oneflow-Inc/oneflow/pull/7593 这个PR把zeros_改成了zero_,flowvision现在的发布版还没对齐,master分支已经修改过了
proxy变量进行了循环迭代导致报错 ['levit_128s', 'levit_128', 'levit_192', 'levit_256', 'levit_384'] 暂时没想到解决方案
device函数参数名称错误** ['efficientnet_b0', 'efficientnet_b1', 'efficientnet_b2', 'efficientnet_b3', 'efficientnet_b4', 'efficientnet_b5', 'efficientnet_b6', 'efficientnet_b7'] 应该是flowvision没对应上最新的API
AsakusaRinne commented 1 year ago

更新:目前,len等builtins函数可以通过global_wrap的方式添加,不需要修改flowvision的代码,但int等本身是类,并且还能当作强制转换函数的类型是不能被global_wrap的,目前只能在模型源代码中解决。