Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eval_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def main():
parser.add_argument('--seed', type=int, default=0, help='the random seed')
parser.add_argument('--precision', choices=['fp16', 'fp32', 'fp64'], default='fp32', help='the floating-point precision (defaults to fp32)')
parser.add_argument('--cuda', action='store_true', help='use cuda (requires cupy)')
parser.add_argument('--device_id', default=None, type=int, help='device ID used for the --cuda option (defaults to 0)')
args = parser.parse_args()

# Choose the right dtype for the desired precision
Expand All @@ -80,6 +81,8 @@ def main():
print('ERROR: Install CuPy for CUDA support', file=sys.stderr)
sys.exit(-1)
xp = get_cupy()
if args.device_id is not None:
xp.cuda.Device(args.device_id).use()
x = xp.asarray(x)
z = xp.asarray(z)
else:
Expand Down
Loading