mahyar-amiri / keras-visualizer

A Keras Model Visualizer
MIT License
25 stars 2 forks source link

unexpected keyword argument 'format' #7

Closed mikeyMike6 closed 1 year ago

mikeyMike6 commented 1 year ago

Running code:

import tensorflow as tf

model = tf.keras.models.Sequential([
    tf.keras.layers.Input((input_layer_size, )),
    tf.keras.layers.Dense(input_layer_size*2, activation='relu'),
    tf.keras.layers.Dense(output_layer_size+1, activation='softmax')
])

from keras import models, layers  
from keras_visualizer import visualizer  

visualizer(model, filename='example1', format='png', view=True)

ends with:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/keras_visualizer/__init__.py in visualizer(model, filename, format, view)
    229         if format is not None:
--> 230             graph.render(format=format, view=view)
    231         else:

TypeError: render() got an unexpected keyword argument 'format'

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
/tmp/ipykernel_17/2998456995.py in <module>
     10 from keras_visualizer import visualizer
     11 
---> 12 visualizer(model, filename='example1', format='png', view=True)

/opt/conda/lib/python3.7/site-packages/keras_visualizer/__init__.py in visualizer(model, filename, format, view)
    232             graph.save()
233     except Exception:

--> 234 raise ValueError('Keras Visualizer: Error while visualizing')

ValueError: Keras Visualizer: Error while visualizing`

which makes visualization impossible

mahyar-amiri commented 1 year ago

Hi, I apologize for the delay in replying.

This error may be due to the graphviz package because your code runs correctly in google colab. Upgrade package to the newest version and run it again.

Thanks for your feedback.