batch_size=batch_size, shuffle=True,

                                           num_workers=2, drop_last=True)

val_loader = torch.utils.data.DataLoader(dataset=val_dataset,batch_size=batch_size, shuffle=False,num_workers=2, drop_last=True)
params = add_weight_decay(network, l2_value=0.0001)
optimizer = torch.optim.Adam(params, lr=learning_rate)
# loss function
loss_fn = nn.CrossEntropyLoss()#weight=class_weights)


# pre-trained weights

device = torch.device("cuda")```
# This line works
weights_path = proj_dir+"pretrained_models/model_13_2_2_2_epoch_580.pth" # start training from orignal pretrained model
# But if I run this it doesnt although this is just saved file of training this data 
weights_path = proj_dir+"training_logs/model_1/checkpoints/"+os.listdir(proj_dir+"training_logs/model_1/checkpoints")[-1] # start training from last saved weights
network.load_state_dict(torch.load(weights_path,map_location="cuda:0"))

print(len(torch.load(weights_path)))

network.to(device)
# Error Message that comes out if I run the other weights path in the second line
 Error(s) in loading state_dict for DeepLabV3:
	Missing key(s) in state_dict: "resnet.resnet.0.weight", "resnet.resnet.1.weight", "resnet.resnet.1.bias", "resnet.resnet.1.running_mean", "resnet.resnet.1.running_var", "resnet.resnet.4.0.conv1.weight", "resnet.resnet.4.0.bn1.weight", "resnet.resnet.4.0.bn1.bias", "resnet.resnet.4.0.bn1.running_mean", "resnet.resnet.4.0.bn1.running_var", "resnet.resnet.4.0.conv2.weight", "resnet.resnet.4.0.bn2.weight", "resnet.resnet.4.0.bn2.bias", "resnet.resnet.4.0.bn2.running_mean", "resnet.resnet.4.0.bn2.running_var", "resnet.resnet.4.1.conv1.weight", "resnet.resnet.4.1.bn1.weight", "resnet.resnet.4.1.bn1.bias", "resnet.resnet.4.1.bn1.running_mean", "resnet.resnet.4.1.bn1.running_var", "resnet.resnet.4.1.conv2.weight", "resnet.resnet.4.1.bn2.weight", "resnet.resnet.4.1.bn2.bias", "resnet.resnet.4.1.bn2.running_mean", "resnet.resnet.4.1.bn2.running_var", "resnet.resnet.5.0.conv1.weight", "resnet.resnet.5.0.bn1.weight", "resnet.resnet.5.0.bn1.bias", "resnet.resnet.5.0.bn1.running_mean", "resnet.resnet.5.0.bn1.running_var", "resnet.resnet.5.0.conv2.weight", "resnet.resnet.5.0.bn2.weight", "resnet.resnet.5.0.bn2.bias", "resnet.resnet.5.0.bn2.running_mean", "resnet.resnet.5.0.bn2.running_var", "resnet.resnet.5.0.downsample.0.weight", "resnet.resnet.5.0.downsample.1.weight", "resnet.resnet.5.0.downsample.1.bias", "resnet.resnet.5.0.downsample.1.running_mean", "resnet.resnet.5.0.downsample.1.running_var", "resnet.resnet.5.1.conv1.weight", "resnet.resnet.5.1.bn1.weight", "resnet.resnet.5.1.bn...
	Unexpected key(s) in state_dict: "pretrained_model.resnet.resnet.0.weight", "pretrained_model.resnet.resnet.1.weight", "pretrained_model.resnet.resnet.1.bias", "pretrained_model.resnet.resnet.1.running_mean", "pretrained_model.resnet.resnet.1.running_var", "pretrained_model.resnet.resnet.1.num_batches_tracked", "pretrained_model.resnet.resnet.4.0.conv1.weight", "pretrained_model.resnet.resnet.4.0.bn1.weight", "pretrained_model.resnet.resnet.4.0.bn1.bias", "pretrained_model.resnet.resnet.4.0.bn1.running_mean", "pretrained_model.resnet.resnet.4.0.bn1.running_var", "pretrained_model.resnet.resnet.4.0.bn1.num_batches_tracked", "pretrained_model.resnet.resnet.4.0.conv2.weight", "pretrained_model.resnet.resnet.4.0.bn2.weight", "pretrained_model.resnet.resnet.4.0.bn2.bias", "pretrained_model.resnet.resnet.4.0.bn2.running_mean", "pretrained_model.resnet.resnet.4.0.bn2.running_var", "pretrained_model.resnet.resnet.4.0.bn2.num_batches_tracked", "pretrained_model.resnet.resnet.4.1.conv1.weight", "pretrained_model.resnet.resnet.4.1.bn1.weight", "pretrained_model.resnet.resnet.4.1.bn1.bias", "pretrained_model.resnet.resnet.4.1.bn1.running_mean", "pretrained_model.resnet.resnet.4.1.bn1.running_var", "pretrained_model.resnet.resnet.4.1.bn1.num_batches_tracked", "pretrained_model.resnet.resnet.4.1.conv2.weight", "pretrained_model.resnet.resnet.4.1.bn2.weight", "pretrained_model.resnet.resnet.4.1.bn2.bias", "pretrained_model.resnet.resnet.4.1.bn2.running_mean", "pretrained_model.resnet.re...