运行时错误:“softmax_lastdim_kernel_impl”未针对“Half”站点实现:stackoverflow.com

问题描述 投票:0回答:3

我正在遵循 Colab Disco Diffusion v5.xx 中概述的步骤(尝试了具有相同效果的多个版本)- Alex Spirin 的 Warp。
https://colab.research.google.com/github/Sxela/DiscoDiffusion-Warp/blob/main/Disco_Diffusion_v5_2_Warp.ipynb

我确实复制了一个副本到我的 Google 云端硬盘,并上传了一个视频并按照此 YouTube 视频中给出的说明进行操作(我还观看了替代视频以确保我没有错过任何内容):

https://www.youtube.com/watch?v=aaX4XMq0vVo&t=318s

我曾经遇到过一个稍微不同的错误,这导致我在这里遵循这个建议:

https://github.com/alembics/disco-diffusion/issues/130#issuecomment-1281757126

现在我收到此错误:

RuntimeError                              Traceback (most recent call last)
<ipython-input-17-1c79d8e6a9d5> in <module>
    216 torch.cuda.empty_cache()
    217 try:
--> 218     do_run()
    219 except KeyboardInterrupt:
    220     pass

13 frames
/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py in softmax(input, dim, _stacklevel, dtype)
   1678         dim = _get_softmax_dim("softmax", input.dim(), _stacklevel)
   1679     if dtype is None:
-> 1680         ret = input.softmax(dim)
   1681     else:
   1682         ret = input.softmax(dim, dtype=dtype)

RuntimeError: "softmax_lastdim_kernel_impl" not implemented for 'Half'```
python pytorch google-colaboratory
3个回答
2
投票

只需在张量上调用

.float()
即可。为我工作。


0
投票

torch.FloatTensor
为我工作。


0
投票

Torch CPU 后端没有 softmax 实现。您可以将输入张量转换为 float32 或将张量移动到 GPU

.cuda()

© www.soinside.com 2019 - 2024. All rights reserved.