Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Make --overrides more flexible #5399

Merged
merged 7 commits into from
Sep 21, 2021
Merged

Make --overrides more flexible #5399

merged 7 commits into from
Sep 21, 2021

Conversation

epwalsh
Copy link
Member

@epwalsh epwalsh commented Sep 7, 2021

This proposed change impacts the behavior of --overrides in a potentially breaking way ⚠️

Overview

Previously the final configuration params read from a file were simply taken as the union over the original params in the file and the params specified in --overrides. With this, you can now use --overrides to completely replace any part of the original config.

For example, passing --overrides '{"model":{"type":"foo"}}' will completely replace the "model" part of the original config. However, when you just want to change a single field in the JSON structure without removing / replacing adjacent fields, you can still use the "dot" syntax. For example, --overrides '{"model.num_layers":3}' will only change the num_layers parameter to the "model" part of the config, leaving everything else unchanged.

Why is this useful?

With the old behavior it is impossible to remove any fields from the a config via --overrides. This becomes an issue when, for example, you want to change the type of your dataset_reader or model to a different type that takes completely different arguments.

cc @yakazimir

.github/workflows/ci.yml Outdated Show resolved Hide resolved
@epwalsh epwalsh enabled auto-merge (squash) September 21, 2021 15:42
@epwalsh epwalsh merged commit 44155ac into main Sep 21, 2021
@epwalsh epwalsh deleted the overrides branch September 21, 2021 15:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants