Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev.ap/text pf updates expanded #627

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

roedoejet
Copy link
Member

@roedoejet roedoejet commented Jan 20, 2025

PR Goal?

This PR improves the phonological feature calculation by:

  • increasing the number of features to include more punctuation (getting rid of BB and SB in favour of colon, semi-colon, and period)
  • getting rid of custom tone feature calculation and just using Panphon's calculation using tone-bars. Note: this makes us require tone bars and not accents, but it also fixes Improve tone feature calculation for phonological features #357
  • we also add phonological feature calculation for common text encoding special tokens like [MASK] and [UNK]

Fixes?

#357

Feedback sought?

Sanity + high-level comments. low-level code comments are also welcome but less of a priority.

Priority?

medium

Tests added?

I've added some tests and updated existing ones

How to test?

A little bit tricky to test, but maybe inspecting some of the doctests will help. The main work is just analysing the updated code in text/features.py

Confidence?

medium (I think this is an improvement, and it is what we use in PF-BERT, but it's a big set of interrelated problems so I would appreciate the feedback)

Version change?

Yes, this is a breaking change.

Related PRs?

EveryVoiceTTS/DeepForcedAligner#34
EveryVoiceTTS/FastSpeech2_lightning#109

Copy link

semanticdiff-com bot commented Jan 20, 2025

@roedoejet roedoejet requested review from SamuelLarkin, joanise and MENGZHEGENG and removed request for SamuelLarkin January 20, 2025 22:13
@roedoejet
Copy link
Member Author

whoops - looks like some tests aren't passing - I'll investigate, but it should still be ready for review

@roedoejet
Copy link
Member Author

@joanise - I don't understand why the doctests are failling here, they're not failing on my machine, do you have any ideas?

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 78.04878% with 18 lines in your changes missing coverage. Please review.

Project coverage is 76.21%. Comparing base (a6829b4) to head (bc4dac0).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
everyvoice/text/features.py 74.57% 11 Missing and 4 partials ⚠️
everyvoice/text/utils.py 75.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #627      +/-   ##
==========================================
- Coverage   76.24%   76.21%   -0.04%     
==========================================
  Files          47       47              
  Lines        3490     3536      +46     
  Branches      481      493      +12     
==========================================
+ Hits         2661     2695      +34     
- Misses        726      734       +8     
- Partials      103      107       +4     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Contributor

github-actions bot commented Jan 21, 2025

CLI load time: 0:00.27
Pull Request HEAD: bc4dac05489793e659d5c702b453cb9ca34766b7
Imports that take more than 0.1 s:
import time: self [us] | cumulative | imported package
import time:      1044 |     102595 |     typer.main
import time:       283 |     122714 |   typer
import time:      7901 |     202274 | everyvoice.cli

@joanise
Copy link
Member

joanise commented Jan 21, 2025

We didn't publish 0.3.0 yet, so this PR should update the 0.3 schemas, not create the 0.4 schemas.

Copy link
Member

@joanise joanise left a comment

Choose a reason for hiding this comment

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

sorry, a bunch of comments suggesting changes.

Comment on lines +54 to +91
punctuation_features.append([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
elif char == self.punctuation_hash["question_symbols"]:
punctuation_features.append([0, 1, 0, 0, 0, 0, 0, 0])
elif char == self.punctuation_hash["big_breaks"]:
punctuation_features.append([0, 0, 1, 0, 0, 0, 0, 0])
elif char == self.punctuation_hash["small_breaks"]:
punctuation_features.append([0, 0, 0, 1, 0, 0, 0, 0])
punctuation_features.append([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
elif char == self.punctuation_hash["periods"]:
punctuation_features.append([0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0])
elif char == self.punctuation_hash["colons"]:
punctuation_features.append([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
elif char == self.punctuation_hash["semi_colons"]:
punctuation_features.append([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
elif char == self.punctuation_hash["commas"]:
punctuation_features.append([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0])
elif char == self.punctuation_hash["hyphens"]:
punctuation_features.append([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0])
elif char == self.punctuation_hash["quotemarks"]:
punctuation_features.append([0, 0, 0, 0, 1, 0, 0, 0])
elif char == self.punctuation_hash["ellipsis"]:
punctuation_features.append([0, 0, 0, 0, 0, 1, 0, 0])
punctuation_features.append([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0])
elif char == self.punctuation_hash["parentheses"]:
punctuation_features.append([0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0])
elif char == self.punctuation_hash["ellipses"]:
punctuation_features.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0])
elif char == self.punctuation_hash["exclamations"]:
punctuation_features.append([0, 0, 0, 0, 0, 0, 1, 0])
punctuation_features.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0])
elif char in self.config.symbols.silence:
punctuation_features.append([0, 0, 0, 0, 0, 0, 0, 1])
punctuation_features.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
else:
punctuation_features.append([0, 0, 0, 0, 0, 0, 0, 0])
punctuation_features.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
Copy link
Member

Choose a reason for hiding this comment

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

I'm really not a fan of this long if/elif list. Can we not construct a dict from punc hash value to these one-hot vectors with a loop, and do a dict look up for the punc entries, followed by the last elif and else?
I mean, this code works, so you don't have to change it, but it would be nicer to refactor it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, I kind of like just being able to see the full embedding like this - let's talk at the meeting today

@roedoejet roedoejet requested a review from joanise February 10, 2025 18:40
Copy link
Member

@joanise joanise left a comment

Choose a reason for hiding this comment

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

I haven't been able to test yet, just tiny comments.

Copy link
Member

@joanise joanise left a comment

Choose a reason for hiding this comment

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

Since this PR breaks fs2 and hfgl models, it will need to include targeted messages when a user tries to load a model created with an older version of EV that's not compatible with the current punctuation lists.

@roedoejet roedoejet force-pushed the dev.ap/text-pf-updates-expanded branch from cbcf71a to 78dc32c Compare February 12, 2025 21:13
Copy link
Member

@joanise joanise left a comment

Choose a reason for hiding this comment

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

I think this generally looks good, we're getting close to be able to merge. Just a couple small comments in the related PRs.

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.

Improve tone feature calculation for phonological features
2 participants