Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: test argument is not supported anymore. Use chainer.using_config #91

Open
wangkepermit opened this issue Jun 5, 2017 · 5 comments

Comments

@wangkepermit
Copy link

Hi! My Dear.
two question for you,Please!
# 1:
[root@localhost chainer-fast-neuralstyle]# python generate.py c1.jpg --model models/seurat.model --out o.jpg
Traceback (most recent call last):
File "generate.py", line 45, in
y = model(x)
File "/root/chainer-fast-neuralstyle/net.py", line 55, in call
h = self.b1(F.elu(self.c1(x)), test=test)
File "/usr/lib/python2.7/site-packages/chainer/links/normalization/batch_normalization.py", line 117, in call
kwargs, test='test argument is not supported anymore. '
File "/usr/lib/python2.7/site-packages/chainer/utils/argument.py", line 4, in check_unexpected_kwargs
raise ValueError(message)
ValueError: test argument is not supported anymore. Use chainer.using_config
# 2.
[root@localhost chainer-fast-neuralstyle]# python generate.py c1.jpg --model models/vgg16.model --out o.jpg
Traceback (most recent call last):
File "generate.py", line 30, in
serializers.load_npz(args.model, model)
File "/usr/lib/python2.7/site-packages/chainer/serializers/npz.py", line 134, in load_npz
d.load(obj)
File "/usr/lib/python2.7/site-packages/chainer/serializer.py", line 82, in load
obj.serialize(self)
File "/usr/lib/python2.7/site-packages/chainer/link.py", line 792, in serialize
d[name].serialize(serializer[name])
File "/usr/lib/python2.7/site-packages/chainer/link.py", line 792, in serialize
d[name].serialize(serializer[name])
File "/usr/lib/python2.7/site-packages/chainer/link.py", line 548, in serialize
data = serializer(name, param.data)
File "/usr/lib/python2.7/site-packages/chainer/serializers/npz.py", line 106, in call
dataset = self.npz[key]
File "/usr/lib64/python2.7/site-packages/numpy/lib/npyio.py", line 237, in getitem
raise KeyError("%s is not a file in the archive" % key)
KeyError: 'r4/c2/W is not a file in the archive'

Last: How adjust CPU and GPU number?

@shreyanshp
Copy link

For the first one, even I am facing the same issue?
is there a dependency issue?

@ChoclateRain
Copy link

ChoclateRain commented Jun 25, 2017

Was also getting an error about "test=" in generate.py
Solved that by removing all "test" entries in generate.py

Also noticed train.py was giving me errors,
fixed it by removing all "volatile" lines in train.py

Not sure what these were used for but its working without them

@pengjingg
Copy link

The first problem was caused by the version update of chainer.
The offical explains are:

In Chainer v2, the concept of training mode is added. It is represented by a thread-local flag chainer.config.train, which is a part of the unified configuration. When chainer.config.train is True, functions of Chainer run in the training mode, and otherwise they run in the test mode. For example, BatchNormalization and dropout() behave differently in each mode.

In Chainer v1, such a behavior was configured by the train or test argument of each function. This train/test argument has been removed in Chainer v2. If your code is using the train or test argument, you have to update it. In most cases, what you have to do is just removing the train / test argument from any function calls.

Also you can find examples here:
https://docs.chainer.org/en/stable/upgrade.html#global-configurations

@artnose
Copy link

artnose commented Apr 3, 2018

Is there a solution to this? Downgrade chainer or upgrade the code?

@jtomori
Copy link

jtomori commented Jan 16, 2019

Hi, you can take a look at my docker image where I have it running: https://github.com/jtomori/style_transfer_docker

I also forked the repo and did small adjustments, you should be able to get it running without docker too: https://github.com/jtomori/chainer-fast-neuralstyle/tree/resize-conv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants