Open hongliang520 opened 1 year ago
你好,请问加载预训练模型spiking_resnet18,只能选择neuron.IFNode吗,可不可以使用neuron.ParametricLIFNode? resnet = spiking_resnet.spiking_wide_resnet50_2(pretrained=True, spiking_neuron=neuron.ParametricLIFNode, surrogate_function=surrogate.ATan(), detach_reset=True)
更改spiking_neuron=neuron.ParametricLIFNode会报错: RuntimeError: Error(s) in loading state_dict for SpikingResNet: Missing key(s) in state_dict: "sn1.w", "layer1.0.sn1.w", "layer1.0.sn2.w", "layer1.1.sn1.w", "layer1.1.sn2.w", "layer1.2.sn1.w", "layer1.2.sn2.w", "layer2.0.sn1.w", "layer2.0.sn2.w", "layer2.1.sn1.w", "layer2.1.sn2.w", "layer2.2.sn1.w", "layer2.2.sn2.w", "layer2.3.sn1.w", "layer2.3.sn2.w", "layer3.0.sn1.w", "layer3.0.sn2.w", "layer3.1.sn1.w", "layer3.1.sn2.w", "layer3.2.sn1.w", "layer3.2.sn2.w", "layer3.3.sn1.w", "layer3.3.sn2.w", "layer3.4.sn1.w", "layer3.4.sn2.w", "layer3.5.sn1.w", "layer3.5.sn2.w", "layer4.0.sn1.w", "layer4.0.sn2.w", "layer4.1.sn1.w", "layer4.1.sn2.w", "layer4.2.sn1.w", "layer4.2.sn2.w".
麻烦您有时间指点一下,谢谢
ParametricLIFNode自带参数,pytorch提供的模型参数里面是缺失这一部分的。加载state dict的时候设置strict为false即可,具体请参考load state dict的文档
谢谢指点!
你好,请问加载预训练模型spiking_resnet18,只能选择neuron.IFNode吗,可不可以使用neuron.ParametricLIFNode? resnet = spiking_resnet.spiking_wide_resnet50_2(pretrained=True, spiking_neuron=neuron.ParametricLIFNode, surrogate_function=surrogate.ATan(), detach_reset=True)
更改spiking_neuron=neuron.ParametricLIFNode会报错: RuntimeError: Error(s) in loading state_dict for SpikingResNet: Missing key(s) in state_dict: "sn1.w", "layer1.0.sn1.w", "layer1.0.sn2.w", "layer1.1.sn1.w", "layer1.1.sn2.w", "layer1.2.sn1.w", "layer1.2.sn2.w", "layer2.0.sn1.w", "layer2.0.sn2.w", "layer2.1.sn1.w", "layer2.1.sn2.w", "layer2.2.sn1.w", "layer2.2.sn2.w", "layer2.3.sn1.w", "layer2.3.sn2.w", "layer3.0.sn1.w", "layer3.0.sn2.w", "layer3.1.sn1.w", "layer3.1.sn2.w", "layer3.2.sn1.w", "layer3.2.sn2.w", "layer3.3.sn1.w", "layer3.3.sn2.w", "layer3.4.sn1.w", "layer3.4.sn2.w", "layer3.5.sn1.w", "layer3.5.sn2.w", "layer4.0.sn1.w", "layer4.0.sn2.w", "layer4.1.sn1.w", "layer4.1.sn2.w", "layer4.2.sn1.w", "layer4.2.sn2.w".
麻烦您有时间指点一下,谢谢