scnn_pytorch
scnn_pytorch copied to clipboard
GPU parallel
Hello,I don't know how to use 2 GPUs to run this code. Could you teach me? Thank you very much.
Passing more than one gpu ids to --gpu is supported. (For example, python main.py --gpu 0 1)
Besides, if you want to test vgg_SCNN_DULR_w9.pth, you have to modify multiGPU = True in tools/t7_to_pth.py.
I have followed your operations, but it still work with one GPU. At the beginning, it occurred a fault like this “'DataParallel' object has no attribute 'fc9' ”. So I add a sentence like this "model=model.module".
Sorry about that. I make a commit to comment several lines in main.py as below. I'm not sure if "model=model.module" works and maybe replacing "model.fc9" with "model.module.fc9" is more likely to take effect.
# scheduler
optimizer = optim.SGD(model.parameters(), lr=args.lr, momentum=args.momentum, weight_decay=args.weight_decay)
# fc9_params = [id(p) for p in model.fc9.parameters()]
# fc10_params = [id(p) for p in model.fc10.parameters()]
# base_params = filter(lambda p: id(p) not in fc9_params + fc10_params, model.parameters())
# optimizer = optim.SGD([{'params': base_params},
# {'params': model.fc9.parameters(), 'lr': args.lr * 10},
# {'params': model.fc10.parameters(), 'lr': args.lr * 10}],
# lr=args.lr, momentum=args.momentum, weight_decay=args.weight_decay)
Thank you very much. And I will have a try again.
I have solved this problem. You are so kind that reply our questions as soon as possible. Thank you very much.