Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions website/docs/patterns/configuring_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ We can directly override Launcher config in primary config.
<div className="col col--4">

```yaml title="config.yaml"
a: 1

hydra:
launcher:
ton_fuel: 2
Expand Down Expand Up @@ -140,7 +138,7 @@ ton_fuel: 2
</div>
<div className="col col--6">

```yaml title="hydra/sweeper/my_sim.yaml" {5}
```yaml title="hydra/launcher/my_sim.yaml" {5}
defaults:
- sim

Expand Down
3 changes: 1 addition & 2 deletions website/docs/patterns/specializing_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ the keyword `optional` tells Hydra to just continue if it can't find this file.
When specializing config, you usually want to only specify what's different, and not the whole thing.
We want the model for alexnet, when trained on cifar - to have 5 layers.

### dataset_model/cifar10_alexnet.yaml
```yaml
```yaml title="dataset_model/cifar10_alexnet.yaml"
# @package _global_

model:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ You can disable its creation by overriding `hydra.output_subdir` to `null`.
With `hydra.job.chdir=True`, you can still access the original working directory by importing `get_original_cwd()` and `to_absolute_path()` in `hydra.utils`:

```python
import os
from omegaconf import DictConfig
import hydra
from hydra.utils import get_original_cwd, to_absolute_path

@hydra.main(version_base=None)
Expand Down
7 changes: 6 additions & 1 deletion website/docs/tutorials/structured_config/10_config_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ that is not the only way! We can also use `ConfigStore` to make another config g
To achieve this, we add a few lines (highlighted) in the above `my_app.py` file:


```python title="my_app.py" {1-9}
```python title="my_app.py" {6-14}
import hydra
from omegaconf import OmegaConf, DictConfig
from hydra.core.config_store import ConfigStore
from dataclasses import dataclass

@dataclass
class PostgresSQLConfig:
driver: str = "postgresql"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {ExampleGithubLink} from "@site/src/components/GithubLink"
Dataclasses can be nested and then accessed via a common root. The entire tree is type checked.

```python
from dataclasses import dataclass
from dataclasses import dataclass, field

import hydra
from hydra.core.config_store import ConfigStore
Expand Down
4 changes: 3 additions & 1 deletion website/docs/tutorials/structured_config/3_config_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {ExampleGithubLink} from "@site/src/components/GithubLink"
Structured Configs can be used to implement config groups. Special care needs to be taken when specifying a
default value for fields populated by a config group. We will look at why below.

```python title="Defining a config group for database" {16-17,22-23}
```python title="Defining a config group for database" {24}
from typing import Any
from omegaconf import OmegaConf
from dataclasses import dataclass

import hydra
Expand Down
12 changes: 8 additions & 4 deletions website/docs/tutorials/structured_config/4_defaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ The example below extends the previous example by adding a defaults list that wi
NOTE: You can still place your defaults list in your primary (YAML) config file (Example in next page).
</div><br/>

```python {11-14,19,25}
from dataclasses import dataclass
```python {19-22,26-27}
from dataclasses import dataclass, field
from typing import Any, List

import hydra
from hydra.core.config_store import ConfigStore
from omegaconf import MISSING, OmegaConf

@dataclass
class MySQLConfig:
...
driver: str = "mysql"
port: int = 3306

@dataclass
class PostGreSQLConfig:
...
driver: str = "postgresql"
port: int = 5432
timeout: int = 10

defaults = [
# Load the config "mysql" from the config group "db"
Expand Down
2 changes: 1 addition & 1 deletion website/docs/tutorials/structured_config/5_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ if __name__ == "__main__":
</div>
<div className="col col--6">

```python title="database_lib.py" {17,22}
```python title="database_lib.py" {21}
from dataclasses import dataclass

from hydra.core.config_store import ConfigStore
Expand Down