cli.shared.types.utils package


cli.shared.types.utils.dataloader module

class cli.shared.types.utils.dataloader.DataLoaderCliConfigType(default: ~cli.shared.types.utils.dataloader.DataLoaderConfig = <factory>, train: ~cli.shared.types.utils.dataloader.DataLoaderConfig | None = None, test: ~cli.shared.types.utils.dataloader.DataLoaderConfig | None = None)

Bases: object

This dataclass encapsulates the data loader configurations for different scenarios. It allows for a single default configuration and optional specific configurations.

default: DataLoaderConfig
test: DataLoaderConfig | None = None
train: DataLoaderConfig | None = None
class cli.shared.types.utils.dataloader.DataLoaderConfig(num_workers: int = 1, shuffle: bool = False, drop_last: bool = False, pin_memory: bool = True, batch_size: int = 32)

Bases: object

This dataclass is used to store the configuration for a data loader. It can be used generically for any type of data loading scenario (e.g., training, testing).

batch_size: int = 32
drop_last: bool = False
num_workers: int = 1
pin_memory: bool = True
shuffle: bool = False

cli.shared.types.utils.dataset module

class cli.shared.types.utils.dataset.AttacksDatasetCliConfigType(dataset_name: str, num_classes: int, train_dataset_path: str | None = None, test_dataset_path: str | None = None, download: bool | None = True, preprocessing: PreprocessConfig | None = None, dataset_part: str | None = 'test', random_sample_size: int | None = None)

Bases: DatasetCliConfigType

This dataclass is used to store the configuration of the dataset CLI used for attacks. It extends the DatasetCliConfigType. In addition to the attributes of the DatasetCliConfigType, it has the following attributes:

dataset_part

The part of the dataset to be used for the attack. it can be train, test or all. This is valid if the dataset paths are not provided.

Type:

Optional[str]

random_sample_size

The size of the random sample to be taken from the dataset.

Type:

Optional[int]

dataset_part: str | None = 'test'
random_sample_size: int | None = None
class cli.shared.types.utils.dataset.DatasetCliConfigType(dataset_name: str, num_classes: int, train_dataset_path: str | None = None, test_dataset_path: str | None = None, download: bool | None = True, preprocessing: PreprocessConfig | None = None)

Bases: object

This dataclass is used to store the configuration of the dataset CLI.

dataset_name: str
download: bool | None = True
num_classes: int
preprocessing: PreprocessConfig | None = None
test_dataset_path: str | None = None
train_dataset_path: str | None = None

cli.shared.types.utils.device module

class cli.shared.types.utils.device.DeviceConfig(use_ddp: bool = False, processor: str = 'cpu', gpu_ids: List[int] | None = None)

Bases: object

This dataclass is used to store the configuration of the device.

gpu_ids: List[int] | None = None
processor: str = 'cpu'
use_ddp: bool = False

cli.shared.types.utils.model module

class cli.shared.types.utils.model.ModelCliConfigType(model_name: str, num_input_channels: int, num_classes: int, pretrained: bool, weights: str | None, is_external: bool, path_configs: ModelPathConfig, norm_config: ModelNormConfig, random_seed: int | None)

Bases: object

This dataclass is used to store the configuration of the model CLI.

is_external: bool
model_name: str
norm_config: ModelNormConfig
num_classes: int
num_input_channels: int
path_configs: ModelPathConfig
pretrained: bool
random_seed: int | None
weights: str | None
class cli.shared.types.utils.model.ModelNormConfig(add_norm_layer: bool, norm_mean: List[float] | None, norm_std: List[float] | None)

Bases: object

This dataclass is used to store the configuration of the normalization layer of a model.

add_norm_layer: bool
norm_mean: List[float] | None
norm_std: List[float] | None
class cli.shared.types.utils.model.ModelPathConfig(model_arch_path: str | None, model_weights_path: str | None)

Bases: object

This dataclass is used to store the configuration of the paths of a model.

model_arch_path: str | None
model_weights_path: str | None

cli.shared.types.utils.target module

class cli.shared.types.utils.target.TargetCLIConfigType(targeted: bool | None = False, auto_generate_target: bool | None = False, target_images_config: TargetImageCLIConfigType | None = None, target_labels_config: TargetLabelCLIConfigType | None = None)

Bases: object

This dataclass is used to store the configuration of the target CLI.

auto_generate_target: bool | None = False
target_images_config: TargetImageCLIConfigType | None = None
target_labels_config: TargetLabelCLIConfigType | None = None
targeted: bool | None = False
class cli.shared.types.utils.target.TargetImageCLIConfigType(target_images_dir: str | None = None)

Bases: object

This dataclass is used to store the configuration of the target CLI images.

target_images_dir: str | None = None
class cli.shared.types.utils.target.TargetLabelCLIConfigType(target_labels: List[int] | None = None, target_labels_path: str | None = None, target_labels_separator: str | None = ',')

Bases: object

This dataclass is used to store the configuration of the target CLI labels.

target_labels: List[int] | None = None
target_labels_path: str | None = None
target_labels_separator: str | None = ','