InsightFace-v2
InsightFace-v2 copied to clipboard
Attribute error in torch.nn.modules.module while applying the pretrained error.
I am applying the pretrained models on the images and encounted the following error, "torch.nn.modules.module.ModuleAttributeError: 'DataParallel' object has no attribute 'src_device_obj'". So far I am unable to resolve the error so please help me. Python version is 3.8.5 (I have also tried on 3.6) and torch version is 1.6.0. Thanks.
What is it that you are doing that causes this error? by the way, last time I checked 1.5.1 was working fine and 1.6 caused my loss to go to nans! so apart from this, keep this in mind in case you faced nans!
Well, I was trying to generate feature vectors for images. In readme it is written to use megaface,py in which the model is being loaded like this ,
checkpoint = 'BEST_checkpoint.tar' print('loading model: {}...'.format(checkpoint)) checkpoint = torch.load(checkpoint) model = checkpoint['model'].to(device)
I was trying that, and was getting the error. but in lfw_eval.py the model is loaded differently, checkpoint = 'BEST_checkpoint.tar' checkpoint = torch.load(checkpoint) model = checkpoint['model'].module model = model.to(device) model.eval()
Well, this works now and I am able to apply the model. Thanks!