delip / PyTorchNLPBook

Code and data accompanying Natural Language Processing with PyTorch published by O'Reilly Media https://amzn.to/3JUgR2L
Apache License 2.0
1.98k stars 807 forks source link

cuda defaults to false in ch4.cnn instead of true #8

Closed seanv507 closed 5 years ago

seanv507 commented 5 years ago

https://github.com/joosthub/PyTorchNLPBook/blob/db9fc8fe48a2416b36b21dde0dfce787c6ade2b2/chapters/chapter_4/4_4_cnn_surnames/4_4_Classifying_Surnames_with_a_CNN.ipynb#L552

code checks is not available to switch to false (but starts as false)

braingineer commented 5 years ago

Hi @seanv507

Could you please clarify a little? I am not sure exactly what you mean. cuda does start as False in the args, but you can edit the args to change it to True. It shouldn't automatically flip to True if there is a GPU present, that would be too presumptuous of the runtime algorithm.

seanv507 commented 5 years ago

the success of nn's is because of gpu's. So I would expect the default to be use gpus unless there is no gpu, and obviously if for some reason you don't want to use a gpu even if you have one then you can set it to false. you might also want to compare with https://github.com/joosthub/PyTorchNLPBook/blob/db9fc8fe48a2416b36b21dde0dfce787c6ade2b2/chapters/chapter_3/3_5_Classifying_Yelp_Review_Sentiment.ipynb

https://github.com/joosthub/PyTorchNLPBook/blob/db9fc8fe48a2416b36b21dde0dfce787c6ade2b2/chapters/chapter_3/3_5_Classifying_Yelp_Review_Sentiment.ipynb#L604

braingineer commented 5 years ago

hi @seanv507

Thanks for the response!

Part of the success of nn's is due to better compute, this is true. CPU as a default is just a design principle we meant to adhere to, and that other notebook should have been defaulting to False. It is easy for anyone to change that themselves, though :).

I will close this now but please file more issues if you have further concerns!