ELF icon indicating copy to clipboard operation
ELF copied to clipboard

Change device_id -> device

Open chunyang opened this issue 7 years ago • 1 comments

Per this change in PyTorch: https://github.com/pytorch/pytorch/pull/2872 (post v0.2.0)

Without the patch, I see the following error:

Traceback (most recent call last):
  File "train.py", line 24, in <module>
    model = env["model_loaders"][0].load_model(GC.params)
  File "/home/cyang/src/ELF/rlpytorch/model_loader.py", line 95, in load_model
    model.cuda(device_id=args.gpu)
TypeError: cuda() got an unexpected keyword argument 'device_id'

chunyang avatar Nov 06 '17 01:11 chunyang

better just use

model.cuda(args.gpu)

to be compatible with both old and new pytorch.

yuandong-tian avatar Dec 30 '17 22:12 yuandong-tian