Interesting usage of SPACY_CONFIG_OVERRIDES #11234
polkaYK
started this conversation in
Show & Tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
Today I discovered a pretty interesting behavior of variable interpolation. I don't think this is a bug, but I think it's worth documenting somewhere.
Recently, I have played with variable interpolation in
spacy project
and read about theSPACY_CONFIG_OVERRIDES
variable. It turned out that you can utilize it to override values inproject.yml
file. I say "turned out", because I'm not sure this was listed in docs, but I may be wrong. Given you have something like this in yourproject.yml
file:and you run:
you get:
I think this behavior can be leveraged in some situations. So when I tried to run a whole pipeline in such manner, I was surprised when
train
command crashed with the message:I dug into the code and realized that when you run a command that contains
python -m spacy train
subcommand, interpolation is performed two times: the first is whenproject.yml
is filled with provided values, the second is when a training config is filled with provided values during the execution of thetrain
subcommand.I found a workaround: turns out you can add conflicting sections to
config.cfg
in the following manner:And if you have nested values, you need to provide all subsections.
project.yml
config.cfg
That's how you make
spacy train
ignore values provided forproject.yml
Maybe all the aforementioned info is not how
spacy project
is supposed to work in the first place, so I'm not creating the issue. On the other hand, you may want to consider changing some things about it.Beta Was this translation helpful? Give feedback.
All reactions