Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: CUDA error: no kernel image is available for execution on the device #37

Open
james20141606 opened this issue Dec 3, 2020 · 1 comment

Comments

@james20141606
Copy link

Hi, thanks for the codes!
I run into a problem when executing:

import torch
from performer_pytorch import Performer

model = Performer(
    dim = 512,
    depth = 1,
    heads = 8,
    causal = True
).cuda()

x = torch.randn(1, 2048, 512).cuda()
y = model(x) # (1, 2048, 512)
x.shape, y.shape

It works fine if I don't use cuda, but when I use cuda it said:


RuntimeError Traceback (most recent call last)
in
10
11 x = torch.randn(1, 2048, 512).cuda()
---> 12 y = model(x) # (1, 2048, 512)
13 x.shape, y.shape

/ext3/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),

/ext3/miniconda3/lib/python3.8/site-packages/performer_pytorch/performer_pytorch.py in forward(self, x, **kwargs)
341
342 def forward(self, x, **kwargs):
--> 343 return self.net(x, **kwargs)
344
345 class PerformerLM(nn.Module):

/ext3/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),

/ext3/miniconda3/lib/python3.8/site-packages/performer_pytorch/reversible.py in forward(self, x, **kwargs)
136
137 for (f, g), (f_args, g_args) in layers_and_args:
--> 138 x = x + f(x, **f_args)
139 x = x + g(x, **g_args)
140 return x

/ext3/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),

/ext3/miniconda3/lib/python3.8/site-packages/performer_pytorch/performer_pytorch.py in forward(self, x, **kwargs)
215 self.fn = fn
216 def forward(self, x, **kwargs):
--> 217 return self.fn(self.norm(x), **kwargs)
218
219 class Chunk(nn.Module):

/ext3/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),

/ext3/miniconda3/lib/python3.8/site-packages/performer_pytorch/performer_pytorch.py in forward(self, x, context, mask, context_mask)
297 attn_outs.append(out)
298
--> 299 out = torch.cat(attn_outs, dim = 1)
300 out = rearrange(out, 'b h n d -> b n (h d)')
301 out = self.to_out(out)

RuntimeError: CUDA error: no kernel image is available for execution on the device

@james20141606
Copy link
Author

I checked that I could run some simple model with cuda. I am not sure if performer requires some certain environment. I am using pytorch==1.6.0 with cuda 10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant