Skip to main content

Atalaya is a logger for pytorch.

Project description


This framework provides a logger for pytorch models, it allows you to save the parameters, the state of the network, the state of the optimizer and allows also to visualize your data using tensorboardX or visdom.


pip install atalaya


Examples are provided in examples directory, where we simply add the logger to an example of a pytorch implemetation (source) in example_1. In each directory you have also the files created by the logger. There is a directory named logs and one named vizualize. The first one contains the logs of each experiment and the second one the files needed to visualize e.g. in tensorboard.


from atalaya import Logger

logger = Logger()

# by default Logger uses tensorboardX as graher
# you can use visdom by changing the default value
logger = Logger(grapher='visdom')


You can add parameters (save directly when addParams is called), you can also load parameters from a previous experiment.

args = parser.parse_args()

# add parameters to the logger

# load from previous experiment
args = logger.restore_parameters(args.path_of_previous_experiment)


You can log information instead of use print, this way you will see the information in terminal and it will also be logged in train.log file for a later consultation."message to log and print", "like in a print")

# you can also use it for warnings

store and restore (models and optimizers)

To save checkpoints and the best model you need to call save method in traning loop. You can choose with wich frequency to save a checkpoint and if we want to overwrite the previous and keep always the last saved.

# before store, you need to add to the logger all you want to store using the logger.add('name', object) method

logger.add('model', model)
logger.add('optimizer', optimizer)

# and in the training loop
for epoch in epochs:
    # pay attention it is really recommended to keep overwrite=True
    # if not you may have memory problems, because you will save your model at 
    # each epoch., val_loss, save_every=1, overwrite=True)

And after the training you can load the best model and test it or before training you can load from a previous experience.



This logger as a wrapper to tensorboardX and visdom. It allows you to better visualize your experiments. By default, for visdom, the server is localhost and the port is 8097. You can change them if you want when you intitialize the Logger.

# to add a scalar
logger.add_scalar('my_scalar', value, epoch)

# to add many scalars in a dictionary
values = {'mse_scalar':123.45, 'kl_scalar':32.33}
logger.register_plots(values, epoch, prefix='train')
# or to add list of scalars wit apply_mean argument
values = {'mse':[123.4, ..., 234.5], 'kl':[345.4, ..., 456.5]}
logger.register_plots(values, epoch, prefix='train', apply_mean=True)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atalaya- (12.3 kB view hashes)

Uploaded source

Built Distribution

atalaya- (12.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page