问题描述
最近在复现DragGAN的时候遇到了一些小问题(DragGAN可太好了,效果可太好了),这个效果太令人赞叹了。在自己电脑跑的过程中,出现了以下问题,包括且不限于:Setting up PyTorch plugin "bias_act_plugin"... Failed!、ModuleNotFoundError: No module named 'imgui',ModuleNotFoundError: No module named 'glfw',RuntimeError: Tried to instantiate dummy base class Event。
原因分析与解决
Setting up PyTorch plugin "bias_act_plugin"... Failed!
这个问题似乎仍然遇到与编译器相关的问题,在项目的issuses里查到了这个解决办法:
conda 中使用了 pytoch 2.01 和 cudatoolkit 11.1,并在系统范围内安装了 cuda 11.8。
需要注意的是:CUDA11.2以上,GCC最好在9.3.1-9.4.0之间,可以跑起来,亲测
解决方法:在当前环境安装;cudatoolkit11.1即可,执行下述命令:
conda install cudatoolkit=11.1
注意,不要用pip,因为会报错:
此问题解决方法,感谢以下两位:Setting up PyTorch plugin "bias_act_plugin"... Failed! · Issue #106 · XingangPan/DragGAN · GitHubTrying to run the demo on windows11 but got errors for the bias_act_plugin. Seems to be related to cuda and compiler, but have no idea how to solve these. Anyone familiar with these issues? Or should I just throw my windows laptop into a...https://github.com/XingangPan/DragGAN/issues/106#issuecomment-1610707356 Setting up PyTorch plugin "bias_act_plugin"... Failed! · Issue #106 · XingangPan/DragGAN · GitHubTrying to run the demo on windows11 but got errors for the bias_act_plugin. Seems to be related to cuda and compiler, but have no idea how to solve these. Anyone familiar with these issues? Or should I just throw my windows laptop into a...https://github.com/XingangPan/DragGAN/issues/106#issuecomment-1610942429
ModuleNotFoundError: No module named 'imgui'
查一下这个包,在yml文件和requirement.txt文件是没有的,手动安装它可以解决问题
解决办法:
pip install imgui
ModuleNotFoundError: No module named 'glfw'
这解决了我在 ubuntu 上的问题:
sudo apt-get install libglfw3-dev
这两个问题的解决,感谢以下两位:Error: ModuleNotFoundError: No module named 'imgui' · Issue #51 · XingangPan/DragGAN · GitHubI created a new coda env with Python 3.11 and installed the models, but when I execute the GUI, I encounter this error: ➜ conda create --name dragcan python=3.11 ➜ pip install -r requirements.txt ➜ sh scripts/gui.sh Traceback (most recen...https://github.com/XingangPan/DragGAN/issues/51#issuecomment-1607100165https://github.com/openai/mujoco-py/issues/110#issuecomment-345599591https://github.com/openai/mujoco-py/issues/110#issuecomment-345599591
RuntimeError: Tried to instantiate dummy base class Event
这个情况和cuda找不到是密切相关的,报错信息中也有具体的描述,其中的一个解决办法是:在“renderer.py”中注释掉“self._start_event”和“self._end_event”。但是为什么它们与“\anaconda3\lib\site-packages\torch\cuda_utils.py”有关?这个不清楚。
我则是采用了另外一种解决办法,装了一个较为高版本的torch:
pip install torch==2.0.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
这个问题的解决,感谢以下两位:RuntimeError: Tried to instantiate dummy base class Event · Issue #37 · XingangPan/DragGAN · GitHub实在不太清楚是那有问题了,大会帮忙吧,困死了 (base) E:\DragGAN>pip list Package Version ----------------------- ------------ boltons 23.0.0 brotlipy 0.7.0 certifi 2023.5.7 cffi 1.15.1 charset-normalizer 2.0.4 colorama 0.4.6 conda 23.5.0 conda-content-trust 0....https://github.com/XingangPan/DragGAN/issues/37#issuecomment-1606391921https://github.com/XingangPan/DragGAN/issues/37#issuecomment-1607501082https://github.com/XingangPan/DragGAN/issues/37#issuecomment-1607501082
到目前还没解决怎么办?
这是一个非常魔性的问题,按照官方文档整的环境,没泡通,但是在自己的base环境下(当然是base+以上分析得到的操作然后跑通的),非常魔性,太奇怪了,但也挺好玩的。
哦,说一下是怎么跑通的:不要执行:
sh scripts/gui.sh
而要执行:
python visualizer_drag_gradio.py
ok,看效果:
完结撒花
终于搞定了,说实话,这个项目整了好久,而且自身电脑设备性能限制,所以在最初的时候是不觉得自己可以跑起来的,而且出现了很奇怪的问题,比如明明有cuda但是报错:cuda not found(同问题1),这让我怀疑起了他这个项目本身有问题。但后来经过在issuses闲逛,我发现原来是可以解决的,这让我信心大增,所以经历了一晚上的奋斗之后,得到了结果,还挺好的,接下来就是看看能不能用在实际用途啦~!