stevedas / aiBook

1 stars 8 forks source link

Missing code #1

Open SavioBraganza opened 2 years ago

SavioBraganza commented 2 years ago

Chapter 2 code listing is missing the code that displays the structure of the model from the book:

from tensorflow.keras.utils import plot_model plot_model(model, to_file = 'model_plot1.png', show_shapes = True, show_layer_names = True)

miguelgraca1975 commented 10 months ago

I'm getting the following error although I installed all the modules: "Traceback (most recent call last): File "/Users/miguel/Documents/Python/aiBook/chapter2/chapter2.py", line 115, in plot_model(model, to_file='model_plot1.png', show_shapes=True, show_layer_names=True) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/keras/src/utils/vis_utils.py", line 464, in plot_model raise ImportError(message) ImportError: You must install pydot (pip install pydot) and install graphviz (see instructions at https://graphviz.gitlab.io/download/) for plot_model to work."

How can I make it work ?

stevedas commented 10 months ago

Hello,Which IDE are you using ? Jupiter notebook  or another?

On Sunday, January 14, 2024 at 03:03:37 PM EST, miguelgraca1975 ***@***.***> wrote:  

I'm getting the following error although I installed all the modules: "Traceback (most recent call last): File "/Users/miguel/Documents/Python/aiBook/chapter2/chapter2.py", line 115, in plot_model(model, to_file='model_plot1.png', show_shapes=True, show_layer_names=True) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/keras/src/utils/vis_utils.py", line 464, in plot_model raise ImportError(message) ImportError: You must install pydot (pip install pydot) and install graphviz (see instructions at https://graphviz.gitlab.io/download/) for plot_model to work."

How can I make it work ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

miguelgraca1975 commented 10 months ago

Hello, I'm using Visual Studio Code.

stevedas commented 9 months ago

Hello, Thanks for the email, Please use the email provided in the text to ask questions in the future, thanks.. Ahhhh, I see the issue now. You are receiving the following error: ImportError: You must install pydot (pip install pydot) and install graphviz (see instructions at https://graphviz.gitlab.io/download/) for plot_model to work."

The reason for this is that you need to install Pydot and graphviz to Visual Studio. In the text I recommended using Jupyter notebook / and or google golab I believe (please check) since you do not need to install these libraries to your computer if you use the recommended IDE (s). The text was really written as an introductory book where the reader is recommended to use the IDEs I mentioned. In order for you to use the code in Visual studio you need to install the libraries mentioned in the error to your visual studio. SInce I do not use visual studio, I do not know how to install them off hand. Try running the code in the IDE recommended for that chapter (I believe it's jupyter). Or research how to install those libraries to Visual studio. Please let me know how you make out. Thanks