pingu2k4
By:
pingu2k4

Error following ML tutorial

December 4, 2017 92 views
Development Ubuntu 16.04

Hi,

I am following this tutorial: https://www.digitalocean.com/community/tutorials/how-to-perform-neural-style-transfer-with-python-3-and-pytorch#step-2-—-running-your-first-style-transfer-experiment

I am having the same problem as posted in the comments.

Originally, the images from this snippet pasted into Jupyter:

contentimage = Image('{}/images/content/venice-boat.jpg'.format(workingdir))
style
image = Image('{}/images/21styles/starrynight.jpg'.format(workingdir))
display(content
image)
display(style_image)

were not showing also, but I finally realised this was becasue the Jupyter notebook was created by user science, so home was different to root home, so I setup again in science home and I get the images etc working.

However, when it comes to the point of trying the first style transfer, I get the rror posted in the comments. Here is is:


CalledProcessError Traceback (most recent call last)
in ()
3
4 # run the command
----> 5 x = subprocess.checkoutput(cmd, universalnewlines=True)

/usr/lib/python3.5/subprocess.py in check_output(timeout, popenargs, *kwargs)
624
625 return run(popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 626 *
kwargs).stdout
627
628

/usr/lib/python3.5/subprocess.py in run(input, timeout, check, popenargs, *kwargs)
706 if check and retcode:
707 raise CalledProcessError(retcode, process.args,
--> 708 output=stdout, stderr=stderr)
709 return CompletedProcess(process.args, retcode, stdout, stderr)
710

CalledProcessError: Command '['python3', '/home/science/styletransfer/PyTorch-Style-Transfer/experiments/main.py', 'eval', '--content-image', '/home/science/styletransfer/PyTorch-Style-Transfer/experiments/images/content/venice-boat.jpg', '--style-image', '/home/science/styletransfer/PyTorch-Style-Transfer/experiments/images/21styles/starrynight.jpg', '--model', '/home/science/styletransfer/PyTorch-Style-Transfer/experiments/models/21styles.model', '--output-image', '/home/science/styletransfer/PyTorch-Style-Transfer/experiments/test.jpg', '--cuda=0']' returned non-zero exit status 1

1 Answer

OK, so I changed the cvall to use python3 not python, and I get the following error instead:

Traceback (most recent call last):
File "main.py", line 287, in <module>
main()
File "main.py", line 44, in main
evaluate(args)
File "main.py", line 242, in evaluate
stylemodel = Net(ngf=args.ngf)
File "/root/style
transfer/PyTorch-Style-Transfer/experiments/net.py", line 284, in init
model += [upblock(ngf*expansion, 32, 2, normlayer),
File "/root/style
transfer/PyTorch-Style-Transfer/experiments/net.py", line 127, in init
kernelsize=1, stride=1, upsample=stride)
File "/root/style
transfer/PyTorch-Style-Transfer/experiments/net.py", line 167, in init
self.upsamplelayer = torch.nn.Upsample(scalefactor=upsample)
AttributeError: module 'torch.nn' has no attribute 'Upsample'

  • The above was put in wrong place - But it is talking about this. I called it via putty rather than in jupyter, and this is what I see. Any ideas?

Have another answer? Share your knowledge.