Open OrdinaryChen opened 10 months ago
this is code
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,init_img ) writer.close()
Hi @OrdinaryChen,
This is seems to be an issue either within PyTorch library or related to how the PyTorch API is being used. Can you please move the question to https://github.com/pytorch/pytorch/issues?
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