import torch
model_path = 'whole_model.pth'
checkpoint = torch. load( model_path, map_location= torch. device( 'cpu' ) )
print ( checkpoint)
Spikformer(
( patch_embed) : SPS(
( proj_conv) : Conv2d( 3 , 32 , kernel_size= ( 3 , 3 ) , stride= ( 1 , 1 ) , padding= ( 1 , 1 ) , bias= False )
( proj_bn) : BatchNorm2d( 32 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( proj_lif) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
( proj_conv1) : Conv2d( 32 , 64 , kernel_size= ( 3 , 3 ) , stride= ( 1 , 1 ) , padding= ( 1 , 1 ) , bias= False )
( proj_bn1) : BatchNorm2d( 64 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( proj_lif1) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
( proj_conv2) : Conv2d( 64 , 128 , kernel_size= ( 3 , 3 ) , stride= ( 1 , 1 ) , padding= ( 1 , 1 ) , bias= False )
( proj_bn2) : BatchNorm2d( 128 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( proj_lif2) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
( maxpool2) : MaxPool2d( kernel_size= 3 , stride= 2 , padding= 1 , dilation= 1 , ceil_mode= False )
( proj_conv3) : Conv2d( 128 , 256 , kernel_size= ( 3 , 3 ) , stride= ( 1 , 1 ) , padding= ( 1 , 1 ) , bias= False )
( proj_bn3) : BatchNorm2d( 256 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( proj_lif3) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
( maxpool3) : MaxPool2d( kernel_size= 3 , stride= 2 , padding= 1 , dilation= 1 , ceil_mode= False )
( rpe_conv) : Conv2d( 256 , 256 , kernel_size= ( 3 , 3 ) , stride= ( 1 , 1 ) , padding= ( 1 , 1 ) , bias= False )
( rpe_bn) : BatchNorm2d( 256 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( rpe_lif) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
)
( block) : ModuleList(
( 0 ) : Block(
( norm1) : LayerNorm( ( 256 , ) , eps= 1e-05 , elementwise_affine= True )
( attn) : SSA(
( q_linear) : Linear( in_features= 256 , out_features= 256 , bias= True )
( q_bn) : BatchNorm1d( 256 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( q_lif) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
( k_linear) : Linear( in_features= 256 , out_features= 256 , bias= True )
( k_bn) : BatchNorm1d( 256 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( k_lif) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
( v_linear) : Linear( in_features= 256 , out_features= 256 , bias= True )
( v_bn) : BatchNorm1d( 256 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( v_lif) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
( attn_lif) : MultiStepLIFNode(
v_threshold= 0.5 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
( proj_linear) : Linear( in_features= 256 , out_features= 256 , bias= True )
( proj_bn) : BatchNorm1d( 256 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( proj_lif) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
)
( norm2) : LayerNorm( ( 256 , ) , eps= 1e-05 , elementwise_affine= True )
( mlp) : MLP(
( fc1_linear) : Linear( in_features= 256 , out_features= 256 , bias= True )
( fc1_bn) : BatchNorm1d( 256 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( fc1_lif) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
( fc2_linear) : Linear( in_features= 256 , out_features= 256 , bias= True )
( fc2_bn) : BatchNorm1d( 256 , eps= 1e-05 , momentum= 0.1 , affine= True , track_running_stats= True )
( fc2_lif) : MultiStepLIFNode(
v_threshold= 1.0 , v_reset= 0.0 , detach_reset= True , tau= 2.0 , backend= torch
( surrogate_function) : Sigmoid( alpha= 4.0 , spiking= True )
)
)
)
)
( head) : Linear( in_features= 256 , out_features= 10 , bias= True )
)