import torch
import models
model_names = sorted(name for name in models.__dict__
if name.islower() and not name.startswith("__")
and callable(models.__dict__[name]))
model = models.__dict__['resnet18']
model = torch.nn.DataParallel(model,device_ids = [0]) #PROBLEM CAUSING LINE
model.to('cuda:0')
To run this code you need to clone this repository : https://github.com/SoftwareGift/FeatherNets_Face-Anti-spoofing-Attack-Detection-Challenge-CVPR2019.git
Please run this piece of code inside the root folder of the cloned directory.
I am getting the follow error AttributeError: 'function' object has no attribute 'cuda'
I have tried using torch.device object as well for the same function and it results in the same error.
Please ask for any other details that are required. PyTorch newbie here
python:3.7 pytorch:1.3.1
model = torch.nn.DataParallel(model,device_ids = [0])withmodel = torch.nn.DataParallel(model() ,device_ids = [0])(notice the()aftermodelinsideDataParallel)modelwithmodel()change ?