savvihub.log
Use savvihub.log in a training or testing loop to log a dictionary of metrics. Provide the step parameter for the loop unit (normally the epoch value) and any metrics you want to log as a dictionary in the row parameter.
You can also use savvihub.log to log image objects. Provide a list of savvihub.Image objects with image data and captions as the row parameter with any dictionary key. Note that only the first key will be logged.
Parameter
Description
step
Unit size of the loop
row
Dictionary of metrics or a list of savvihub.Image objects

Examples

Logging metrics

1
# Logging loss values for each epoch in PyTorch
2
3
import savvihub
4
5
for epoch in range(0, epochs):
6
...
7
savvihub.log(step=epoch, row={'loss': loss.item})
Copied!

Logging image objects

1
# Logging images in PyTorch
2
3
import savvihub
4
5
def test(model, test_loader, ...):
6
...
7
test_images = []
8
with torch.no_grad():
9
for data, target in test_loader:
10
...
11
output = model(data)
12
...
13
test_images.append(
14
savvihub.Image(
15
data[0],
16
caption=f'Pred: {output[0].item()} Truth: {target[0]}'
17
)
18
)
19
...
20
savvihub.log(row={"test-images": test_images})
Copied!
You can find a complete example using PyTorch in our GitHub repository.
Last modified 2mo ago
Copy link
Contents
Examples