ADARNN torch CPU only
How can I set to use CPU only If GPU is not available? The error stems from the line 150 in pytorch_adarnn.py
/usr/local/lib/python3.7/site-packages/pyqlib-0.7.2.99-py3.7-linux-x86_64.egg/qlib/contrib/model/pytorch_adarnn.py in init(self, d_feat, hidden_size, num_layers, dropout, n_epochs, pre_epoch, dw, loss_type, len_seq, len_win, lr, metric, batch_size, early_stop, loss, optimizer, n_splits, GPU, seed, **kwargs) 148 149 self.fitted = False --> 150 self.model.cuda() 151 152 @property
RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from
https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/pytorch_adarnn.py self.device = torch.device("cuda:%d" % (GPU) if torch.cuda.is_available() and GPU >= 0 else "cpu")
Thanks for reporting the bug :)
I think replacing all the .cuda() with .to(self.device) will solve this issue.
You can follow this example.
https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/pytorch_nn.py#L157
Would you mind sending a PR to fix this issue and become one of the contributors of Qlib!
Thanks
This issue is stale because it has been open for three months with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days
@SunsetWolf will help to solve this issue
I think this issue already fixed&merged in #1070 . Can I ask why @you-n-g reopened this?
This issue is stale because it has been open for three months with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days