Hi guys, I tried Pytorch Profiler with Tensorboard tutorial, but when I launch tensorboard, the terminal gives the following output:
…
W0222 11:06:25.349957 139955019081472 event_parser.py:80] 1 Runtime with external id 16841 don’t correlate to any operator!
W0222 11:06:25.349983 139955019081472 event_parser.py:80] 1 Runtime with external id 16842 don’t correlate to any operator!
W0222 11:06:25.350009 139955019081472 event_parser.py:80] 1 Runtime with external id 16843 don’t correlate to any operator!
W0222 11:06:25.350035 139955019081472 event_parser.py:80] 1 Runtime with external id 16844 don’t correlate to any operator!
W0222 11:06:25.350062 139955019081472 event_parser.py:80] 1 Runtime with external id 16845 don’t correlate to any operator!
W0222 11:06:25.350090 139955019081472 event_parser.py:80] 1 Runtime with external id 16846 don’t correlate to any operator!
W0222 11:06:25.350117 139955019081472 event_parser.py:80] 1 Runtime with external id 16847 don’t correlate to any operator!
W0222 11:06:25.350143 139955019081472 event_parser.py:80] 1 Runtime with external id 16848 don’t correlate to any operator!
I0222 11:06:25.475616 139955019081472 plugin.py:373] Run resnet18 loaded
I0222 11:06:25.476129 139955027474176 plugin.py:343] Add run resnet18
and tensorboard:
My code:
import torch
import torch.nn
import torch.optim
import torch.profiler
import torch.utils.data
import torchvision.datasets
import torchvision.models
import torchvision.transforms as T
transform = T.Compose(
[T.Resize(224),
T.ToTensor(),
T.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
train_set = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform)
train_loader = torch.utils.data.DataLoader(train_set, batch_size=32, shuffle=True)
device = torch.device("cuda:7")
model = torchvision.models.resnet18(pretrained=True).cuda(device)
criterion = torch.nn.CrossEntropyLoss().cuda(device)
optimizer = torch.optim.SGD(model.parameters(), lr=0.001, momentum=0.9)
model.train()
def train(data):
inputs, labels = data[0].to(device=device), data[1].to(device=device)
outputs = model(inputs)
loss = criterion(outputs, labels)
optimizer.zero_grad()
loss.backward()
optimizer.step()
with torch.profiler.profile(
schedule=torch.profiler.schedule(wait=1, warmup=1, active=3, repeat=2),
on_trace_ready=torch.profiler.tensorboard_trace_handler('./log/resnet18'),
record_shapes=True,
profile_memory=True,
with_stack=True
) as prof:
for step, batch_data in enumerate(train_loader):
if step >= (1 + 1 + 3) * 2:
break
train(batch_data)
prof.step() # Need to call this at the end of each step to notify profiler of steps' boundary.
I am using PyTorch 1.10.2, tensorboard 2.6.0 and torch-tb-profiler 0.2.1.
I would be grateful if anyone can give me some suggestions. Thanks!