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

plot_model() got an unexpected keyword argument 'show_layer_activations' #59166

Closed
kaushalkrishna2000 opened this issue Jan 8, 2023 · 8 comments
Assignees
Labels
2.6.0 comp:keras Keras related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author type:bug Bug

Comments

@kaushalkrishna2000
Copy link

kaushalkrishna2000 commented Jan 8, 2023

Click to expand!

Issue Type

Bug

Have you reproduced the bug with TF nightly?

No

Source

source

Tensorflow Version

2.6.4

Custom Code

No

OS Platform and Distribution

Linux

Mobile device

No response

Python version

3.7.12

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

plot_model not working according to the documentation mentioned. In Jupyer Notebook of Kaggle.

Standalone code to reproduce the issue

n=3
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense,Dropout,Input
from tensorflow.keras.callbacks import EarlyStopping

e=EarlyStopping(patience=9,restore_best_weights=True,verbose=1)

model=Sequential()

#Input Layer
model.add(Input(shape=(X_train.shape[1],)))

#Hidden Layer
for counter in range(1,n+1):
    model.add(Dense(n*X_train.shape[1],activation='relu'))
#     if(counter%4==0):
#         model.add(Dropout(0.75))

#Output Layer
model.add(Dense(1))

model.compile(loss='mean_squared_error',
              optimizer='adam',
              metrics = ['mean_absolute_error',tf.keras.metrics.RootMeanSquaredError()])

model. Summary()

# from tensorflow.keras.utils import plot_model
tf.keras.utils.plot_model(model, to_file='model.png',show_shapes=True,show_dtype=True,show_layer_activations=True,show_layer_names=True,rankdir='LR')

Relevant log output

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_23/976071416.py in <module>
      1 # from tensorflow.keras.utils import plot_model
----> 2 tf.keras.utils.plot_model(model, to_file='model.png',show_shapes=True,show_dtype=True,show_layer_activations=True,show_layer_names=True,rankdir='LR')

TypeError: plot_model() got an unexpected keyword argument 'show_layer_activations'
@google-ml-butler google-ml-butler bot added the type:bug Bug label Jan 8, 2023
@mohantym mohantym added 2.6.0 comp:keras Keras related issues labels Jan 8, 2023
@mohantym
Copy link
Contributor

mohantym commented Jan 8, 2023

Hi @kaushalkrishna2000 !

Thanks for sharing your observation of plot_model w.r.to 2.6 version.
Could you check against 2.9/2.11 and let us know.

Thank you!

@mohantym mohantym added the stat:awaiting response Status - Awaiting response from author label Jan 8, 2023
@kaushalkrishna2000
Copy link
Author

Its working in 2.9 ( will check 2.11 in sometime ).
There is a difference in which the image is presented.

2.9
image

2.6
image

Is it possible to make it the same size of 2.6 ?

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Jan 8, 2023
@kaushalkrishna2000
Copy link
Author

2.11

image

@kaushalkrishna2000
Copy link
Author

kaushalkrishna2000 commented Jan 8, 2023

`n=3
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense,Dropout,Input
from tensorflow.keras.callbacks import EarlyStopping

e=EarlyStopping(patience=9,restore_best_weights=True,verbose=1)

model=Sequential()

#Input Layer
model.add(Input(shape=(24,)))

#Hidden Layer
for counter in range(1,n+1):
model.add(Dense(n*24,activation='relu'))
#if(counter%4==0):
#model.add(Dropout(0.75))

#Output Layer
model.add(Dense(1))

model.compile(loss='mean_squared_error',
optimizer='adam',
metrics = ['mean_absolute_error',tf.keras.metrics.RootMeanSquaredError()])

model. summary()

tf.keras.utils.plot_model(model, to_file='model.png',rankdir='TB',show_layer_activations=True,
show_shapes=True,show_layer_names=True,show_dtype=True)`

You can try above code to reproduce the above pics.

@mohantym
Copy link
Contributor

mohantym commented Jan 9, 2023

Hi @kaushalkrishna2000 !

I am getting type error mentioned in template for 2.6.3.
Shapes seems to be same for 2.9 and 2.11.

Could you consider this resolved in 2.11 (as a lot of bugs has been fixed in version after 2.9)

Please post this issue on keras-team/keras repo for further assistance.
To know more see;
https://discuss.tensorflow.org/t/keras-project-moved-to-new-repository-in-https-github-com-keras-team-keras/1999 .

Thank you!

@mohantym mohantym added the stat:awaiting response Status - Awaiting response from author label Jan 9, 2023
@google-ml-butler
Copy link

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

@google-ml-butler google-ml-butler bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Jan 16, 2023
@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

@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
2.6.0 comp:keras Keras related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author type:bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants