> For clean Markdown content of this page, append .md to this URL.

# aitune.torch.config

Inplace configuration.

## Module Contents

### Classes

| Name                                                | Description                            |
| --------------------------------------------------- | -------------------------------------- |
| [`AITuneConfig`](#aitune-torch-config-AITuneConfig) | AITune configuration.                  |
| [`AITuneMode`](#aitune-torch-config-AITuneMode)     | AITune execution mode used for tuning. |

### Functions

| Name                                                        | Description                                                 |
| ----------------------------------------------------------- | ----------------------------------------------------------- |
| [`aitune_cache_dir`](#aitune-torch-config-aitune_cache_dir) | Configure cache dir location based on environment variable. |

### Data

[`DEFAULT_DEVICE_AFTER_TUNING`](#aitune-torch-config-DEFAULT_DEVICE_AFTER_TUNING)

[`DEFAULT_MAX_NUM_SAMPLES_STORED`](#aitune-torch-config-DEFAULT_MAX_NUM_SAMPLES_STORED)

[`DEFAULT_MIN_NUM_SAMPLES`](#aitune-torch-config-DEFAULT_MIN_NUM_SAMPLES)

[`DEFAULT_TUNING_DATA_OUTPUT_PATH`](#aitune-torch-config-DEFAULT_TUNING_DATA_OUTPUT_PATH)

[`config`](#aitune-torch-config-config)

### API

```python
class aitune.torch.config.AITuneConfig()
```

AITune configuration.

**`_cache_dir`** `Path = aitune_cache_dir()`

---

**`_min_num_samples`** `int = DEFAULT_MIN_NUM_SAMPLES`

---

**`_tuning_data_output_path`** `Path | None`

---

**`cache_dir`** `Path`

Get the cache directory.

---

**`device_after_tuning`** `str = DEFAULT_DEVICE_AFTER_TUNING`

---

**`enable_diffusers_integration`** `bool = AITUNE_DIFFUSERS_INTEGRATION`

---

**`enable_transformers_integration`** `bool = AITUNE_TRANSFORMERS_INTEGRATION`

---

**`max_num_samples_stored`** `int | float = DEFAULT_MAX_NUM_SAMPLES_STORED`

---

**`min_num_samples`** `int`

Get the minimum number of samples to collect before optimizing.

---

**`strict_mode`** `bool = True`

---

**`tuning_data_output_path`** `Path`

Get the output path for tuning data.

---

**`uses_default_tuning_data_output_path`** `bool`

Return whether AITune selected the tuning data output path.

---

```python
aitune.torch.config.AITuneConfig.to_dict() -> dict[str, typing.Any]
```

Return all configuration attributes keyed by their public name.

```python
class aitune.torch.config.AITuneMode
```

**Bases:** `enum.Enum`

AITune execution mode used for tuning.

**`DECLARATIVE`** `= 'DECLARATIVE'`

---

**`JIT`** `= 'JIT'`

---

```python
aitune.torch.config.aitune_cache_dir() -> pathlib.Path
```

Configure cache dir location based on environment variable.

**Returns:** `Path`

Cache dir from AITUNE\_CACHE\_DIR environment variable, or default.

```python
aitune.torch.config.DEFAULT_DEVICE_AFTER_TUNING = 'meta'
```

```python
aitune.torch.config.DEFAULT_MAX_NUM_SAMPLES_STORED = 1
```

```python
aitune.torch.config.DEFAULT_MIN_NUM_SAMPLES = 100
```

```python
aitune.torch.config.DEFAULT_TUNING_DATA_OUTPUT_PATH = _AITUNE_CACHE_DIR / 'tuning_data' / 'report.json'
```

```python
aitune.torch.config.config = AITuneConfig()
```