joint-disfluency-detector-and-parser
joint-disfluency-detector-and-parser copied to clipboard
Calling cuda() with async results in SyntaxError
The error occurs in this line.
if use_cuda:
torch_t = torch.cuda
def from_numpy(ndarray):
return torch.from_numpy(ndarray).pin_memory().cuda(async=True)
The reason for this error is that async
has become a reserved keyword from python 3.7. The cuda()
constructor arguments have changed as well. This is how the new constructor looks -
cuda(device=None, non_blocking=False)
async=True
can be replaced by non_blocking=True
.
non_blocking (bool): If True and the source is in pinned memory, the copy will be asynchronous with respect to the host. Otherwise, the argument has no effect. Default: False.
The error occurs in this line.
if use_cuda: torch_t = torch.cuda def from_numpy(ndarray): return torch.from_numpy(ndarray).pin_memory().cuda(async=True)
The reason for this error is that
async
has become a reserved keyword from python 3.7. Thecuda()
constructor arguments have changed as well. This is how the new constructor looks -cuda(device=None, non_blocking=False)
async=True
can be replaced bynon_blocking=True
.non_blocking (bool): If True and the source is in pinned memory, the copy will be asynchronous with respect to the host. Otherwise, the argument has no effect. Default: False.
Thanks! I updated parse_nk.py