zhanghang1989 / PyTorch-Multi-Style-Transfer

Neural Style and MSG-Net
http://hangzh.com/PyTorch-Style-Transfer/
MIT License
976 stars 207 forks source link

Error Training TypeError: 'NoneType' object is not callable #46

Open moldach opened 3 years ago

moldach commented 3 years ago

I was able to get my environment setup successfully to run eval; however, now, trying train I'm running into an issue. Not sure if it's a syntax issues or if something else is going on? You help is greatly appreciated.


#!/bin/bash
#SBATCH --job-name=train-pytorch
#SBATCH --mail-type=END,FAIL
#SBATCH --mail-user=moldach@ucalgary.ca
#SBATCH --ntasks=1
#SBATCH --time=00:10:00
#SBATCH --mem=8000
#SBATCH --gres=gpu:p100:2
#SBATCH --cpus-per-task=6
#SBATCH --output=%x_%j.log
#SBATCH --error=%x_%j.err

source ~/scratch/moldach/PyTorch-Style-Transfer/experiments/venv/bin/activate

python main.py train \
  --epochs 4 \
  --style-folder /scratch/moldach/PyTorch-Style-Transfer/experiments/images/9styles \
  --vgg-model-dir vgg-model/ \
  --save-model-dir checkpoint/
/scratch/moldach/first-order-model/venv/lib/python3.6/site-packages/torchvision/transforms/transforms.py:188: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
  "please use transforms.Resize instead.")
Traceback (most recent call last):
  File "main.py", line 295, in <module>
    main()
  File "main.py", line 41, in main
    train(args)
  File "main.py", line 135, in train
    utils.init_vgg16(args.vgg_model_dir)
  File "/scratch/moldach/PyTorch-Style-Transfer/experiments/utils.py", line 102, in init_vgg16
    for (src, dst) in zip(vgglua.parameters()[0], vgg.parameters()):
TypeError: 'NoneType' object is not callable

pip freeze:

$ pip freeze
-f /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/nix/avx2
-f /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/nix/generic
-f /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/generic
cffi==1.11.5
cloudpickle==0.5.3
cycler==0.10.0
dask==0.18.2
dataclasses==0.8
decorator==4.4.2
future==0.18.2
imageio==2.9.0
imageio-ffmpeg==0.4.3
kiwisolver==1.3.1
matplotlib==3.3.4
networkx==2.5
numpy==1.19.1
pandas==0.23.4
Pillow==8.1.2
pycparser==2.18
pygit==0.1
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2018.5
PyWavelets==1.1.1
PyYAML==5.1
scikit-image==0.17.2
scikit-learn==0.19.2
scipy==1.4.1
six==1.15.0
tifffile==2020.9.3
toolz==0.9.0
torch==1.7.0
torchfile==0.1.0
torchvision==0.2.1
tqdm==4.24.0
typing-extensions==3.7.4.3
KlausStortebeker commented 3 years ago

https://github.com/zhanghang1989/PyTorch-Multi-Style-Transfer/issues/34#issuecomment-558781248

zhanggithubmeng326 commented 2 years ago

hello hang, I've also met the same problem by trying neural style transfer

zhanghang1989 commented 2 years ago

The main issue is torchfile doesn't work any more.

You may load VGG weights from other places. e.g. from torchvision

zhanggithubmeng326 commented 2 years ago

thank you for your replies very much, I will try again:D