Pydot won't output models in Anaconda-Jup NoteBook

194 Views Asked by At

I have already looked through and tried all the solutions on Stackoverflow, however they still don't work for me. I've installed pydot, graphviz, and pydotplus already, and I still get this error while trying to generate a model:

   'ImportError                               Traceback (most recent call 
     last)
    <ipython-input-80-1ebf31238a67> in <module>()
  99 # summarize defined model
 100 print(model.summary())
 --> 101 plot_model(model, to_file='model.png', show_shapes=True)

 ~\Anaconda3\lib\site-packages\keras\utils\vis_utils.py in plot_model(model, 
 to_file, show_shapes, show_layer_names, rankdir)
130             'LR' creates a horizontal plot.
131     """
--> 132     dot = model_to_dot(model, show_shapes, show_layer_names, 
 rankdir)
133     _, extension = os.path.splitext(to_file)
134     if not extension:

 ~\Anaconda3\lib\site-packages\keras\utils\vis_utils.py in 
 model_to_dot(model, show_shapes, show_layer_names, rankdir)
 53     from ..models import Sequential
 54 
 ---> 55     _check_pydot()
 56     dot = pydot.Dot()
 57     dot.set('rankdir', rankdir)

 ~\Anaconda3\lib\site-packages\keras\utils\vis_utils.py in _check_pydot()
 18     if pydot is None:
 19         raise ImportError(
 ---> 20             'Failed to import `pydot`. '
 21             'Please install `pydot`. '
 22             'For example with `pip install pydot`.')

  ImportError: Failed to import `pydot`. Please install `pydot`. For example 
    with `pip install pydot`.

Here is my Code, the model summary prints, but not the model itself:

model = define_model(khm_vocab_size, eng_vocab_size, khm_length, eng_length, 
  256)
  model.compile(optimizer='adam', loss='categorical_crossentropy')
  # summarize defined model
    print(model.summary())
  plot_model(model, to_file='model.png', show_shapes=True)
# fit model
filename = 'model.h5'
checkpoint = ModelCheckpoint(filename, monitor='val_loss', verbose=1, 
save_best_only=True, mode='min')
model.fit(trainX, trainY, epochs=30, batch_size=64, validation_data=(testX, 
testY), callbacks=[checkpoint], verbose=2)
0

There are 0 best solutions below