eladrich / pixel2style2pixel

Official Implementation for "Encoding in Style: a StyleGAN Encoder for Image-to-Image Translation" (CVPR 2021) presenting the pixel2style2pixel (pSp) framework
https://eladrich.github.io/pixel2style2pixel/
MIT License
3.19k stars 570 forks source link

no kernel image is available for execution on the device #60

Closed diaodeyi closed 3 years ago

diaodeyi commented 3 years ago

there is wrong with inference :no kernel image is available for execution on the device , but i don’t know how to solve it.

yuval-alaluf commented 3 years ago

This seems to be an issue with your GPU and CUDA environment. If you provide more information we can try helping, but I recommend looking into this issue through other forums that are more knowledgeable about correctly configuring CUDA.

diaodeyi commented 3 years ago

Loading pSp from checkpoint: ./experiment/checkpoint/psp_ffhq_frontalization.pt Loading dataset for ffhq_frontalize 0%| | 0/500 [00:00<?, ?it/s] Traceback (most recent call last): File "scripts/inference.py", line 133, in run() File "scripts/inference.py", line 73, in run result_batch = run_on_batch(input_cuda, net, opts) File "scripts/inference.py", line 111, in run_on_batch result_batch = net(inputs, randomize_noise=False, resize=opts.resize_outputs) File "/opt/conda/envs/psp_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, kwargs) File "./models/psp.py", line 94, in forward return_latents=return_latents) File "/opt/conda/envs/psp_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, *kwargs) File "./models/stylegan2/model.py", line 523, in forward skip = self.to_rgb1(out, latent[:, 1]) File "/opt/conda/envs/psp_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(input, kwargs) File "./models/stylegan2/model.py", line 351, in forward out = self.conv(input, style) File "/opt/conda/envs/psp_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, *kwargs) File "./models/stylegan2/model.py", line 235, in forward style = self.modulation(style).view(batch, 1, in_channel, 1, 1) File "/opt/conda/envs/psp_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(input, *kwargs) File "./models/stylegan2/model.py", line 154, in forward input, self.weight self.scale, bias=self.bias * self.lr_mul RuntimeError: CUDA error: no kernel image is available for execution on the device

diaodeyi commented 3 years ago

my GPU is TITAN XP and my CUDA is 10.2 , pytorch version is 1.6.0 ,i don‘t know what’s wrong

yuval-alaluf commented 3 years ago

It could be that your pytorch version is not compatible with your GPU. Please refer to this thread for a more detailed explanation that I hope you find useful: https://github.com/pytorch/pytorch/issues/31285

diaodeyi commented 3 years ago

yeah,that works. Thank you so much ! By the way , where to find the sketch and the Mask data image to vertify the generation task?

yuval-alaluf commented 3 years ago

Here you can find the original CelebA-HQ dataset along with the segmentation maps for performing segmentation-to-image: https://github.com/switchablenorms/CelebAMask-HQ

Regarding the sketch data we used in the paper, we actually generated the data ourselves using a simple Sobel operator followed by Simo-Serra's sketch simplification (https://github.com/bobbens/sketch_simplification).
I added the script we used for generating the dataset to: scripts/generate_sketch_data.py

diaodeyi commented 3 years ago

Thanks ,but the sketch script with a wrong that "CUDA error: out of memory" , actually the memory is enough.. maybe the sketch_gan Model is not compatible with the pytorch version?

yuval-alaluf commented 3 years ago

That is possible. If I remember correctly, I wrote a note at the top of the script mentioning that you need to install specific versions of pytorch and torchvision to work with their sketch simplification model. Try running the script using those versions.

xzwthu commented 3 years ago

yeah,that works. Thank you so much ! By the way , where to find the sketch and the Mask data image to vertify the generation task?

How did you solve the problem? I get the same error and can not find the solution.

yuval-alaluf commented 3 years ago

Hi @xzwthu , If you provide some more details about your GPU and CUDA environment I can try helping you out