firelight package

firelight.config_parsing module

firelight.config_parsing.get_single_key_value_pair(d)[source]

Returns the key and value of a one element dictionary, checking that it actually has only one element

Parameters

d (dict) –

Returns

tuple

firelight.config_parsing.get_visualizer(config, indentation=0)[source]

Parses a yaml configuration file to construct a visualizer.

Parameters
  • config (str or dict or BaseVisualizer) – Either path to yaml configuration file or dictionary (as constructed by loading such a file). If already visualizer, it is just returned.

  • indentation (int, optional) – How far logging messages arising here should be indented.

Returns

BaseVisualizer

firelight.config_parsing.get_visualizer_class(name)[source]

Parses the class of a visualizer from a String. If the name is not found in globals(), tries to import it.

Parameters

name (str) – Name of a visualization class imported above, or dotted path to one (e.g. your custom visualizer in a different library).

Returns

type or None

firelight.inferno_callback module

firelight.inferno_callback.get_visualization_callback(config)[source]

Gets an inferno callback for logging of firelight visualizations.

Uses the inferno.trainers.basic.Trainer state dictionary as input for the visualizers.

The logging frequency is taken from the trainer’s inferno.trainers.callbacks.logging.tensorboard.TensorboardLogger.

Parameters

config (str or dict) –

If str, will be converted to dict using pyyaml.

If dict, the keys are the tags under which the visualizations will be saved in Tensorboard, while the values are the configuration dictionaries to get the visualizers producing these visualizations, using firelight.config_parsing.get_visualizer().

Returns

inferno.trainers.callbacks.base.Callback

Examples

The structure of a configuration file could look like this:

# visualize model predictions
predictions:
    RowVisualizer:
        ...

# visualize something else
fancy_visualization:
    RowVisualizer:
        ...

This configuration would produce images that are saved under the tags predictions and fancy_visualization in Tensorboard.