Skip to content

Check and update text config for new text#799

Open
joanise wants to merge 11 commits into
mainfrom
dev.ej/check-text-config
Open

Check and update text config for new text#799
joanise wants to merge 11 commits into
mainfrom
dev.ej/check-text-config

Conversation

@joanise

@joanise joanise commented May 6, 2026

Copy link
Copy Markdown
Member

PR Goal?

Add a new subcommand check-text-config to 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 und

and other variants as documented in everyvoice check-text-config -h

Confidence?

medium

Version change?

no

Related PRs?

no

@semanticdiff-com

semanticdiff-com Bot commented May 6, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  everyvoice/preprocessor/preprocessor.py  79% smaller
  everyvoice/base_cli/checkpoint.py  47% smaller
  everyvoice/cli.py  25% smaller
  everyvoice/tests/test_cli.py  2% smaller
  everyvoice/base_cli/check_group.py  0% smaller

@joanise
joanise marked this pull request as draft May 6, 2026 18:53
@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor
CLI load time: 0:00.23
Pull Request HEAD: f7a35b6a8184b6340b487b6f03f855b4f4d947ff

Imports that take more than 0.1 s:
import time: self [us] | cumulative | imported package
import time:       784 |     168930 |           everyvoice.model.feature_prediction.FastSpeech2_lightning.fs2.cli.benchmark
import time:       426 |     177319 |         everyvoice.model.feature_prediction.FastSpeech2_lightning.fs2.cli.cli
import time:       264 |     178395 |       everyvoice.model.feature_prediction.FastSpeech2_lightning.fs2.cli
import time:      1080 |     179475 |     everyvoice.model.feature_prediction.FastSpeech2_lightning.fs2.cli.check_data
import time:      1175 |     182709 |   everyvoice.base_cli.check_group
import time:      6461 |     430699 | everyvoice.cli
import time:     23129 |     302710 |             importlib.metadata
import time:       377 |     303087 |           pygments.plugin
import time:      3280 |     309248 |         pygments.filters
import time:      3773 |     314765 |       pygments.lexer
import time:      5451 |     338851 |     rich.syntax
import time:      4213 |     397867 |   rich.markdown
import time:      3831 |     469424 | typer.rich_utils

@codecov

codecov Bot commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.50549% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.36%. Comparing base (7d7db05) to head (fcf51c5).

Files with missing lines Patch % Lines
everyvoice/cli.py 96.00% 0 Missing and 3 partials ⚠️
everyvoice/base_cli/checkpoint.py 87.50% 0 Missing and 1 partial ⚠️
everyvoice/preprocessor/preprocessor.py 87.50% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joanise
joanise force-pushed the dev.ej/check-text-config branch 2 times, most recently from f31946b to d0a8cdf Compare June 11, 2026 20:27
@joanise
joanise force-pushed the dev.ej/check-text-config branch 3 times, most recently from 7e1215f to 3a87c08 Compare June 24, 2026 20:17
@joanise
joanise force-pushed the dev.ej/check-text-config branch from 3a87c08 to 44f3d03 Compare June 29, 2026 21:44
@joanise
joanise force-pushed the dev.ej/check-text-config branch 4 times, most recently from b98dd8b to 4b0ee69 Compare July 16, 2026 14:09
@joanise
joanise marked this pull request as ready for review July 16, 2026 15:35
@joanise
joanise force-pushed the dev.ej/check-text-config branch from 35ee1e9 to 65eaa54 Compare July 16, 2026 15:48
@joanise
joanise force-pushed the dev.ej/check-text-config branch from 65eaa54 to fcf51c5 Compare July 16, 2026 15:55
@joanise
joanise requested a review from roedoejet July 16, 2026 15:58

@roedoejet roedoejet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for cleaning this all up

"synthesize",
"preprocess",
"demo",
"check-data",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe check-data and check-text-config can be merged into everyvoice check data and everyvoice check text-config

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread everyvoice/cli.py
# 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):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! Yes, I've been meaning to do this - thanks!

Comment thread everyvoice/cli.py Outdated


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"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""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"""

Comment thread everyvoice/cli.py Outdated
# 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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, StyleTTS2 has it as well, but not HiFiGAN

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread everyvoice/cli.py Outdated
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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never mind, figured it out

Comment thread everyvoice/cli.py Outdated
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, could we not have --file and then try to inspect it? not a big deal, but this tripped me up on first-try.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 characters as the first line) should be supported -- no | on the first line
  • if the first utterance is literally characters, or phones, that's ambiguous again

@joanise joanise Jul 17, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread everyvoice/cli.py Outdated
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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly supporting the text-to-spec config is a good idea.

@joanise joanise Jul 20, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred to issue #844

@joanise joanise mentioned this pull request Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants