-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
Vlad Velici edited this page Jan 12, 2020
·
1 revision
This is a quick start guide to using the dbxlogger and dbx command line tool.
Install using pip directly from source:
pip install git+git://github.com/vladvelici/dbxlogger.git
import dbxlogger
from dbxlogger import Exp
exp = Exp(kind="hello", repo=dbxlogger.get_repo("./output"))
# save the experiment to the repo
exp.save()
logger = exp.logger()
# log something
logger.log("event_name", {"some": "data"})
# or use the shortcut
logger("event_name", {"some": "data"})
Log events can be logically grouped by name. For instance, one can use a naming schema like epoch/<epoch_num>/start
, epoch/<epoch_num>/end
, epoch/<epoch_num>/train
, epoch/<epoch_num>/validation
and so on.
This enables us to easily see which events belong to which epoch and query the log accordingly.
Using a naming scheme like this is common. In fact, this is what dbxlogger uses for the torchbearer integration.
Implementing this can be done in a few ways:
# logger is the logger object
for epoch in logger.iter_at(range(max_epochs), lambda epoch: "epoch/%d" % epoch):
logger.log("start", {})
# logs:
# {"event": "epoch/0/start"}
# {"event": "epoch/1/start"}
# {"event": "epoch/2/start"}
# ...
# {"event": "epoch/[max_epochs-1]/start"}
Or you can do this in a more manual way:
for epoch in range(max_epochs):
logger.ctx.path = "epoch/%d" % epoch
logger.log("start", {}) # logs the same thing as before