-
Notifications
You must be signed in to change notification settings - Fork 138
Closed
Labels
status:awaiting user responseThis label needs to be added to stale issues and PRs.This label needs to be added to stale issues and PRs.status:staleStale management add this label for inactive PRs and issues.Stale management add this label for inactive PRs and issues.type:supportFor use-related issuesFor use-related issues
Description
Hello,
I am trying to run your graph visualization on the vision transformer from the CoCa model.
Here is the code I run and the full traceback I get.
Code
model,_, processor = open_clip.create_model_and_transforms(
model_name="coca_ViT-L-14",
pretrained="mscoco_finetuned_laion2B-s13B-b90k",
device=device)
inputs = (torch.rand([1, 3, 224, 224]),)
ep = torch.export.export(model.visual, inputs)
model_explorer.visualize_pytorch('visionnet', exported_program=ep,
port=8081)
Traceback
Converting pytorch model to model explorer graphs...
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[24], line 1
----> 1 model_explorer.visualize_pytorch('visionnet', exported_program=ep,
2 port=8081)
File /opt/conda/lib/python3.10/site-packages/model_explorer/apis.py:82, in visualize_pytorch(name, exported_program, host, port, extensions, colab_height, settings)
80 # Construct config.
81 cur_config = config()
---> 82 cur_config.add_model_from_pytorch(
83 name, exported_program=exported_program, settings=settings
84 )
86 # Start server.
87 server.start(
88 host=host, port=port, config=cur_config, colab_height=colab_height, extensions=extensions
89 )
File /opt/conda/lib/python3.10/site-packages/model_explorer/config.py:85, in ModelExplorerConfig.add_model_from_pytorch(self, name, exported_program, settings)
83 print('Converting pytorch model to model explorer graphs...')
84 adapter = PytorchExportedProgramAdapterImpl(exported_program, settings)
---> 85 graphs = adapter.convert()
86 graphs_index = len(self.graphs_list)
87 self.graphs_list.append(graphs)
File /opt/conda/lib/python3.10/site-packages/model_explorer/pytorch_exported_program_adater_impl.py:237, in PytorchExportedProgramAdapterImpl.convert(self)
236 def convert(self) -> ModelExplorerGraphs:
--> 237 return {'graphs': [self.create_graph()]}
File /opt/conda/lib/python3.10/site-packages/model_explorer/pytorch_exported_program_adater_impl.py:233, in PytorchExportedProgramAdapterImpl.create_graph(self)
231 graph = Graph(id='graph', nodes=[])
232 for node in self.gm.graph.nodes:
--> 233 graph.nodes.append(self.create_node(node))
234 return graph
File /opt/conda/lib/python3.10/site-packages/model_explorer/pytorch_exported_program_adater_impl.py:227, in PytorchExportedProgramAdapterImpl.create_node(self, fx_node)
225 self.add_incoming_edges(fx_node, node)
226 self.add_node_attrs(fx_node, node)
--> 227 self.add_outputs_metadata(fx_node, node)
228 return node
File /opt/conda/lib/python3.10/site-packages/model_explorer/pytorch_exported_program_adater_impl.py:200, in PytorchExportedProgramAdapterImpl.add_outputs_metadata(self, fx_node, node)
198 if val is None:
199 continue
--> 200 dtype = str(val.dtype)
201 shape = json.dumps(val.shape)
202 metadata.attrs.append(KeyValue(key='tensor_shape', value=dtype + shape))
AttributeError: 'int' object has no attribute 'dtype'
Any help appreciated,
Thanks,
Mathieu
Metadata
Metadata
Assignees
Labels
status:awaiting user responseThis label needs to be added to stale issues and PRs.This label needs to be added to stale issues and PRs.status:staleStale management add this label for inactive PRs and issues.Stale management add this label for inactive PRs and issues.type:supportFor use-related issuesFor use-related issues