Skip to content

Debugging options#

You can debug your code by adjusting the connection mode in which Neptune is working.

You can set the mode either through an environment variable (NEPTUNE_MODE) or through the mode argument when initializing a Neptune object.

Related

For details, see Connnection modes reference.

Using Neptune in debug mode#

Debug mode essentially turns off all the Neptune-related logging.

You can use Neptune as a mock object for testing purposes by initializing a run in debug mode.

Run
import neptune

run = neptune.init_run(mode="debug")
...

Setting debug mode in integrations#

If you're using Neptune as part of an integration with another framework, you have largely the same options for setting the logging mode:

  • Set the NEPTUNE_MODE environment variable to a value of "debug".
  • Alternatively, you can set mode="debug" wherever you can pass custom initialization arguments to the Neptune callback or logger. This is indicated by the **neptune_run_kwargs parameter in the function definition.

    For example:

    from pytorch_lightning.loggers import NeptuneLogger
    
    neptune_logger = NeptuneLogger(mode="debug") # (1)!
    ...
    
    1. Normally you could pass other neptune.init_run() arguments here, such as name, description, or tags.

    For callbacks that take a Neptune run as an argument, you can pass a run that's been initialized in debug mode:

    import neptune
    from neptune.integrations.tensorflow_keras import NeptuneCallback
    
    debug_run = neptune.init_run(mode="debug")
    neptune_callback = NeptuneCallback(run=debug_run)
    
    model.fit(
        ...
        callbacks=[neptune_callback],
    )
    

Using Neptune in synchronous mode#

In synchronous mode, tracking methods throw exceptions in case of issues related to connectivity or the consistency of an object's local representation.

If there's an issue with your code but you're not sure where, synchronous mode can help you locate the problematic part.

Note

This mode may slow down your logging.

import neptune

run = neptune.init_run(mode="sync")
...

Getting help