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

fix: adjust where g2p imports need to come from now #8

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

joanise
Copy link
Member

@joanise joanise commented Mar 12, 2024

When we optimized the g2p CLI to load fast, we removed a number of imports from g2p.init, so now we have to import those symbols from where they are actually defined.

Fixes: EveryVoiceTTS/EveryVoice#323

When we optimized the g2p CLI to load fast, we removed a number of imports from
g2p.__init__, so now we have to import those symbols from where they are
actually defined.

Fixes: EveryVoiceTTS/EveryVoice#323
@joanise joanise requested a review from roedoejet March 12, 2024 15:42
Copy link

CLI load time: 0:00.16
Pull Request HEAD: bd6869afbe0540595817f59f9f4771a779e35c36
Imports that take more than 0.1 s:
import time: self [us] | cumulative | imported package
import time:       233 |     114346 |   typer
import time:       267 |     119021 | aligner.cli

Copy link
Member

@roedoejet roedoejet left a comment

Choose a reason for hiding this comment

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

thanks!

@@ -19,7 +19,9 @@ def __init__(self, sentence_list, transducer):

def create_transducer(text, labels_dictionary, debug=False):
# deferred expensive imports
from g2p import CompositeTransducer, Mapping, Transducer, make_g2p
from g2p import make_g2p
Copy link
Member

Choose a reason for hiding this comment

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

We'll have to make sure this is in the migration guide!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah! Indeed. Making a note of this (the other bits are in some Studio commit messages I`ll have to dig up)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, when I made g2p -h fast, I removed a lot of imports from g2p/__init__.py, so anything expecting those imports to work will need to be changed.
You can see those changes in roedoejet/g2p@0b8d773
I could argue it was not great style to import just to expose, but that's irrelevant: if packages using g2p took advantage of that, we need to warn them!
And that makes me realize that commit really should have had a breaking change warning. I didn't think of those changes as breaking because we don't document anywhere that those imports were part of the API.

@joanise joanise merged commit bd6869a into main Mar 13, 2024
2 checks passed
@joanise joanise deleted the dev.ej/323.g2p-imports branch March 13, 2024 14:00
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.

everyvoice segment -> ImportError: cannot import name 'CompositeTransducer' from 'g2p'
3 participants