<p dir="auto">I installed pytorch, and my cuda version is upto date. But when I run my command, I get the following error:<br>
My system:</p>
<p dir="auto">Windows 10<br>
NVIDIA GeForce GTX 960M<br>
Python 3.6(Anaconda)<br>
PyTorch 1.1.0<br>
CUDA 10<br>
`import torch<br>
import torch.nn as nn<br>
from data_util import config<br>
use_cuda = config.use_gpu and torch.cuda.is_available()<br>
def init_lstm_wt(lstm):<br>
for names in lstm.<em>all_weights:<br>
for name in names:<br>
if name.startswith('weight</em>'):<br>
wt = getattr(lstm, name)<br>
wt.data.uniform_(-config.rand_unif_init_mag, config.rand_unif_init_mag)<br>
elif name.startswith('bias_'):<br>
# set forget bias to 1<br>
bias = getattr(lstm, name)<br>
n = bias.size(0)<br>
start, end = n // 4, n // 2<br>
bias.data.fill_(0.)<br>
bias.data[start:end].fill_(1.)<br>
def init_wt_normal(wt):<br>
wt.data.normal_(std=config.trunc_norm_init_std)<br>
class Encoder(nn.Module):<br>
def <strong>init</strong>(self):<br>
super(Encoder, self).<strong>init</strong>()<br>
self.embedding = nn.Embedding(config.vocab_size, config.emb_dim)<br>
init_wt_normal(self.embedding.weight)<br>
self.lstm = nn.LSTM(config.emb_dim, config.hidden_dim, num_layers=1, batch_first=True, bidirectional=True)<br>
init_lstm_wt(self.lstm)<br>
self.W_h = nn.Linear(config.hidden_dim * 2, config.hidden_dim * 2, bias=False)</p>
<p dir="auto">class Decoder(nn.Module):<br>
def <strong>init</strong>(self):<br>
super(Decoder, self).<strong>init</strong>()<br>
self.embedding = nn.Embedding(config.vocab_size, config.emb_dim)<br>
init_wt_normal(self.embedding.weight)<br>
class Model(object):<br>
def <strong>init</strong>(self, model_file_path=None, is_eval=False):<br>
encoder = Encoder()<br>
decoder = Decoder()<br>
if use_cuda:<br>
encoder = encoder.cuda()<br>
decoder = decoder.cuda()<br>
model=Model()<code class="notranslate"> </code>Traceback (most recent call last):<br>
File "G:/public_workspace/pointer_summarizer-pytorch-2.7/data_util/test4.py", line 41, in <br>
model=Model()<br>
File "G:/public_workspace/pointer_summarizer-pytorch-2.7/data_util/test4.py", line 39, in <strong>init</strong><br>
encoder = encoder.cuda()<br>
File "D:\soft\anaconda\lib\site-packages\torch\nn\modules\module.py", line 266, in cuda<br>
return self._apply(lambda t: t.cuda(device))<br>
File "D:\soft\anaconda\lib\site-packages\torch\nn\modules\module.py", line 194, in _apply<br>
module.<em>apply(fn)<br>
File "D:\soft\anaconda\lib\site-packages\torch\nn\modules\module.py", line 200, in <em>apply<br>
param.data = fn(param.data)<br>
File "D:\soft\anaconda\lib\site-packages\torch\nn\modules\module.py", line 266, in <br>
return self.<em>apply(lambda t: t.cuda(device))<br>
File "D:\soft\anaconda\lib\site-packages\torch\cuda_<em>init</em></em>.py", line 176, in <em>lazy_init<br>
torch.<em>C.<em>cuda_init()<br>
RuntimeError: CUDA error: unknown error<code class="notranslate">I annotated a part ,and the error disappeared</code>import torch<br>
import torch.nn as nn<br>
from data_util import config<br>
use_cuda = config.use_gpu and torch.cuda.is_available()<br>
def init_lstm_wt(lstm):<br>
for names in lstm.<em>all_weights:<br>
for name in names:<br>
if name.startswith('weight</em>'):<br>
wt = getattr(lstm, name)<br>
wt.data.uniform</em>(-config.rand_unif_init_mag, config.rand_unif_init_mag)<br>
elif name.startswith('bias</em>'):<br>
# set forget bias to 1<br>
bias = getattr(lstm, name)<br>
n = bias.size(0)<br>
start, end = n // 4, n // 2<br>
bias.data.fill</em>(0.)<br>
bias.data[start:end].fill(1.)<br>
def init_wt_normal(wt):<br>
wt.data.normal(std=config.trunc_norm_init_std)<br>
class Encoder(nn.Module):<br>
def <strong>init</strong>(self):<br>
super(Encoder, self).<strong>init</strong>()<br>
self.embedding = nn.Embedding(config.vocab_size, config.emb_dim)<br>
init_wt_normal(self.embedding.weight)<br>
# self.lstm = nn.LSTM(config.emb_dim, config.hidden_dim, num_layers=1, batch_first=True, bidirectional=True)<br>
# init_lstm_wt(self.lstm)<br>
# self.W_h = nn.Linear(config.hidden_dim * 2, config.hidden_dim * 2, bias=False)</em></em></p>
<p dir="auto">class Decoder(nn.Module):<br>
def <strong>init</strong>(self):<br>
super(Decoder, self).<strong>init</strong>()<br>
self.embedding = nn.Embedding(config.vocab_size, config.emb_dim)<br>
init_wt_normal(self.embedding.weight)<br>
class Model(object):<br>
def <strong>init</strong>(self, model_file_path=None, is_eval=False):<br>
encoder = Encoder()<br>
decoder = Decoder()<br>
if use_cuda:<br>
encoder = encoder.cuda()<br>
decoder = decoder.cuda()<br>
model=Model()`</p>
<p dir="auto">I am unable to use pytorch with CUDA despite having installed it.</p>
<p dir="auto">OS: Windows 10<br>
Pytorch Version: 1.1.0<br>
CUDA Version: 10.0</p>
<p dir="auto">I get the following error. Any help would be appreciated.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/31413869/58431540-f5ad4300-80cb-11e9-8f04-cc6fe98acb1e.png"><img src="https://user-images.githubusercontent.com/31413869/58431540-f5ad4300-80cb-11e9-8f04-cc6fe98acb1e.png" alt="image" style="max-width: 100%;"></a></p>