Skip to content

Commit

Permalink
fix for error TypeError: _cuda() got an unexpected keyword argument '…
Browse files Browse the repository at this point in the history
…non_blocking' (#904)
  • Loading branch information
mayank10j authored and jph00 committed Oct 16, 2018
1 parent d21452a commit 99c2c26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion old/fastai/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def T(a, half=False, cuda=True):
elif a.dtype in (np.float32, np.float64):
a = to_half(a) if half else torch.FloatTensor(a)
else: raise NotImplementedError(a.dtype)
if cuda: a = to_gpu(a, non_blocking=True)
if cuda: a = to_gpu(a)
return a

def to_half(tensor):
Expand Down

3 comments on commit 99c2c26

@stas00
Copy link

@stas00 stas00 commented on 99c2c26 Oct 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, this wasn't the original, it was just changed a day before from:

-    if cuda: a = to_gpu(a, async=True)
+    if cuda: a = to_gpu(a, non_blocking=True)

So if it was a mistake, then perhaps, it should go back to to_gpu(a, async=True)?

The change happened here (Scroll to the end)

f0f1266#diff-c1db4f9015fc8f992cfdb7650f0011dd

@mayank10j
Copy link
Author

@mayank10j mayank10j commented on 99c2c26 Oct 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i figured that out , but was little unsure whether to use async=True as async would become keyword from python 3.7 onwords, it may cause some other bugs down the line.
see this discussion :
http://forums.fast.ai/t/cuda-syntax-error/20177
Removing this parameter here i was able to run ipython notebook successfully with no apparent performance issues.

@stas00
Copy link

@stas00 stas00 commented on 99c2c26 Oct 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, The requirements for 0.7.x has been just set to 3.6 >= python < 3.7 so this won't be a problem.

I wasn't part of the 0.7x writing, so I can't tell the impact, but it looked like a potentially bad change. I will let you guys figure it out.

Please sign in to comment.