apple / ml-gmpi

[ECCV 2022, Oral Presentation] Official PyTorch implementation of GMPI
Other
340 stars 31 forks source link

RuntimeError: "slow_conv_transpose2d_out_cpu" not implemented for 'Half' #19

Closed m0o0scar closed 1 year ago

m0o0scar commented 1 year ago

Hi. I'm trying to run this project on Google Colab with GPU runtime. After setting up the environment and downloading the source code and pretrain weights. I encounter the following error when rendering a single image:

Traceback (most recent call last):
  File "/content/ml-gmpi/gmpi/eval/vis/render_video.py", line 228, in <module>
    generator = setup_model(opt, config, metadata, mpi_xyz_input, mpi_xyz_only_z, vis_mesh=False, device=device)
  File "/content/ml-gmpi/gmpi/eval/common.py", line 120, in setup_model
    _ = stylegan2_misc.print_module_summary(generator, [z, c, mpi_xyz_input, mpi_xyz_only_z, n_g_out_planes])
  File "/content/ml-gmpi/gmpi/models/torch_utils/misc.py", line 216, in print_module_summary
    outputs = module(*inputs)
  File "/usr/local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1148, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/content/ml-gmpi/gmpi/models/networks/networks_cond_on_pos_enc.py", line 1323, in forward
    img = self.synthesize(ws=ws, n_planes=n_planes, mpi_xyz_coords=mpi_xyz_coords, xyz_coords_only_z=xyz_coords_only_z,
  File "/content/ml-gmpi/gmpi/models/networks/networks_cond_on_pos_enc.py", line 1295, in synthesize
    img = self.synthesis(ws, xyz_coords=mpi_xyz_coords, enable_feat_net_grad=enable_syn_feat_net_grad, xyz_coords_only_z=xyz_coords_only_z, n_planes=n_planes, **synthesis_kwargs)
  File "/usr/local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1148, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/content/ml-gmpi/gmpi/models/networks/networks_cond_on_pos_enc.py", line 1205, in forward
    x, img = block(x, img, cur_ws, xyz_coords=tmp_xyz_coords, xyz_coords_only_z=xyz_coords_only_z, n_planes=n_planes, enable_feat_net_grad=enable_feat_net_grad, **block_kwargs)
  File "/usr/local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1148, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/content/ml-gmpi/gmpi/models/networks/networks_cond_on_pos_enc.py", line 782, in forward
    x = self.conv0(x, w_conv0, fused_modconv=fused_modconv, **layer_kwargs)
  File "/usr/local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1148, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/content/ml-gmpi/gmpi/models/networks/networks_cond_on_pos_enc.py", line 417, in forward
    x = modulated_conv2d(x=x, weight=self.weight, styles=styles, noise=noise, up=self.up,
  File "/content/ml-gmpi/gmpi/models/torch_utils/misc.py", line 104, in decorator
    return fn(*args, **kwargs)
  File "/content/ml-gmpi/gmpi/models/networks/networks_cond_on_pos_enc.py", line 180, in modulated_conv2d
    x = conv2d_resample.conv2d_resample(x=x, w=weight.to(x.dtype), f=resample_filter, up=up, down=down, padding=padding, flip_weight=flip_weight)
  File "/content/ml-gmpi/gmpi/models/torch_utils/misc.py", line 104, in decorator
    return fn(*args, **kwargs)
  File "/content/ml-gmpi/gmpi/models/torch_utils/ops/conv2d_resample.py", line 136, in conv2d_resample
    x = _conv2d_wrapper(x=x, w=w, stride=up, padding=[pyt,pxt], groups=groups, transpose=True, flip_weight=(not flip_weight))
  File "/content/ml-gmpi/gmpi/models/torch_utils/ops/conv2d_resample.py", line 52, in _conv2d_wrapper
    return op(x, w, stride=stride, padding=padding, groups=groups)
  File "/content/ml-gmpi/gmpi/models/torch_utils/ops/conv2d_gradfix.py", line 44, in conv_transpose2d
    return torch.nn.functional.conv_transpose2d(input=input, weight=weight, bias=bias, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation)
RuntimeError: "slow_conv_transpose2d_out_cpu" not implemented for 'Half'

The Colab notebook and its full output can be found here: https://colab.research.google.com/drive/1Iw1yetX-1b1zRhGXa12tpjTT_Un9kkQ3?usp=sharing

Xiaoming-Zhao commented 1 year ago

Thanks a lot for your interest in the work. It seems like your Colab is using "CPU" according to slow_conv_transpose2d_out_cpu.

A similar issue happened before, see https://github.com/NVlabs/stylegan2-ada-pytorch/issues/105

Maybe you can double-check your Colab's GPU setup. Hope this helps.