tensorflow / tensorflow/tensorboard

add_graph with .pt and failed with 'dict' object has no attribute 'param_init_net'

Open
#6,720 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.2k
Forks
1.7k
Avg merge
4d 22h
Merged PRs (30d)
1

Description

I run
from torch.utils.tensorboard import SummaryWriter model_path = 'yolov8n-seg.pt' loaded_model = torch.load(model_path) writer = SummaryWriter('tensor_vis') init_img = torch.zeros((1,3,640,640),device='cuda') writer.add_graph(loaded_model) writer.close()

but raise an error:

Traceback (most recent call last):
File "/root/docker_mapping/CYZ/yolov8/demo/demo.py", line 21, in
writer.add_graph(loaded_model)
File "/opt/conda/envs/yolov8/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py", line 742, in add_graph
current_graph = model_to_graph_def(model)
File "/opt/conda/envs/yolov8/lib/python3.8/site-packages/torch/utils/tensorboard/_caffe2_graph.py", line 770, in model_to_graph_def
nets = [model.param_init_net, model.net]
AttributeError: 'dict' object has no attribute 'param_init_net'

why what should I do now

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the provided YOLOv8 .pt loading snippet, then trace SummaryWriter.add_graph in torch/utils/tensorboard/writer.py into torch/utils/tensorboard/_caffe2_graph.py. Determine whether the loaded dictionary is an unsupported input or should be handled, and define done as a clear supported behavior with a regression test or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.