Closed JuggernautPanda closed 2 years ago
I tried the fix by changing the _layers to layers.
I get a new issue:
/usr/local/lib/python3.7/dist-packages/visualkeras/layer_utils.py in model_to_adj_matrix(model) 55 src = id_to_num_mapping[inbound_layer_id] 56 tgt = id_to_num_mapping[layer_id] ---> 57 adj_matrix[src, tgt] += 1 58 59 return id_to_num_mapping, adj_matrix
IndexError: index 12 is out of bounds for axis 1 with size 12
Stale issue message
What tensorflow version are you using? Sounds like an older one. _layers
contains layers that tensorflow implicitly adds, so I'd assume that when you forgot to change it somewhere.
What tensorflow version are you using? Sounds like an older one.
_layers
contains layers that tensorflow implicitly adds, so I'd assume that when you forgot to change it somewhere.
Hey- I'm having the same 'Sequential' object has no attribute '_layers'
issue. I'm using tensorflow 2.7. Any idea what it might be?
Changing _layers
to layers
returns a similar error:
/usr/local/lib/python3.7/dist-packages/visualkeras/layer_utils.py in model_to_adj_matrix(model)
55 src = id_to_num_mapping[inbound_layer_id]
56 tgt = id_to_num_mapping[layer_id]
---> 57 adj_matrix[src, tgt] += 1
58
59 return id_to_num_mapping, adj_matrix
IndexError: index 4 is out of bounds for axis 1 with size 4
This is a great library- looks amazing, but it would be a shame if the graph view doesn't work- I'm not a very experienced programmer but if there is any way I can help please let me know.
@alessiogmonti I will take a look at this, but due to the upcoming CVPR deadline it will take a while. It looks like the _layers
attribute has been abandoned and seems to have been replaced by _self_tracked_trackables
in recent tensorflow versions. Could you try changing it? Also, does the bug only affect graph_view
or also layered_view
?
@paulgavrikov replacing _layers
with _self_tracked_trackables
works great- thank you! It runs just fine now. This bug only affects graph_view
.
@alessiogmonti awesome. Would you like to try and create a PR that fixes this? You could check if the passed model has the _layers arg and fallback to the other solution if not. Ideally, we’d also integrate a test into Travis CI
@paulgavrikov Absolutely- I'll do this today.
@alessiogmonti awesome. Would you like to try and create a PR that fixes this? You could check if the passed model has the _layers arg and fallback to the other solution if not. Ideally, we’d also integrate a test into Travis CI
Any updates on this, is it fixed? I am getting below error
Hey, for now you can use this. It will try to use _layers and fall back to _self_tracked_trackables when necessary:
!pip install git+https://github.com/alessiogmonti/visualkeras
The PR has been merged into the master branch.
@jainakhil88 Your issue is related to something else. It looks like you are not passing a valid Keras model to visualkeras. Are you sure MaskRCNN
is not wrapping the actual model?
Stale issue message
import visualkeras model.build() visualkeras.layered_view(model, legend=True, to_file='output.png').show() # write and show visualkeras.graph_view(model,show_neurons=True, to_file='graph.png').show()
AttributeError Traceback (most recent call last)