diff --git a/onmt/inputters/inputter.py b/onmt/inputters/inputter.py index e23868a0e3..d9e022f563 100644 --- a/onmt/inputters/inputter.py +++ b/onmt/inputters/inputter.py @@ -490,7 +490,7 @@ def batch_size_fn(new, count, sofar): batch_size_fn = None # device = opt.device_id if opt.gpuid else -1 # breaking change torchtext 0.3 - if opt.gpuid: + if opt.gpu_ranks: device = "cuda" else: device = "cpu" diff --git a/onmt/utils/misc.py b/onmt/utils/misc.py index e8c02dcc92..04c4159408 100644 --- a/onmt/utils/misc.py +++ b/onmt/utils/misc.py @@ -51,5 +51,5 @@ def use_gpu(opt): """ Creates a boolean if gpu used """ - return (hasattr(opt, 'gpuid') and len(opt.gpuid) > 0) or \ + return (hasattr(opt, 'gpu_ranks') and len(opt.gpu_ranks) > 0) or \ (hasattr(opt, 'gpu') and opt.gpu > -1)