Skip to content

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

Open
@seongkyun

Description

@seongkyun

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

Activity

seongkyun

seongkyun commented on May 10, 2017

@seongkyun
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

nashory commented on Oct 11, 2017

@nashory

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

leeeeeeo commented on Apr 14, 2018

@leeeeeeo

@seongkyun thank you nery much ! it really works !

chaowentao

chaowentao commented on Apr 22, 2018

@chaowentao

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

chaowentao

chaowentao commented on Apr 22, 2018

@chaowentao

@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

leeeeeeo commented on Apr 22, 2018

@leeeeeeo

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

chaowentao

chaowentao commented on Apr 22, 2018

@chaowentao

@leeeeeeo thank you.I'll try it.

chaowentao

chaowentao commented on Apr 22, 2018

@chaowentao

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

leeeeeeo

leeeeeeo commented on Apr 22, 2018

@leeeeeeo

@chaowentao maybe. i did.

chaowentao

chaowentao commented on Apr 22, 2018

@chaowentao

@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

leeeeeeo commented on Apr 22, 2018

@leeeeeeo

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

happytaoxiaoli

happytaoxiaoli commented on Jun 6, 2018

@happytaoxiaoli

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @happytaoxiaoli@nashory@seongkyun@leeeeeeo@chaowentao

        Issue actions

          TypeError: zeros_initializer() takes at least 1 argument (0 given) · Issue #13 · hanzhanggit/StackGAN