Check and update text config for new text#799
Conversation
Changed Files
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #799 +/- ##
==========================================
+ Coverage 85.17% 85.36% +0.19%
==========================================
Files 48 48
Lines 4417 4496 +79
Branches 655 672 +17
==========================================
+ Hits 3762 3838 +76
Misses 506 506
- Partials 149 152 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
f31946b to
d0a8cdf
Compare
7e1215f to
3a87c08
Compare
3a87c08 to
44f3d03
Compare
b98dd8b to
4b0ee69
Compare
35ee1e9 to
65eaa54
Compare
…ig [no ci] First step in implementing #385
65eaa54 to
fcf51c5
Compare
roedoejet
left a comment
There was a problem hiding this comment.
This is so awesome @joanise. I'm really excited to use this! I've put a couple suggestions/recommendations on here that I'd like to see. Some or maybe all you can address before merging, otherwise it's OK to merge and make issues.
Thanks!
| text_processor.token_sequence_to_text_sequence(phone_tokens), | ||
| apply_punctuation_rules=True, | ||
| ) | ||
| if ( |
There was a problem hiding this comment.
thanks for cleaning this all up
| "synthesize", | ||
| "preprocess", | ||
| "demo", | ||
| "check-data", |
There was a problem hiding this comment.
I think maybe check-data and check-text-config can be merged into everyvoice check data and everyvoice check text-config
| # single commands gets listed first, followed by sub-command groups. There are so many | ||
| # top-level commands and command groups now that it gets quite confusing, so let's order | ||
| # them logically for the main ones, and alphabetically for the rest. | ||
| class MainCommandOrder(typer.core.TyperGroup): |
There was a problem hiding this comment.
awesome! Yes, I've been meaning to do this - thanks!
|
|
||
|
|
||
| def get_text_config_from_config_or_model(config: Optional[Path], model: Optional[Path]): | ||
| """Helper for chec_text_config: load a TextConfig from a config file or model file""" |
There was a problem hiding this comment.
| """Helper for chec_text_config: load a TextConfig from a config file or model file""" | |
| """Helper for check_text_config: load a TextConfig from a config file or model file""" |
| # print("Looking for text config") | ||
| model_config = checkpoint["hyper_parameters"]["config"] | ||
| if "text" in model_config: | ||
| # Question: FS2 models have text config, do any others have it? |
There was a problem hiding this comment.
Yes, StyleTTS2 has it as well, but not HiFiGAN
There was a problem hiding this comment.
I don't see the text config in our styletts2 checkpoint, so I'm not sure how I'll be able to support that model type...
everyvoice checkpoint inspect logs_and_checkpoints/E2E-Experiment/base/last.ckpt
is giving me no model_info, and no hyper_parameters, or no text field.
There was a problem hiding this comment.
Figured it out. I had an old model, in a new model I found the text config, although not quite in the same place as in an FS2 checkpoint.
| model_config = checkpoint["hyper_parameters"]["config"] | ||
| if "text" in model_config: | ||
| # Question: FS2 models have text config, do any others have it? | ||
| # For other models that have it, are they in the same place in the metadata? |
There was a problem hiding this comment.
There was a problem hiding this comment.
Right, that looks like what I need, but again I don't see it in the checkpoint...
I can see, though, that we could support
everyvoice check test-config --config config/everyvoice-text-to-wav.yaml ...
There was a problem hiding this comment.
never mind, figured it out
| Test processing input_file against the text configuration provided, or the text | ||
| configuration found in model, and report any incompatibilities. | ||
|
|
||
| Required options: one of --config and --model, as well as one of --text-file and --psv-file. |
There was a problem hiding this comment.
Hm, could we not have --file and then try to inspect it? not a big deal, but this tripped me up on first-try.
There was a problem hiding this comment.
We could, but I'm not a super fan. Maybe worth separating into its own issue.
The logic would be a bit messy:
- if
|occurs in the first line, we would presumably assume .psv, but how would we support a literal|in the first piece of text? - a single column "psv" (with
charactersas the first line) should be supported -- no|on the first line - if the first utterance is literally
characters, orphones, that's ambiguous again
There was a problem hiding this comment.
In the wizard we take the time to ask clarifying questions from the user, but I'd rather not write that logic up again. Every user will trip on this, but I think the error message is clear enough.
| from everyvoice.text.text_processor import TextProcessor | ||
| from everyvoice.text.utils import guess_graphemes_in_text | ||
|
|
||
| text_config = get_text_config_from_config_or_model(config, model) |
There was a problem hiding this comment.
If I pass a text-to-spec config for example, I get a somewhat cryptic error. Can we handle this by catching ValidationErrors and trying to load text-to-spec/spec-to-wav etc configs and if one of them passes, then raising that as an error? Alternatively, the text config is actually available in the text-to-spec config, so it would ideally be best if we look for text in the config and try and load that if it exists as well.
There was a problem hiding this comment.
Directly supporting the text-to-spec config is a good idea.
PR Goal?
Add a new subcommand
check-text-configto validate if some new text is compatible with a model or config in terms of the character inventory it requires.Fixes?
Does parts of #385
Feedback sought?
Careful review: does this meet the requirements, does it work correctly, and what additional work will still be required?
If this works but is incomplete, I'll want to merge this and make future PRs for other features. Of course, anything that isn't right I'll want to fix before merging.
Also, I'm in the process of splicing out commits that you will find here that are not germane to this PR, to make reviewing easier. You can already start testing though.Unrelated changes were now spliced out, this is ready to review. The remaining semi-related changes included here are too closely tied to this PR to splice out.Priority?
pretty high
Tests added?
yup!
How to test?
everyvoice check-text-config --config config/everyvoice-shared-text.yaml --text-file some_text.txt --language undand other variants as documented in
everyvoice check-text-config -hConfidence?
medium
Version change?
no
Related PRs?
no