Skip to content

Configuration API

TorchTweakConfig

torch_tweak.torch.config.TorchTweakConfig

TorchTweakConfig()

Torch Tweak configuration.

Initialize TorchTweakConfig.

Source code in torch_tweak/torch/config.py
def __init__(self) -> None:
    """Initialize TorchTweakConfig."""
    self._cache_dir: Path = torch_tweak_cache_dir()
    self._min_num_samples: int = DEFAULT_MIN_NUM_SAMPLES
    self._max_num_samples_stored: int | float = DEFAULT_MAX_NUM_SAMPLES_STORED
    self._device_after_tuning: str = DEFAULT_DEVICE_AFTER_TUNING
    self.strict_mode: bool = True
    self.enable_hf_integrations: bool = True

cache_dir property writable

cache_dir

The cache directory.

device_after_tuning property writable

device_after_tuning

The device to use after tuning.

max_num_samples_stored property writable

max_num_samples_stored

The minimum number of samples to collect before optimizing.

min_num_samples property writable

min_num_samples

The minimum number of samples to collect before optimizing.

config

Global configuration instance:

torch_tweak.torch.config

Inplace configuration.

config module-attribute

config = TorchTweakConfig()