Skip to content

CycleGan error 'ListWrapper' object has no attribute 'name' #58

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

Open
thephet opened this issue May 1, 2020 · 4 comments
Open

CycleGan error 'ListWrapper' object has no attribute 'name' #58

thephet opened this issue May 1, 2020 · 4 comments

Comments

@thephet
Copy link

thephet commented May 1, 2020

When executing the line that creates the GAN, I receive the following error:


AttributeError Traceback (most recent call last)
in
12
13 if mode == 'build':
---> 14 gan.save(RUN_FOLDER)
15 else:
16 gan.load_weights(os.path.join(RUN_FOLDER, 'weights/weights.h5'))

~/Projects/GDL_code/models/cycleGAN.py in save(self, folder)
410 ], f)
411
--> 412 self.plot_model(folder)
413
414

~/Projects/GDL_code/models/cycleGAN.py in plot_model(self, run_folder)
388
389 def plot_model(self, run_folder):
--> 390 plot_model(self.combined, to_file=os.path.join(run_folder ,'viz/combined.png'), show_shapes = True, show_layer_names = True)
391 plot_model(self.d_A, to_file=os.path.join(run_folder ,'viz/d_A.png'), show_shapes = True, show_layer_names = True)
392 plot_model(self.d_B, to_file=os.path.join(run_folder ,'viz/d_B.png'), show_shapes = True, show_layer_names = True)

/usr/lib/python3.8/site-packages/tensorflow/python/keras/utils/vis_utils.py in plot_model(model, to_file, show_shapes, show_layer_names, rankdir, expand_nested, dpi)
276 This enables in-line display of the model plots in notebooks.
277 """
--> 278 dot = model_to_dot(model,
279 show_shapes=show_shapes,
280 show_layer_names=show_layer_names,

/usr/lib/python3.8/site-packages/tensorflow/python/keras/utils/vis_utils.py in model_to_dot(model, show_shapes, show_layer_names, rankdir, expand_nested, dpi, subgraph)
141
142 # Append a wrapped layer's label to node's label, if it exists.
--> 143 layer_name = layer.name
144 class_name = layer.class.name
145

AttributeError: 'ListWrapper' object has no attribute 'name'

@saleems11
Copy link

hello, I have the same issue, found a solution?

@berndcklein
Copy link

berndcklein commented Aug 6, 2021

Same problem with me!

This line is causing the error:
plot_model(model, to_file=os.path.join(run_folder ,'viz/model.png'), show_shapes = True, show_layer_names = True)

@thephet
Copy link
Author

thephet commented Aug 6, 2021

Check this pull request I sent, and I think you can easily solve it:

#59

@berndcklein
Copy link

berndcklein commented Aug 6, 2021

First of all, thank you very much.
Unfortunately, it didn't help. My exception is raised in the 07_02_lstm_compose_train.ipynb notebook.

This is the complete message:

AttributeError Traceback (most recent call last)
in
1 #Currently errors in TF2.2
----> 2 plot_model(model, to_file=os.path.join(run_folder ,'viz/model.png'), show_shapes = True, show_layer_names = True)

~/anaconda3/envs/python36/lib/python3.6/site-packages/tensorflow/python/keras/utils/vis_utils.py in plot_model(model, to_file, show_shapes, show_layer_names, rankdir, expand_nested, dpi)
281 rankdir=rankdir,
282 expand_nested=expand_nested,
--> 283 dpi=dpi)
284 if dot is None:
285 return

~/anaconda3/envs/python36/lib/python3.6/site-packages/tensorflow/python/keras/utils/vis_utils.py in model_to_dot(model, show_shapes, show_layer_names, rankdir, expand_nested, dpi, subgraph)
141
142 # Append a wrapped layer's label to node's label, if it exists.
--> 143 layer_name = layer.name
144 class_name = layer.class.name
145

AttributeError: 'ListWrapper' object has no attribute 'name'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants