Common package

super_gradients.common.explicit_params_validation(function: Optional[Callable] = None, validation_type: str = 'None')[source]
super_gradients.common.singleton(cls)[source]

A singleton decorator. Returns a wrapper objects. A call on that object returns a single instance object of decorated class. Use the __wrapped__ attribute to access decorated class directly in unit tests

class super_gradients.common.AWSConnector[source]

Bases: object

AWSConnector - Connects to AWS using Credentials File or IAM Role

static get_aws_session(profile_name: str)boto3.session.Session[source]
get_aws_session - Connects to AWS to retrieve an AWS Session
param profile_name

The Config Profile (Environment Name in Credentials file)

return

boto3 Session

static get_aws_client_for_service_name(profile_name: str, service_name: str)boto3.session.Session.client[source]
get_aws_client_for_service_name - Connects to AWS to retrieve the relevant Client
param profile_name

The Config Profile (Environment Name in Credentials file)

param service_name

The AWS Service name to get the Client for

return

Service client instance

static get_aws_resource_for_service_name(profile_name: str, service_name: str)boto3.session.Session.resource[source]
Connects to AWS to retrieve the relevant Resource (More functionality then Client)
param profile_name

The Config Profile (Environment Name in Credentials file)

param service_name

The AWS Service name to get the Client for

return

Service client instance

static is_client_error(code)[source]
class super_gradients.common.DatasetDataInterface(env: str, data_connection_source: str = 's3')[source]

Bases: object

load_remote_dataset_file()
class super_gradients.common.ADNNModelRepositoryDataInterfaces(data_connection_location: str = 'local', data_connection_credentials: Optional[str] = None)[source]

Bases: super_gradients.common.abstractions.abstract_logger.ILogger

ResearchModelRepositoryDataInterface

load_all_remote_log_files()
save_all_remote_checkpoint_files()
load_remote_checkpoints_file()
load_remote_logging_files()
save_remote_checkpoints_file()
save_remote_tensorboard_event_files()
class super_gradients.common.S3Connector(env: str, bucket_name: str)[source]

Bases: super_gradients.common.abstractions.abstract_logger.ILogger

S3Connector - S3 Connection Manager

check_key_exists()
get_object_by_etag()
create_bucket()
delete_bucket()
get_object_metadata()
delete_key()
upload_file_from_stream()
upload_file()
download_key()
download_keys_by_prefix()
download_file_by_path()
empty_folder_content_by_path_prefix()
upload_buffer()
list_bucket_objects()
create_presigned_upload_url()
create_presigned_download_url()
static convert_content_length_to_mb(content_length)[source]
copy_key()
super_gradients.common.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.is_distributed()bool[source]
class super_gradients.common.StrictLoad(value)[source]

Bases: enum.Enum

Wrapper for adding more functionality to torch’s strict_load parameter in load_state_dict().
Attributes:

OFF - Native torch “strict_load = off” behaviour. See nn.Module.load_state_dict() documentation for more details. ON - Native torch “strict_load = on” behaviour. See nn.Module.load_state_dict() documentation for more details. NO_KEY_MATCHING - Allows the usage of SuperGradient’s adapt_checkpoint function, which loads a checkpoint by matching each

layer’s shapes (and bypasses the strict matching of the names of each layer (ie: disregards the state_dict key matching)).

OFF = False
ON = True
NO_KEY_MATCHING = 'no_key_matching'
class super_gradients.common.DeepLearningTask(value)[source]

Bases: str, enum.Enum

An enumeration.

CLASSIFICATION = 'classification'
SEMANTIC_SEGMENTATION = 'semantic_segmentation'
OBJECT_DETECTION = 'object_detection'
DEPTH_ESTIMATION = 'depth_estimation'
POSE_ESTIMATION = 'pose_estimation'
NLP = 'nlp'
OTHER = 'other'
class super_gradients.common.EvaluationType(value)[source]

Bases: str, enum.Enum

Passed to SgModel.evaluate(..), and controls which phase callbacks should be triggered (if at all).

Attributes:

TEST VALIDATION

TEST = 'TEST'
VALIDATION = 'VALIDATION'
class super_gradients.common.MultiGPUMode(value)[source]

Bases: str, enum.Enum

OFF                       - Single GPU Mode / CPU Mode
DATA_PARALLEL             - Multiple GPUs, Synchronous
DISTRIBUTED_DATA_PARALLEL - Multiple GPUs, Asynchronous
OFF = 'Off'
DATA_PARALLEL = 'DP'
DISTRIBUTED_DATA_PARALLEL = 'DDP'
AUTO = 'AUTO'

Module contents