torch_maml
torch_maml copied to clipboard
CPU环境训练
以CPU模式运行的话,helper.py中
model = Classifier(1, args.n_way).cuda()
要把.cuda()调用改为.to(dev),其中dev是在args.py中设置的设备变量,确保dev被设置为'cpu'。 arg.py中需要:
- 注释--gpu参数,因为在使用CPU进行训练时不需要指定GPU设备。
- 注释设置环境变量CUDA_VISIBLE_DEVICES的代码,因为在使用CPU时不需要这一步骤。
- 修改dev变量的赋值,直接将其设置为torch.device('cpu'),确保所有操作都在CPU上执行。