DCGAN icon indicating copy to clipboard operation
DCGAN copied to clipboard

TypeError when run main.py

Open arisliang opened this issue 7 years ago • 5 comments

Tried both the dcgan folder version of tensorlayer (1.4.5) and installed version of tensorlayer (1.8.1). tensorflow version is 1.6.0.

$ python main.py 
/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/absl/flags/_flag.py", line 166, in _parse
    return self.parser.parse(argument)
  File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/absl/flags/_argument_parser.py", line 152, in parse
    val = self.convert(argument)
  File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/absl/flags/_argument_parser.py", line 268, in convert
    type(argument)))
TypeError: Expect argument to be a string or int, found <class 'float'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 23, in <module>
    flags.DEFINE_integer("train_size", np.inf, "The size of train images [np.inf]")
  File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/tensorflow/python/platform/flags.py", line 58, in wrapper
    return original_function(*args, **kwargs)
  File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/absl/flags/_defines.py", line 315, in DEFINE_integer
    DEFINE(parser, name, default, help, flag_values, serializer, **args)
  File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/absl/flags/_defines.py", line 81, in DEFINE
    DEFINE_flag(_flag.Flag(parser, serializer, name, default, help, **args),
  File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/absl/flags/_flag.py", line 107, in __init__
    self._set_default(default)
  File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/absl/flags/_flag.py", line 196, in _set_default
    self.default = self._parse(value)
  File "/home/ly/anaconda3/envs/learning/lib/python3.6/site-packages/absl/flags/_flag.py", line 169, in _parse
    'flag --%s=%s: %s' % (self.name, argument, e))
absl.flags._exceptions.IllegalFlagValueError: flag --train_size=inf: Expect argument to be a string or int, found <class 'float'>

arisliang avatar Mar 15 '18 00:03 arisliang

it run well on my side:

  • TensorLayer (both 1.4.5 and 1.8.1)
  • TensorFlow 1.4.
  • Python 3.5
  • Ubuntu 16

and I will update this repo with TensorLayer 1.8.1 soon.

zsdonghao avatar Mar 15 '18 11:03 zsdonghao

Would you be able to try on TensorFlow 1.6, python 3.6? Wonder if it's tensorflow version, mine is 1.6 and python 3.6.

arisliang avatar Mar 15 '18 13:03 arisliang

the code in main.py,line22 flags.DEFINE_integer("train_size", np.inf, "The size of train images [np.inf]") change to : flags.DEFINE_float("train_size", np.inf, "The size of train images [np.inf]") then you can run it correct,but there is another tings I don't know you can't got the result you need. the tutorial in README is sample but unuse... I suggest you use another sample DCGAN,like: https://github.com/carpedm20/DCGAN-tensorflow

TIOPG avatar Mar 16 '18 04:03 TIOPG

I changed the line 22, and it fixed the error, $ python main.py is run successfully. Indeed, directly running main.py looks like training, since it doesn't generate images in the end.

Trying the other repo mentioned above, there're more arguments to the usage of main.py mentioned in README.cmd there, like whether its training, or testing; specifying dataset MNIST or celebA, even your own dataset if have.

arisliang avatar Mar 17 '18 00:03 arisliang

About this,you can down load the mnist from the page: http://yann.lecun.com/exdb/mnist/ If you know how to translate the Chinese webpage to the English that you can see my blog: http://blog.csdn.net/wei_xiaoyu/article/details/79579829 My English is poor,maybe many words use uncorrect .

At 2018-03-17 08:54:40, "Aris L" [email protected] wrote:

I changed the line 22, and it fixed the error, $ python main.py is run successfully. Indeed, directly running main.py looks like training, since it doesn't generate images in the end.

Trying the other repo mentioned above, there're more arguments to the usage of main.py mentioned in README.cmd there, like whether its training, or testing; specifying dataset MNIST or celebA, even your own dataset if have.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

TIOPG avatar Mar 17 '18 03:03 TIOPG