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: in method 'ReadFromStream', argument 2 of type 'size_t' in compression model #7862

Closed
truboxl opened this issue Nov 24, 2019 · 9 comments
Assignees
Labels
models:research models that come under research directory type:support

Comments

@truboxl
Copy link

truboxl commented Nov 24, 2019

System information

Google Colab

Describe the problem

Tried to run image_encoder compression model in Colab, stuck at Comparing Similarity using msssim.py

Attached a written Colab file, just hit Run All:
https://colab.research.google.com/gist/truboxl/1c20fe7b6bc7ff52ceff9a39acdbd721/set-up-tf-models-compression-imageencoder.ipynb

Source code / logs

Traceback (most recent call last):
File "msssim.py", line 217, in
tf.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "msssim.py", line 202, in main
img1_str = image_file.read('rb')
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/lib/io/file_io.py", line 128, in read
pywrap_tensorflow.ReadFromStream(self._read_buf, length))
TypeError: in method 'ReadFromStream', argument 2 of type 'size_t'

@tensorflowbutler tensorflowbutler added the stat:awaiting response Waiting on input from the contributor label Nov 25, 2019
@tensorflowbutler
Copy link
Member

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
What is the top-level directory of the model you are using
Have I written custom code
OS Platform and Distribution
TensorFlow installed from
TensorFlow version
Bazel version
CUDA/cuDNN version
GPU model and memory
Exact command to reproduce

@truboxl
Copy link
Author

truboxl commented Nov 25, 2019

The Colab file also includes the commented line for outputting cat tf_env.txt... zzz

What is the top-level directory of the model you are using
models/research/compression/image_encoder

Have I written custom code
No, refer Colab file

OS Platform and Distribution
os: Linux
os kernel version: #1 SMP Thu Aug 8 02:47:02 PDT 2019
os release version: 4.14.137+
os platform: Linux-4.14.137+-x86_64-with-Ubuntu-18.04-bionic
linux distribution: ('Ubuntu', '18.04', 'bionic')
linux os distribution: ('Ubuntu', '18.04', 'bionic')
mac version: ('', ('', '', ''), '')
uname: uname_result(system='Linux', node='ec7cae62dad7', release='4.14.137+', version='#1 SMP Thu Aug 8 02:47:02 PDT 2019', machine='x86_64', processor='x86_64')
architecture: ('64bit', 'ELF')
machine: x86_64

TensorFlow installed from
Google Colab(?)

TensorFlow version
1.15.0
(2.0.0 straight up broke encoder.py decoder.py msssim.py with a different error)

Bazel version
bash: line 168: bazel: command not found

CUDA/cuDNN version
NVIDIA-SMI 440.33.01 Driver Version: 418.67 CUDA Version: 10.1

GPU model and memory
Tesla K80

Exact command to reproduce
python msssim.py --original_image=./example.png --compared_image=./output/image_15.png

@tensorflowbutler tensorflowbutler removed the stat:awaiting response Waiting on input from the contributor label Nov 26, 2019
@amahendrakar amahendrakar added models:research models that come under research directory type:support labels Nov 27, 2019
@brkygokcen
Copy link

brkygokcen commented Mar 31, 2020

I edited the code in "msssim.py" file like below,

201 with tf.gfile.FastGFile(FLAGS.original_image, 'rb') as image_file:
202 img1_str = image_file.read()
203 with tf.gfile.FastGFile(FLAGS.compared_image, 'rb') as image_file:
204 img2_str = image_file.read()

Then it is working now.

@ravikyram
Copy link

@truboxl

Is this still an issue.Please, close this thread if your issue was resolved.Thanks!

@ravikyram ravikyram self-assigned this Jun 19, 2020
@ravikyram ravikyram added the stat:awaiting response Waiting on input from the contributor label Jun 19, 2020
@truboxl
Copy link
Author

truboxl commented Jun 19, 2020

@ravikyram I think this can be closed once @brkygokcen changes are applied. I confirmed the changes are working with tf-gpu 1.15.

But then tf-gpu 2.x just broke again, probably a different issue...

Traceback (most recent call last):
  File "decoder.py", line 30, in <module>
    tf.flags.DEFINE_string('input_codes', None, 'Location of binary code file.')
AttributeError: module 'tensorflow' has no attribute 'flags'

@ravikyram
Copy link

@truboxl

Can we close this issue and open new issue by filling issue template and by providing related code. Thanks!

@truboxl
Copy link
Author

truboxl commented Jun 19, 2020

...this is still an issue, it is broken out of the box.

@ravikyram ravikyram assigned nmjohn and unassigned ravikyram Jun 19, 2020
@tensorflowbutler tensorflowbutler removed the stat:awaiting response Waiting on input from the contributor label Jun 21, 2020
@truboxl
Copy link
Author

truboxl commented Mar 2, 2021

https://github.com/tensorflow/models/tree/archive/research#warning-archived-models-and-implementations

Since the models are now archived, removed from master branch, no longer maintained and not updated for use with TF2,
I guess there's nothing I can do about anymore.

Closing issue...

@truboxl truboxl closed this as completed Mar 2, 2021
@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
models:research models that come under research directory type:support
Projects
None yet
Development

No branches or pull requests

6 participants