Common package
- super_gradients.common.setup_crash_handler()[source]
Setup the environment to handle crashes, with crash tips and more.
- 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) 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) 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) 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
- 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:
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:
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()
- copy_key()
- super_gradients.common.init_trainer()[source]
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.
- class super_gradients.common.StrictLoad(value)[source]
Bases:
Enum
Wrapper for adding more functionality to torch’s strict_load parameter in load_state_dict(). .. attribute:: 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
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
Passed to Trainer.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
- 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'
- class super_gradients.common.UpsampleMode(value)[source]
Bases:
Enum
An enumeration.
- NEAREST = 'nearest'
- BILINEAR = 'bilinear'
- BICUBIC = 'bicubic'
- SNPE_BILINEAR = 'snpe_bilinear'
- class super_gradients.common.AutoLoggerConfig[source]
Bases:
object
A Class for the Automated Logging Config
- FILE_LOGGING_LEVEL = 'DEBUG'
- CONSOLE_LOGGING_LEVEL = 'INFO'
- filename: Optional[str]
- class super_gradients.common.auto_logging.AutoLoggerConfig[source]
Bases:
object
A Class for the Automated Logging Config
- FILE_LOGGING_LEVEL = 'DEBUG'
- CONSOLE_LOGGING_LEVEL = 'INFO'
- filename: Optional[str]
- class super_gradients.common.auto_logging.ConsoleSink[source]
Bases:
object
Singleton responsible to sink the console streams (stdout/stderr) into a file.
- class super_gradients.common.data_connection.S3Connector(env: str, bucket_name: str)[source]
Bases:
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()
- copy_key()
- class super_gradients.common.data_interface.DatasetDataInterface(env: str, data_connection_source: str = 's3')[source]
Bases:
object
- load_remote_dataset_file()
- class super_gradients.common.data_interface.ADNNModelRepositoryDataInterfaces(data_connection_location: str = 'local', data_connection_credentials: Optional[str] = None)[source]
Bases:
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.data_types.StrictLoad(value)[source]
Bases:
Enum
Wrapper for adding more functionality to torch’s strict_load parameter in load_state_dict(). .. attribute:: 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.data_types.DeepLearningTask(value)[source]
Bases:
str
,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.data_types.EvaluationType(value)[source]
Bases:
str
,Enum
Passed to Trainer.evaluate(..), and controls which phase callbacks should be triggered (if at all).
- Attributes:
TEST VALIDATION
- TEST = 'TEST'
- VALIDATION = 'VALIDATION'
- class super_gradients.common.data_types.MultiGPUMode(value)[source]
Bases:
str
,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'
- class super_gradients.common.data_types.UpsampleMode(value)[source]
Bases:
Enum
An enumeration.
- NEAREST = 'nearest'
- BILINEAR = 'bilinear'
- BICUBIC = 'bicubic'
- SNPE_BILINEAR = 'snpe_bilinear'
- super_gradients.common.decorators.explicit_params_validation(function: Optional[Callable] = None, validation_type: str = 'None')[source]
- super_gradients.common.decorators.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
This module is in charge of environment variables and consts.
- super_gradients.common.environment.init_trainer()[source]
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.registry.register_model(name: Optional[str] = None) Callable
Set up a register decorator.
- Parameters
name – If specified, the decorated object will be registered with this name.
- Returns
Decorator that registers the callable.
- super_gradients.common.registry.register_detection_module(name: Optional[str] = None) Callable
Set up a register decorator.
- Parameters
name – If specified, the decorated object will be registered with this name.
- Returns
Decorator that registers the callable.
- super_gradients.common.registry.register_metric(name: Optional[str] = None) Callable
Set up a register decorator.
- Parameters
name – If specified, the decorated object will be registered with this name.
- Returns
Decorator that registers the callable.
- super_gradients.common.registry.register_loss(name: Optional[str] = None) Callable
Set up a register decorator.
- Parameters
name – If specified, the decorated object will be registered with this name.
- Returns
Decorator that registers the callable.