Catalyst
Learn how to log Catalyst runs to Neptune.

What will you get with this integration?

Catalyst is a PyTorch framework for Deep Learning R&D. It is built with three main requirements in mind: reproducibility, rapid experimentation, and codebase reuse. Catalyst is a part of the PyTorch Ecosystem.
Neptune is integrated with Catalyst, so that you can automatically log:
    metrics,
    hparams (hyper-parameters),
    images,
    artifacts (videos, audio, model checkpoints, files, etc.),
    hardware consumption statistics,
    stdout and stderr logs,
    training code and git commit information.

TL;DR for the Catalyst users

This section is for Catalyst users who are familiar with loggers, like CSV logger or TensorBoard logger. If you haven't worked with Catalyst loggers before, jump to the "Where to start?" section below.
Catalyst has a unified way of logging metadata, by using Loggers. NeptuneLogger is part of the Catalyst library.
So all you need to do to start logging is to create NeptuneLogger and pass it to the runner:

Create NeptuneLogger instance

1
from catalyst import dl
2
3
# Create NeptuneLogger
4
neptune_logger = dl.NeptuneLogger(
5
project="common/catalyst-integration",
6
tags=["pretraining", "retina"],
7
)
Copied!
You need to pass project to NeptuneLogger(), to inform logger where to log the metadata. There are more parameters to customize logger behavior, check Catalyst docs for more details.

Pass neptune_logger to the Runner

Now, you can add neptune_logger to the runner, like any other Catalyst logger:
1
# You can pass it to the SupervisedRunner
2
my_runner = dl.SupervisedRunner()
3
4
my_runner.train(
5
loggers={"neptune": neptune_logger},
6
...
7
)
8
9
# You can pass it to the custom Runner
10
class CustomRunner(dl.IRunner):
11
...
12
def get_loggers(self):
13
return {
14
"console": dl.ConsoleLogger(),
15
"neptune": neptune_logger
16
}
17
18
runner = CustomRunner().run()
Copied!

NeptuneLogger is now ready

Setup of the NeptuneLogger is done. You can run your scripts without additional changes and have all metadata logged in the single place for further analysis, comparison and sharing in the team.

Where to start?

To get started with this integration, follow the quickstart below.
If you want to try it out now you can either:

Quickstart

This quickstart will show you how to:
    Install required libraries,
    Connect NeptuneLogger to your Catalyst script to enable automatic logging,
    Analyse logged metadata and compare some runs.
At the end of this quickstart, you will be able to connect NeptuneLogger to your ML/RL scripts and use it in your experimentation.

Step 1: Install libraries

Before you start, make sure that:

Install neptune-client and catalyst

Depending on your operating system open a terminal or CMD and run this command:
1
pip install neptune-client catalyst
Copied!
This integration is tested with catalyst==21.5 and neptune-client==0.9.16.
For more help see installing neptune-client.

Install psutil (optional)

If you want to have hardware monitoring logged you should additionally install psutil.
pip
conda
1
pip install psutil
Copied!
1
conda install -c anaconda psutil
Copied!

Step 2: Add NeptuneLogger to the Catalyst script

Catalyst has a unified way of logging metadata, by using Loggers. Neptune contributed NeptuneLogger which is now part of the Catalyst library.
So all you need to do to start logging is to create NeptuneLogger and pass it to the runner:

Create NeptuneLogger instance

1
from catalyst import dl
2
3
# Create NeptuneLogger
4
neptune_logger = dl.NeptuneLogger(
5
project="common/catalyst-integration",
6
)
Copied!
You need to pass project to NeptuneLogger(), to inform it where to log metadata. There are more parameters to customize logger behavior, check Catalyst docs for more details.
Once NeptuneLogger is created it will output a link to the run to the stdout. It will look like this: https://app.neptune.ai/common/catalyst-integration/e/CATALYST-1486

Pass neptune_logger to the Runner

Now, you can add neptune_logger to the Runner. The example below uses SupervisedRunner as an example:
1
from catalyst import dl
2
3
# Create runner
4
my_runner = dl.SupervisedRunner()
5
6
my_runner.train(
7
loggers={"neptune": neptune_logger},
8
...
9
)
Copied!
At this point neptune_logger is ready.
Remember that you can check the entire example:

Step 3: Run the script and analyze logged metadata in the Neptune UI

NeptuneLogger instance is ready. Run your script and have all metadata logged in the single place for further analysis, comparison, and sharing in the team.
1
python main.py
Copied!
Go to the run link and explore metadata (metrics, hparams, model checkpoint) that were logged. Example run: https://app.neptune.ai/common/catalyst-integration/e/CATALYST-1486
Example run

How to ask for help?

Please visit the Getting help page. Everything regarding support is there:

Other pages you may like

You may also find the following pages useful:
Last modified 1mo ago