super_gradients.common.environment package

Submodules

super_gradients.common.environment.env_helpers module

class super_gradients.common.environment.env_helpers.TerminalColours[source]

Bases: object

Usage: https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-python?page=1&tab=votes#tab-top

HEADER = '\x1b[95m'
OKBLUE = '\x1b[94m'
OKCYAN = '\x1b[96m'
OKGREEN = '\x1b[92m'
WARNING = '\x1b[93m'
FAIL = '\x1b[91m'
ENDC = '\x1b[0m'
BOLD = '\x1b[1m'
UNDERLINE = '\x1b[4m'
class super_gradients.common.environment.env_helpers.ColouredTextFormatter[source]

Bases: object

static print_coloured_text(text: str, colour: str)[source]

Prints a text with colour ascii characters.

super_gradients.common.environment.env_helpers.get_environ_as_type(environment_variable_name: str, default=None, cast_to_type: type = <class 'str'>)object[source]

Tries to get an environment variable and cast it into a requested type. :return: cast_to_type object, or None if failed. :raises ValueError: If the value could not be casted into type ‘cast_to_type’

super_gradients.common.environment.env_helpers.init_trainer()[source]

a function to initialize the super_gradients environment. This function should be the first thing to be called by any code running super_gradients. It resolves conflicts between the different tools, packages and environments used and prepares the super_gradients environment.

super_gradients.common.environment.env_helpers.is_distributed()bool[source]
super_gradients.common.environment.env_helpers.multi_process_safe(func)[source]

A decorator for making sure a function runs only in main process. If not in DDP mode (local_rank = -1), the function will run. If in DDP mode, the function will run only in the main process (local_rank = 0) This works only for functions with no return value

super_gradients.common.environment.environment_config module

Module contents

This module is in charge of environment variables and consts.

super_gradients.common.environment.init_trainer()[source]

a function to initialize the super_gradients environment. This function should be the first thing to be called by any code running super_gradients. It resolves conflicts between the different tools, packages and environments used and prepares the super_gradients environment.

super_gradients.common.environment.is_distributed()bool[source]