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

TypeError: zeros_initializer() takes at least 1 argument (0 given) #13

Open
seongkyun opened this issue May 10, 2017 · 12 comments
Open

Comments

@seongkyun
Copy link

i wrote

$ python run_exp.py --cfg stageI/cfg/birds.yml --gpu 0

and it prints out

Traceback (most recent call last):
File "run_exp.py", line 11, in
from stageI.model import CondGAN
File "/home/han/StackGAN/stageI/model.py", line 4, in
import prettytensor as pt
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/init.py", line 25, in
from prettytensor import funcs
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/funcs.py", line 25, in
from prettytensor.pretty_tensor_image_methods import *
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/pretty_tensor_image_methods.py", line 135, in
class conv2d(prettytensor.VarStoreMethod):
File "/home/han/anaconda2/lib/python2.7/site-packages/prettytensor/pretty_tensor_image_methods.py", line 145, in conv2d
bias=tf.zeros_initializer(),
TypeError: zeros_initializer() takes at least 1 argument (0 given)

what should i do?
please help me.

I'm running on Ubuntu 16.04, tensorflow r0.11 with cuda8.0 and cudnn5.1

@seongkyun
Copy link
Author

i solved this problem

firstly, upgrade tensorflow to R1.0.1
and move run_exp.py file /home/username/StackGAN/stageI to /home/username/StackGAN

second, install dependencies
$ pip install prettytensor
$ pip install easydict
$ pip install progressbar

third, upgrade code(misc, stageI, and stageII folder python codes) using tf_upgrade
(see : https://www.tensorflow.org/install/migration)

fourth, change misc/datasets.py
line 75, 76

h1 = np.floor((ori_size - self._imsize) * np.random.random())
w1 = np.floor((ori_size - self._imsize) * np.random.random())

to

h1 = int(np.floor((ori_size - self._imsize) * np.random.random()))
w1 = int(np.floor((ori_size - self._imsize) * np.random.random()))

now, i'm training dataset with

CPU : intel core i5-7600
GPU : Geforce GTX1060 (6GB ram)
with CUDA 8.0m cuDNN 5.1, Tensorflow-gpu 1.0.1

@nashory
Copy link

nashory commented Oct 11, 2017

I also found it was tf version issue.
Upgrading tf to higher version would solve the issue.

HOWEVER, if you upgrad the tf version into 1.0.1, you will get type error since tf 1.0.1 version have changed the argument order of tf.concat function. (google/prettytensor#48)

To avoid this error, you have to change the argument order of tf.concat (i.e. tf.concat(1, [c,z]) --> tf.concat[c,z], 1)

If you want modified stable version of this code, refer to my repo
(Same code with the author, but fixed bugs.)

@leeeeeeo
Copy link

@seongkyun thank you nery much ! it really works !

@chaowentao
Copy link

@leeeeeeo can you give me details of solution?Thanks a lot.

@chaowentao
Copy link

@seongkyun @nashory can you tell me your tensorflow version?I want to run the stackGAN,but i am confused about how to configure the environment.Thanks a lot.

@leeeeeeo
Copy link

@chaowentao version has already shown at the last of @seongkyun 's comment. and it really works. just follow his solution.

@chaowentao
Copy link

@leeeeeeo thank you.I'll try it.

@chaowentao
Copy link

@leeeeeeo Do i still need to redo the images processing?

@leeeeeeo
Copy link

@chaowentao maybe. i did.

@chaowentao
Copy link

@leeeeeeo my result is
W tensorflow/core/framework/op_kernel.cc:993] Internal: Failed launching ResizeNearestNeighbor
[[Node: g_net/apply_5/ResizeNearestNeighbor = ResizeNearestNeighbor[T=DT_FLOAT, align_corners=false, _device="/job:localhost/replica:0/task:0/gpu:0"](g_net/apply_4/Relu, g_net/apply_5/ResizeNearestNeighbor/size)]]
W tensorflow/core/framework/op_kernel.cc:993] Internal: Failed launching ResizeNearestNeighbor
[[Node: g_net/apply_5/ResizeNearestNeighbor = ResizeNearestNeighbor[T=DT_FLOAT, align_corners=false, _device="/job:localhost/replica:0/task:0/gpu:0"](g_net/apply_4/Relu, g_net/apply_5/ResizeNearestNeighbor/size)]]
Can you give me some advice?
ubuntu14.04LTS CUDA 8.0m cuDNN 5.1, Tensorflow-gpu 1.0.1

@leeeeeeo
Copy link

@chaowentao somewhere went wrong. i didnt meet this. try again.

@happytaoxiaoli
Copy link

its a version problem:
just change the version of tensorflow and prettytensor
pip install tensorflow-gpu==0.12.0rc0
pip install prettytensor==0.7.1

egvincent pushed a commit to egvincent/styled-stackgan that referenced this issue Mar 10, 2019
(move run_exp.py as recommended by:
hanzhanggit/StackGAN#13 (comment),
which seems to be necessary for training either stage)

fix config to point to real pretrained model. was pointing to some
nonexistent file before
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

5 participants