'Model is defined in dictionary and I want use DataParallel which doesnt support dictionary

my models are defined as dictionaries and I want to use DataParallel which doesn't support dictionaries. I cannot change dictionaries into normal models. Any alternative solution

models      = {'backbone': resnet18}
if method =='lloss':
   models = {'backbone': resnet18, 'module': loss_module}
torch.backends.cudnn.benchmark = True



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source