wang zhenyang

Results 3 comments of wang zhenyang

#### 1、from oneflow.cuda import amp报错:oneflow.cuda里没有amp模块 torch.cuda.amp自动混合精度训练 —— 节省显存并加快推理速度 解决方法:直接将torch里的amp模块复制到本地import #### 2、在套用torch_distributed_zero_first函数时,会报错:oneflow.distributed没有barrier torch_distributed_zero_first函数是用来处理模型进行分布式训练时的同步问题 解决方法:直接注释掉与torch_distributed_zero_first有关代码,不采用分布式训练同步 #### 3、oneflow.load加载pt模型参数时,报错:load() got an unexpected keyword argument 'map_location' 没有map_location这个参数 目前解决方法是去掉map_loaction,但是再运行会显示模型加载地址找不到的问题

对convit分类网络进行测试,不进行预训练,convit_tiny、convit_small、convit_base皆可正常运行。 当进行预训练时,由于网络是在imagenet数据集上进行的预训练,所以最后的分类输出种类是1000。采用的测试集案例为10分类,所以要修改最后一个Linear层的输出通道数为10。一般的分类网络vgg、alexnet等最后一层为classifier层。所以常规的使用预训练的代码为: ``` import oneflow as flow from flowvision.models import ModelCreator net = ModelCreator.create_model("alexnet", pretrained=True) num_fc = net.classifier[6].in_features net.classifier[6] = flow.nn.Linear(in_features=num_fc, out_features=10) ``` 在测试过程中,convit分类网络没有使用classifier层,取而代之的是head层,所以在使用时需要注意在加载预训练模型时需对以上常规代码进行修改,修改后可正常运行。 修改为: ``` net = ModelCreator.create_model("convit_tiny",pretrained =...

1、当oneflow版本为0.8.1.dev20220802+cu112时,会报错: ``` Traceback (most recent call last): File "/home/deeplearning/wangzheny/vision-beit/train.py", line 16, in net = ModelCreator.create_model("beit_base_patch16_224", num_classes=10) File "/home/deeplearning/wangzheny/vision-beit/flowvision/models/registry.py", line 53, in create_model model = create_fn(pretrained=pretrained, **kwargs) File "/home/deeplearning/wangzheny/vision-beit/flowvision/models/beit.py", line 411,...