SteganoGAN项目代码的复现细节

前言

一开始在window下运行出错,环境一直卡bug,想转linux系统运行

但是bug在眼前,怎么能不解决,最终还是突破了bug,成功在window下执行

1. 总体环境

  • window操作系统

  • cuda驱动:
    在这里插入图片描述

  • nvcc --version:
    在这里插入图片描述

  • 开发环境:pycharm+python3.7(装在了conda的虚拟环境下)

2. 在window跑通的版本

卡bug调试最难的点是找pytorch与torchvision想配对的版本,且要与项目配对上:
在这里插入图片描述

最后执行我项目代码环境来生成requirements.txt

  1. pip freeze > requirements.txt
  2. 如果生成的为路径而不是版本号,再次执行:pip list --format=freeze > requirements.txt

最后执行成功的requirements.txt:

anyio==3.5.0
argon2-cffi==20.1.0
atomicwrites==1.4.0
attrs==22.1.0
Babel==2.11.0
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==4.1.0
brotlipy==0.7.0
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==2.0.4
colorama==0.4.6
coverage==6.3.2
cryptography==39.0.1
debugpy==1.5.1
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
fastjsonschema==2.16.2
flit_core==3.6.0
idna==3.4
imageio==2.4.1
importlib-metadata==4.11.3
importlib-resources==5.2.0
iniconfig==1.1.1
ipykernel==6.15.2
ipython==7.31.1
ipython-genutils==0.2.0
ipywidgets==7.6.5
jedi==0.18.1
Jinja2==3.1.2
json5==0.9.6
jsonschema==4.17.3
jupyter==1.0.0
jupyter_client==7.4.9
jupyter-console==6.4.4
jupyter_core==4.11.2
jupyter-server==1.23.4
jupyterlab==3.5.3
jupyterlab-pygments==0.1.2
jupyterlab_server==2.19.0
jupyterlab-widgets==1.0.0
MarkupSafe==2.1.1
matplotlib-inline==0.1.6
mistune==0.8.4
mkl-fft==1.3.0
mkl-random==1.1.1
mkl-service==2.3.0
nbclassic==0.5.2
nbclient==0.5.13
nbconvert==6.4.4
nbformat==5.7.0
nest-asyncio==1.5.6
notebook==6.5.2
notebook_shim==0.2.2
numpy==1.19.2
olefile==0.46
packaging==22.0
pandocfilters==1.5.0
parso==0.8.3
pickleshare==0.7.5
Pillow==7.2.0
pip==22.3.1
pkgutil_resolve_name==1.3.10
pluggy==1.0.0
ply==3.11
prometheus-client==0.14.1
prompt-toolkit==3.0.36
psutil==5.9.0
py==1.11.0
pycparser==2.21
Pygments==2.11.2
pyOpenSSL==23.0.0
PyQt5==5.15.7
PyQt5-sip==12.11.0
pyrsistent==0.18.0
PySocks==1.7.1
pytest==7.1.2
pytest-cov==3.0.0
pytest-runner==6.0.0
python-dateutil==2.8.2
pytz==2022.7
pywin32==305.1
pywinpty==2.0.10
pyzmq==23.2.0
qtconsole==5.4.0
QtPy==2.2.0
reedsolo==1.7.0
requests==2.28.1
scipy==1.1.0
Send2Trash==1.8.0
setuptools==65.6.3
sip==6.6.2
six==1.16.0
sniffio==1.2.0
soupsieve==2.3.2.post1
steganogan==0.1.2
terminado==0.17.1
testpath==0.6.0
toml==0.10.2
tomli==2.0.1
torch==1.0.0
torchvision==0.2.2
tornado==6.2
tqdm==4.19.9
traitlets==5.7.1
typing_extensions==4.4.0
urllib3==1.26.14
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==0.58.0
wheel==0.38.4
widgetsnbextension==3.5.2
win-inet-pton==1.1.0
wincertstore==0.2
zipp==3.11.0

如果跟我同配置,还不行,让系统重启更新配置下。
多数都是版本依赖问题

3. 成功截图

如果遇到其他bug,可以在我的博客进行相应搜索!

在这里插入图片描述
以及
在这里插入图片描述
以及

在这里插入图片描述

4. 彩蛋

由于过多人玩此项目,问题较多,今天(2024.1.14)特意回顾看了下!

上述代码环境转移到服务器,发现个别版本有错误,需要注意的点:torch版本与CUDA版本要照应,可通过如下查看:版本确认

否则可能会出现如下情况:

  • pytorch capability sm_86 is not compatible with the current PyTorch installation

或者

  • RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED

问题如下所示:

  File "/home/l228/huoyanhao/SteganoGAN-master/research/SteganoGAN/model.py", line 32, in forward
    x = self.features(image)
  File "/home/l228/anaconda3/envs/stegan3.7/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/l228/anaconda3/envs/stegan3.7/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
    input = module(input)
  File "/home/l228/anaconda3/envs/stegan3.7/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/l228/anaconda3/envs/stegan3.7/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 320, in forward
    self.padding, self.dilation, self.groups)
RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED

截图如下:

在这里插入图片描述

由于服务器显卡是3090,CUDA是12.1的版本
一开始安装torch1.7版本不兼容!
于是安装了torch1.13.1(成功执行):

在这里插入图片描述

3090的显卡可以试试torch1.13.1版本
3090的显卡可以试试torch1.13.1版本
3090的显卡可以试试torch1.13.1版本

评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农研究僧

你的鼓励将是我创作的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值