hanzhanggit / StackGAN

MIT License
1.86k stars 455 forks source link

error: run error #11

Open coderguanmingyang opened 7 years ago

coderguanmingyang commented 7 years ago

I use "pip install prettytensor" but prettytensor aways make mistakes :

$ sh demo/flowers_demo.sh { doc_length : 201 filenames : "Data/flowers/example_captions.t7" queries : "Data/flowers/example_captions.txt" net_txt : "models/text_encoder/lm_sje_flowers_c10_hybrid_0.00070_1_10_trainvalids.txt_iter16400.t7" } Successfully load sentences from: Data/flowers/example_captions.t7 Total number of sentences: 5 num_embeddings: 5 (5, 1024) 2017-03-29 09:47:14.610481: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2017-03-29 09:47:14.610495: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-03-29 09:47:14.610500: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-03-29 09:47:14.610505: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2017-03-29 09:47:14.610509: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. lr_imsize: 64 Traceback (most recent call last): File "demo/demo.py", line 192, in build_model(sess, embeddings.shape[-1], batch_size) File "demo/demo.py", line 64, in build_model fake_images = model.get_generator(tf.concat(1, [c, z])) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1029, in concat dtype=dtypes.int32).get_shape( File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 639, in convert_to_tensor as_ref=False) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 704, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 113, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 102, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape)) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 370, in make_tensor_proto _AssertCompatible(values, dtype) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).name)) TypeError: Expected int32, got <prettytensor.pretty_tensor_class.Layer object at 0x7f74d41abd90> of type 'Layer' instead.

coderguanmingyang commented 7 years ago

thanks for replay~

robertlacok commented 7 years ago

Hey, I had the same issue, it's caused by versions. This combo finally worked:

Robert@gpu-instance-2:~/stackgan$ pip show tensorflow-gpu
Name: tensorflow-gpu
Version: 0.12.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: mock, numpy, protobuf, wheel, six
Robert@gpu-instance-2:~/stackgan$ pip show prettytensor
Name: prettytensor
Version: 0.6.2
Summary: Pretty Tensor makes learning beautiful
Home-page: https://github.com/google/prettytensor
Author: Eider Moore
Author-email: opensource@google.com
License: Apache 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: six, enum34, tensorflow
orgicus commented 7 years ago

@robertlacok I've ran into the same issue and tried you're combo above, but not sure I'm doing it right:

I did pip install tensorflow-gpu==0.12.0 and that worked after upgrading to CUDA 8.0 (from 7.5) and then pip install prettytensor==0.6.2 but the install process looked a little weird:

Collecting prettytensor==0.6.2
  Downloading prettytensor-0.6.2-py2-none-any.whl (264kB)
    100% |████████████████████████████████| 266kB 1.7MB/s 
Collecting tensorflow>=0.9.0rc0 (from prettytensor==0.6.2)
  Downloading tensorflow-1.2.0rc2-cp27-cp27m-macosx_10_11_x86_64.whl (34.2MB)
    100% |████████████████████████████████| 34.2MB 38kB/s 
Requirement already satisfied: enum34>=1.0.0 in ~/tf-venv/lib/python2.7/site-packages (from prettytensor==0.6.2)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python2.7/site-packages (from prettytensor==0.6.2)
Collecting markdown==2.2.0 (from tensorflow>=0.9.0rc0->prettytensor==0.6.2)
  Downloading Markdown-2.2.0.tar.gz (236kB)
    100% |████████████████████████████████| 245kB 1.7MB/s 
Collecting html5lib==0.9999999 (from tensorflow>=0.9.0rc0->prettytensor==0.6.2)
  Downloading html5lib-0.9999999.tar.gz (889kB)
    100% |████████████████████████████████| 890kB 863kB/s 
Requirement already satisfied: werkzeug>=0.11.10 in ~/tf-venv/lib/python2.7/site-packages (from tensorflow>=0.9.0rc0->prettytensor==0.6.2)
Requirement already satisfied: backports.weakref==1.0rc1 in /usr/local/lib/python2.7/site-packages (from tensorflow>=0.9.0rc0->prettytensor==0.6.2)
Requirement already satisfied: protobuf>=3.2.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=0.9.0rc0->prettytensor==0.6.2)
Collecting bleach==1.5.0 (from tensorflow>=0.9.0rc0->prettytensor==0.6.2)
  Downloading bleach-1.5.0-py2.py3-none-any.whl
