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 when run main.py #12

Open
arisliang opened this issue Mar 15, 2018 · 5 comments
Open

TypeError when run main.py #12

arisliang opened this issue Mar 15, 2018 · 5 comments

Comments

@arisliang
Copy link

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'>

@zsdonghao
Copy link
Member

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.

@arisliang
Copy link
Author

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.

@TIOPG
Copy link

TIOPG commented Mar 16, 2018

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

@arisliang
Copy link
Author

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.

@TIOPG
Copy link

TIOPG commented Mar 17, 2018 via email

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

3 participants