API reference: PyTorch Ignite integration#
NeptuneLogger class provided by the PyTorch Ignite library captures metadata that is generated when training and validating models with Ignite.
Creates a Neptune handler to log metrics, model and optimizer parameters, and gradients during the training and validation. It can also log model checkpoints to Neptune.
||User's Neptune API token. If
To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.
||Name of a project in the form
||-||Additional keyword arguments to be passed directly to the
If you have your Neptune credentials saved as environment variables, the following starts the Neptune logger with default settings:
You can also pass more options to the run created by the logger:
The full project name. For example,
To copy it, navigate to the project settings in the top-right () and select Edit project details.
To log metadata to the Neptune run, access the
neptune_logger.experiment attribute. You can then use any logging methods from the Neptune client library to track your metadata, such as
Handler that saves an input checkpoint to the Neptune server.
NeptuneSaver is currently not supported on Windows.
||-||An instance of the
Set up the logger:
Pass the Neptune logger to the saver:
from ignite.handlers import Checkpoint handler = Checkpoint( to_save, NeptuneSaver(neptune_logger), n_saved=2, filename_prefix="best", score_function=score_function, score_name="validation_accuracy", global_step_transform=global_step_from_engine(trainer), ) evaluator.add_event_handler(Events.COMPLETED, handler)
Close the logger when done:
You can access example checkpoints and download them from this example run.
NeptuneLogger reference in Ignite API docs