Requirement already satisfied: numpy>=1.11.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=0.9.0rc0->prettytensor==0.6.2)
Requirement already satisfied: mock>=2.0.0 in /usr/local/lib/python2.7/site-packages (from tensorflow>=0.9.0rc0->prettytensor==0.6.2)
Requirement already satisfied: wheel in /usr/local/lib/python2.7/site-packages (from tensorflow>=0.9.0rc0->prettytensor==0.6.2)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages (from protobuf>=3.2.0->tensorflow>=0.9.0rc0->prettytensor==0.6.2)
Requirement already satisfied: funcsigs>=1; python_version < "3.3" in /usr/local/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow>=0.9.0rc0->prettytensor==0.6.2)
Requirement already satisfied: pbr>=0.11 in /usr/local/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow>=0.9.0rc0->prettytensor==0.6.2)
Building wheels for collected packages: markdown, html5lib
  Running setup.py bdist_wheel for markdown ... done
  Stored in directory: /Users/George/Library/Caches/pip/wheels/b9/4f/6c/f4c1c5207c1d0eeaaf7005f7f736620c6ded6617c9d9b94096
  Running setup.py bdist_wheel for html5lib ... done
  Stored in directory: /Users/George/Library/Caches/pip/wheels/6f/85/6c/56b8e1292c6214c4eb73b9dda50f53e8e977bf65989373c962
Successfully built markdown html5lib
Installing collected packages: markdown, html5lib, bleach, tensorflow, prettytensor
  Found existing installation: Markdown 2.6.8
    Not uninstalling markdown at /usr/local/lib/python2.7/site-packages, outside environment ~/tf-venv/bin/..
  Found existing installation: html5lib 0.999999999
    Not uninstalling html5lib at /usr/local/lib/python2.7/site-packages, outside environment ~/tf-venv/bin/..
  Found existing installation: bleach 2.0.0
    Not uninstalling bleach at /usr/local/lib/python2.7/site-packages, outside environment ~/tf-venv/bin/..
Successfully installed bleach-1.5.0 html5lib-0.9999999 markdown-2.2.0 prettytensor-0.6.2 tensorflow-1.2.0rc2

This is what pip shows:

pip show tensorflow-gpu
Name: tensorflow-gpu
Version: 0.12.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: ~/tf-venv/lib/python2.7/site-packages
Requires: protobuf, six, wheel, mock, numpy

pip show prettytensor
Name: prettytensor
Version: 0.6.2
Summary: Pretty Tensor makes learning beautiful
Home-page: https://github.com/google/prettytensor
Author: Eider Moore
Author-email: opensource@google.com
License: Apache 2.0
Location: ~/tf-venv/lib/python2.7/site-packages
Requires: tensorflow, enum34, six

However in Python I get this:

>>> import tensorflow as tf
>>> tf.__version__
'1.2.0-rc2'

and now I'm back to the int32 vs prettytensor Layer issue:

./demo/birds_demo.sh 
Successfully load sentences from:  Data/birds/example_captions.t7
Total number of sentences: 6
num_embeddings: 6 (6, 1024)
2017-06-08 23:25:07.035773: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-08 23:25:07.035791: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-08 23:25:07.035796: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-06-08 23:25:07.035801: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-08 23:25:07.035806: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
lr_imsize:  64
WARNING:tensorflow:VARIABLES collection name is deprecated, please use GLOBAL_VARIABLES instead; VARIABLES will be removed after 2017-03-02.
WARNING:tensorflow:VARIABLES collection name is deprecated, please use GLOBAL_VARIABLES instead; VARIABLES will be removed after 2017-03-02.
WARNING:tensorflow:VARIABLES collection name is deprecated, please use GLOBAL_VARIABLES instead; VARIABLES will be removed after 2017-03-02.
WARNING:tensorflow:VARIABLES collection name is deprecated, please use GLOBAL_VARIABLES instead; VARIABLES will be removed after 2017-03-02.
Traceback (most recent call last):
  File "demo/demo.py", line 192, in <module>
    build_model(sess, embeddings.shape[-1], batch_size)
  File "demo/demo.py", line 64, in build_model
    fake_images = model.get_generator(tf.concat(1, [c, z]))
  File "~/tf-venv/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1043, in concat
    dtype=dtypes.int32).get_shape(
  File "~/tf-venv/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 676, in convert_to_tensor
    as_ref=False)
  File "~/tf-venv/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 741, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "~/tf-venv/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 113, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "~/tf-venv/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 102, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
  File "~/tf-venv/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 374, in make_tensor_proto
    _AssertCompatible(values, dtype)
  File "~/tf-venv/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
    (dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got <prettytensor.pretty_tensor_class.Layer object at 0x115b31990> of type 'Layer' instead.

I'm a bit confused: did installing prettytensor 0.6.2 install tensorflow 1.2.0-rc2 CPU and override the previous tensorflow 0.12.0 GPU install ? Is is still there ? Any tips on getting the demo working ?

bearpaw commented 7 years ago

I solve this problem by following https://github.com/google/prettytensor/issues/48 (Although there are still other problems)