ecnuycxie / DG-Font

The pytorch implementation of DG-Font: Deformable Generative Networks for Unsupervised Font Generation
208 stars 44 forks source link

How to installation DCN #42

Open zj916716524 opened 1 year ago

zj916716524 commented 1 year ago

The DCN link given by github can't be installed. I installed other versions of DCN, but the other versions are missing the functions modulated_deform_conv_forward and DCN.modulated_deform_conv_backward that you call. Can you provide me with the installation method of the version of DCN you are using, or provide these two functions?

yukistavailable commented 1 year ago

I also installed other DCN and rewriting the names of functions worked fine!

In this file modulated_deform_conv_forward -> modulated_deform_conv2d_forward modulated_deform_conv_backward -> modulated_deform_conv2d_backward

zj916716524 commented 1 year ago

I also installed other DCN and rewriting the names of functions worked fine!

In this file modulated_deform_conv_forward -> modulated_deform_conv2d_forward modulated_deform_conv_backward -> modulated_deform_conv2d_backward

Thank you very much for your reply, I am trying to use your method to solve the problem with DCN. Thanks again for your reply!

XuanHien304 commented 1 year ago

hello @yukistavailable, I have tried that and end up with this error: Traceback (most recent call last): File "main.py", line 400, in main() File "main.py", line 170, in main main_worker(args.gpu, ngpus_per_node, args) File "main.py", line 248, in main_worker trainFunc(train_loader, networks, opts, epoch, args, {'logger': logger}) File "/content/DG-Font/train/train.py", line 129, in trainGAN g_loss.backward() File "/usr/local/lib/python3.8/dist-packages/torch/_tensor.py", line 487, in backward torch.autograd.backward( File "/usr/local/lib/python3.8/dist-packages/torch/autograd/init.py", line 197, in backward Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass File "/usr/local/lib/python3.8/dist-packages/torch/autograd/function.py", line 267, in apply return user_fn(self, args) File "/usr/local/lib/python3.8/dist-packages/torch/autograd/function.py", line 414, in wrapper outputs = fn(ctx, args) File "/content/DG-Font/functions/modulated_deform_conv_func.py", line 43, in backward DCN.modulated_deform_conv2d_forward (input, weight, TypeError: modulated_deform_conv2d_forward(): incompatible function arguments. The following argument types are supported:

  1. (arg0: at::Tensor, arg1: at::Tensor, arg2: at::Tensor, arg3: at::Tensor, arg4: at::Tensor, arg5: int, arg6: int, arg7: int, arg8: int, arg9: int, arg10: int, arg11: int, arg12: int, arg13: int, arg14: int, arg15: int) -> at::Tensor

    How can I fix that, thank you.

yukistavailable commented 1 year ago

Hi @XuanHien304

Please confirm the modification to the file "/content/DG-Font/functions/modulated_deform_conv_func.py".

I think you may have replaced modulated_deform_conv_backward with modulated_deform_conv2d_forward. Correctly, replace it with modulated_deform_conv2d_backward.

Chyamble commented 1 year ago

Hi @yukistavailable I had the same problem recently.An error occurs when installing the DCNv2.There are always errors when installing DCNv2. I think cuda version does not match. Could you please tell me the versions of cuda, pytorch and other packages?

Chyamble commented 1 year ago

@yukistavailable @XuanHien304 Problem description:



(DGfont) D:\code\GAN\GAN\ASFF-09f558863ae297663ec476f52a90c0cf6881415e\utils\DCN>python setup.py build install Traceback (most recent call last): File "setup.py", line 61, in ext_modules=get_extensions(), File "setup.py", line 41, in get_extensions raise NotImplementedError('Cuda is not availabel') NotImplementedError: Cuda is not availabel


(DGfont) D:\code\GAN\GAN\Deformable-Convolution-V2-PyTorch-pytorch_1.0.0>python setup.py build install Traceback (most recent call last): File "setup.py", line 64, in ext_modules=get_extensions(), File "setup.py", line 41, in get_extensions raise NotImplementedError('Cuda is not availabel') NotImplementedError: Cuda is not availabel



Whether I use https://github.com/chengdazhi/Deformable-Convolution-V2-PyTorch/tree/pytorch_1.0.0 or https://github.com/GOATmessi7/ASFF/tree/09f558863ae297663ec476f52a90c0cf6881415e/utils , the same problem arises.

yukistavailable commented 1 year ago

Hi @Chyamble

I want to know your environment such as the type of GPU and the version of the nvidia driver and cuda. I don't know this is useful for your environemt, but I recommend you to install cuda-11.6 or cuda-11.8.

Here is my environment: (anaconda virtual environment: python 3.7.16, cuda 11.8, and GPU is RTX 3080)

torch==1.13.1
torchvision==0.14.1
tensorboardX==2.2

This google colab note book may help you to install DCN.

Chyamble commented 1 year ago

Thank you for the environment configuration.Let me try the environmental parameters you gave me first.

Here is my environment: (anaconda virtual environment: python 3.8.16, cudatoolkit 10.2.89, and GPU is RTX 2060)

torch ==1.7.1+cu101
torchvision==0.8.2+cu101
torchaudio==0.7.2
tensorboardX==2.6
......

------------------ 原始邮件 ------------------ 发件人: "ecnuycxie/DG-Font" @.>; 发送时间: 2023年2月22日(星期三) 晚上7:00 @.>; @.**@.>; 主题: Re: [ecnuycxie/DG-Font] How to installation DCN (Issue #42)

Hi @Chyamble

I want to know your environment such as the type of GPU and the version of the nvidia driver and cuda. I don't know this is useful for your environemt, but I recommend you to install cuda-11.8.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

ChenSiyi1 commented 1 year ago

@yukistavailable @XuanHien304 Problem description:

(DGfont) D:\code\GAN\GAN\ASFF-09f558863ae297663ec476f52a90c0cf6881415e\utils\DCN>python setup.py build install

Traceback (most recent call last): File "setup.py", line 61, in ext_modules=get_extensions(), File "setup.py", line 41, in get_extensions raise NotImplementedError('Cuda is not availabel') NotImplementedError: Cuda is not availabel (DGfont) D:\code\GAN\GAN\Deformable-Convolution-V2-PyTorch-pytorch_1.0.0>python setup.py build install Traceback (most recent call last): File "setup.py", line 64, in ext_modules=get_extensions(), File "setup.py", line 41, in get_extensions raise NotImplementedError('Cuda is not availabel') NotImplementedError: Cuda is not availabel

Whether I use https://github.com/chengdazhi/Deformable-Convolution-V2-PyTorch/tree/pytorch_1.0.0 or https://github.com/GOATmessi7/ASFF/tree/09f558863ae297663ec476f52a90c0cf6881415e/utils , the same problem arises.

Hi, I also met the same problem, have you solved it?

danny1120 commented 10 months ago

Hi @yukistavailable, sorry to bother you. I have a question regarding DCN. I'm encountering the same issue as mentioned earlier: .module 'DCN' has no attribute 'modulated_deform_conv2d_forward' I've attempted to implement the solution you suggested. However, the "other DCN" I tried didn't have the method documented. Therefore, regardless of any changes I make to the old file, it still doesn't work. Could you please help me with this? Thank you!

yukistavailable commented 9 months ago

Hi @danny1120, all you have to do is just rename two functions in the following way.

modulated_deform_conv_forward -> modulated_deform_conv2d_forward
modulated_deform_conv_backward -> modulated_deform_conv2d_backward