Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

tf.placeholder don't exist in tf 2.0 #24

Closed
MrZhengXin opened this issue Mar 6, 2019 · 4 comments
Closed

tf.placeholder don't exist in tf 2.0 #24

MrZhengXin opened this issue Mar 6, 2019 · 4 comments
Assignees
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@MrZhengXin
Copy link

Describe the Bug

On tensorflow 2.0, there is no tf.placeholder

Traceback (most recent call last):
  File "load_and_extract.py", line 18, in <module>
    model = load_trained_model_from_checkpoint(config_path, checkpoint_path)
  File "/usr/local/lib/python3.5/dist-packages/keras_bert/loader.py", line 43, in load_trained_model_from_checkpoint
    training=training,
  File "/usr/local/lib/python3.5/dist-packages/keras_bert/bert.py", line 58, in get_model
    inputs = get_inputs(seq_len=seq_len)
  File "/usr/local/lib/python3.5/dist-packages/keras_bert/layers/inputs.py", line 15, in get_inputs
    ) for name in names]
  File "/usr/local/lib/python3.5/dist-packages/keras_bert/layers/inputs.py", line 15, in <listcomp>
    ) for name in names]
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/input_layer.py", line 178, in Input
    input_tensor=tensor)
  File "/usr/local/lib/python3.5/dist-packages/keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/input_layer.py", line 87, in __init__
    name=self.name)
  File "/usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py", line 517, in placeholder
    x = tf.placeholder(dtype, shape=shape, name=name)
AttributeError: module 'tensorflow' has no attribute 'placeholder'

Version Info

tf-nightly-gpu-2.0-preview 2.0.0.dev20190304
Keras 2.2.4
python 3.5.2

@MrZhengXin MrZhengXin added the bug Something isn't working label Mar 6, 2019
@CyberZHG
Copy link
Owner

CyberZHG commented Mar 6, 2019

There is nothing I can do because the incompatibility happens between Keras and Tensorflow. Keras has a branch named "tf-2" that solves the compatibility problem with Tensorflow 2.0. I don't think you should use a preview version of Tensorflow while Keras has no stable release for it.

@MrZhengXin
Copy link
Author

else: tf.compat.v1.disable_eager_execution() x = tf.compat.v1.placeholder(dtype, shape=shape, name=name)
File "/usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py", line 517
In here I change like this...
For similar error, I have to change it manually.

@MrZhengXin
Copy link
Author

There is nothing I can do because the incompatibility happens between Keras and Tensorflow. Keras has a branch named "tf-2" that solves the compatibility problem with Tensorflow 2.0. I don't think you should use a preview version of Tensorflow while Keras has no stable release for it.

oh, thank you very much

@stale
Copy link

stale bot commented Mar 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 11, 2019
@stale stale bot closed this as completed Mar 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants