Could you please tell the code that I should use for wrapping the model again?
I added this line but still getting error model_ft = nn.DataParallel(model_ft)
import collections

model_dic = torch.load('resnet50_finetuning_affectnet.pkl', map_location='cpu')
new_state_dict = collections.OrderedDict()
for k, v in model_dic.items():
    name = k.replace('module.', '')# remove `module.`
    new_state_dict[name] = v

    
model_ft = nn.DataParallel(model_ft)
model_ft.load_state_dict(new_state_dict)
model_ft = model_ft.to(device)
result = m.evaluate_classifier(model_ft, val_dataLoader, class_num)
confusion_matrix = result['Confusion-Matrix']
m.plot_confusion_matrix(confusion_matrix, enum_expression)
plt.savefig(output_path + output_id + '/confusion_matix.png', dpi=200)
logger.info("==>ACC={:.4f}, F1 score={:.4f}, Cohens Kappa={:.4f}, AUC={:.4f}, AUC-PR={:.4f}".format(
        result['ACC'], result['F1s'], result['Kappa'], result['AUC'], result['AUC-PR'] ))
logger.info("==>F1 scores of each class: {}".format(result['F1s-Class']))