google / google/gin-config

Gin-Config Best Practices

Open
#56 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.2k
Forks
122
Avg merge
5d 10h
Merged PRs (30d)
2

Description

Hey all,

I'm wondering if folks have some design recommendations for how to use gin-config in both research and production project. Gin is *powerful* and can be dangerous if used in excess. In particular, I'm curious about where people recommend storing function default values (for hyperparams specifically). In gin we have 2 popular options:

Option 1: Include default values in method signature, and only override specific hparams in `.gin` files if we are actively experimenting on them. Do not store defaults in `.gin`.

```python
def preprocess(inputs, eps=.001, p=1.4):
# do stuff
```

Option 2: Store all default values in a `base.gin` file or similar, and override them as necessary for different experiments. Do not store default hparam values in functions.

```python
def preprocess(inputs, eps, p):
# do stuff
```

```python
preprocess.eps = .001
preprocess.p = 1.4

train/preprocess.eps = .0002
```

The key challenge I'm facing is it's hard to manage default values in 2 places. Much easier to store all defaults in a single place. Thoughts?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.